From f4c419bd85d9bab630c02c08f2d236b7eaf15c8e Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 25 Oct 2010 11:16:44 +0000 Subject: dvi2tty 5.3.1 (preliminary) git-svn-id: svn://tug.org/texlive/trunk@20195 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/README | 4 +- Build/source/texk/dvi2tty/ChangeLog | 9 + Build/source/texk/dvi2tty/DVI.format | 70 - Build/source/texk/dvi2tty/MANIFEST | 13 - Build/source/texk/dvi2tty/Makefile.am | 40 +- Build/source/texk/dvi2tty/Makefile.in | 118 +- Build/source/texk/dvi2tty/README | 53 - Build/source/texk/dvi2tty/README.ORG | 23 - Build/source/texk/dvi2tty/commands.h | 76 - Build/source/texk/dvi2tty/configure | 28 +- Build/source/texk/dvi2tty/configure.ac | 10 +- Build/source/texk/dvi2tty/disdvi.c | 669 -------- .../texk/dvi2tty/dvi2tty-5.3.1-PATCHES/TL-Changes | 9 + .../dvi2tty/dvi2tty-5.3.1-PATCHES/patch-01-texk | 37 + .../dvi2tty-5.3.1-PATCHES/patch-02-simple-typos | 24 + .../dvi2tty/dvi2tty-5.3.1-PATCHES/patch-03-ANSI-C | 59 + .../dvi2tty/dvi2tty-5.3.1-PATCHES/patch-04-pager | 12 + .../dvi2tty/dvi2tty-5.3.1-PATCHES/patch-05-getline | 78 + .../dvi2tty/dvi2tty-5.3.1-PATCHES/patch-06-bug-fix | 22 + .../dvi2tty-5.3.1-PATCHES/patch-50-kpathsea | 116 ++ .../dvi2tty-5.3.1-PATCHES/patch-60-warnings | 236 +++ .../dvi2tty-5.3.1-PATCHES/patch-70-disdvi-xetex | 298 ++++ .../dvi2tty-5.3.1-PATCHES/patch-80-maybe-bug-fix | 13 + .../dvi2tty-5.3.1-PATCHES/patch-81-maybe-scand | 61 + .../dvi2tty-5.3.1-PATCHES/patch-90-undo-some | 1668 ++++++++++++++++++++ .../dvi2tty-5.3.1-PATCHES/patch-91-undo-rest | 1630 +++++++++++++++++++ Build/source/texk/dvi2tty/dvi2tty-5.3.1/COPYING | 343 ++++ Build/source/texk/dvi2tty/dvi2tty-5.3.1/DVI.format | 102 ++ Build/source/texk/dvi2tty/dvi2tty-5.3.1/Makefile | 40 + Build/source/texk/dvi2tty/dvi2tty-5.3.1/README | 57 + Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.MAC | 11 + Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.ORG | 23 + Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.VMS | 38 + Build/source/texk/dvi2tty/dvi2tty-5.3.1/TODO | 50 + .../dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/getopt.c | 124 ++ .../dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/macintosh.h | 34 + .../dvi2tty-5.3.1/UNIXtoMacLib/unix-to-macintosh.c | 460 ++++++ Build/source/texk/dvi2tty/dvi2tty-5.3.1/commands.h | 76 + Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.1 | 27 + Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.c | 669 ++++++++ Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.1 | 131 ++ .../source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.DCL | 55 + Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.c | 700 ++++++++ Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.h | 91 ++ .../source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.lsm | 16 + .../source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.tex | 262 +++ Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvistuff.c | 1141 +++++++++++++ .../source/texk/dvi2tty/dvi2tty-5.3.1/ligtest.tex | 35 + Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.dvi | Bin 0 -> 1652 bytes .../source/texk/dvi2tty/dvi2tty-5.3.1/test.org.dvi | Bin 0 -> 748 bytes Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.tex | 56 + Build/source/texk/dvi2tty/dvi2tty.1 | 131 -- Build/source/texk/dvi2tty/dvi2tty.c | 700 -------- Build/source/texk/dvi2tty/dvi2tty.h | 91 -- Build/source/texk/dvi2tty/dvi2tty.patch | 91 -- Build/source/texk/dvi2tty/dvistuff.c | 1141 ------------- Build/source/texk/musixflx/ChangeLog | 2 +- 57 files changed, 8944 insertions(+), 3129 deletions(-) delete mode 100644 Build/source/texk/dvi2tty/DVI.format delete mode 100644 Build/source/texk/dvi2tty/MANIFEST delete mode 100644 Build/source/texk/dvi2tty/README delete mode 100644 Build/source/texk/dvi2tty/README.ORG delete mode 100644 Build/source/texk/dvi2tty/commands.h delete mode 100644 Build/source/texk/dvi2tty/disdvi.c create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/TL-Changes create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-01-texk create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-02-simple-typos create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-03-ANSI-C create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-04-pager create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-05-getline create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-06-bug-fix create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-50-kpathsea create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-60-warnings create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-70-disdvi-xetex create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-80-maybe-bug-fix create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-81-maybe-scand create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-90-undo-some create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-91-undo-rest create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/COPYING create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/DVI.format create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/Makefile create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/README create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.MAC create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.ORG create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.VMS create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/TODO create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/getopt.c create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/macintosh.h create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/unix-to-macintosh.c create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/commands.h create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.1 create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.c create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.1 create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.DCL create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.c create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.h create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.lsm create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.tex create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvistuff.c create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/ligtest.tex create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.dvi create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.org.dvi create mode 100644 Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.tex delete mode 100644 Build/source/texk/dvi2tty/dvi2tty.1 delete mode 100644 Build/source/texk/dvi2tty/dvi2tty.c delete mode 100644 Build/source/texk/dvi2tty/dvi2tty.h delete mode 100644 Build/source/texk/dvi2tty/dvi2tty.patch delete mode 100644 Build/source/texk/dvi2tty/dvistuff.c (limited to 'Build/source') diff --git a/Build/source/texk/README b/Build/source/texk/README index efde2cb880b..4447f17d6c4 100644 --- a/Build/source/texk/README +++ b/Build/source/texk/README @@ -35,11 +35,9 @@ detex 2.8 - checked 21may10 devnag - from devnag package installed in texmf-dist. -djgpp - ? - dtl - ? -dvi2tty 5.3.1 - needs update 18may07 +dvi2tty 5.3.1 - checked 25oct10 http://www.mesa.nl/pub/dvi2tty/ dvidvi - ? diff --git a/Build/source/texk/dvi2tty/ChangeLog b/Build/source/texk/dvi2tty/ChangeLog index c3e8a2cc299..6d9199993b1 100644 --- a/Build/source/texk/dvi2tty/ChangeLog +++ b/Build/source/texk/dvi2tty/ChangeLog @@ -1,3 +1,12 @@ +2010-10-23 Peter Breitenlohner + + Import dvi2tty-5.3.1. + + * Makefile.am, configure.ac: Proxy build system for TeX Live, + using the dvi2tty-5.3.1 distribution tree. + * dvi2tty-5.3.1-PATCHES: New directory with patches applied to + the dvi2tty-5.3.1 distribution. + 2010-10-15 Peter Breitenlohner Add two disdvi command line options to handle .dvi files as diff --git a/Build/source/texk/dvi2tty/DVI.format b/Build/source/texk/dvi2tty/DVI.format deleted file mode 100644 index a48ad47e4d9..00000000000 --- a/Build/source/texk/dvi2tty/DVI.format +++ /dev/null @@ -1,70 +0,0 @@ -/* - - -================================================================================ -== 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) - - - -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 deleted file mode 100644 index 304aadd3544..00000000000 --- a/Build/source/texk/dvi2tty/MANIFEST +++ /dev/null @@ -1,13 +0,0 @@ - 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.am b/Build/source/texk/dvi2tty/Makefile.am index 54e1963eec9..ac4cb6637ad 100644 --- a/Build/source/texk/dvi2tty/Makefile.am +++ b/Build/source/texk/dvi2tty/Makefile.am @@ -1,12 +1,24 @@ ## Makefile.am for the TeX Live subdirectory texk/dvi2tty/ ## -## Copyright (C) 2009 Peter Breitenlohner +## Copyright (C) 2009, 2010 Peter Breitenlohner ## You may freely use, modify and/or distribute this file. ## ACLOCAL_AMFLAGS = -I ../../m4 +## We want to re-distribute the whole original dvi2tty source tree. +## +EXTRA_DIST = $(DVI2TTY_TREE) + +## Patches applied to the original source tree +## +EXTRA_DIST += $(DVI2TTY_TREE)-PATCHES + +# in case of an SVN repository +dist-hook: + rm -rf `find $(distdir) -name .svn` + INCLUDES = $(KPATHSEA_INCLUDES) -AM_CPPFLAGS = -DUNIX -DKPATHSEA +AM_CPPFLAGS = -DKPATHSEA AM_CFLAGS = $(WARNING_CFLAGS) LDADD = $(KPATHSEA_LIBS) @@ -14,26 +26,20 @@ LDADD = $(KPATHSEA_LIBS) bin_PROGRAMS = disdvi dvi2tty disdvi_SOURCES = \ - commands.h \ - disdvi.c + $(DVI2TTY_TREE)/commands.h \ + $(DVI2TTY_TREE)/disdvi.c $(disdvi_OBJECTS): $(KPATHSEA_DEPEND) dvi2tty_SOURCES = \ - commands.h \ - dvi2tty.c \ - dvi2tty.h \ - dvistuff.c + $(DVI2TTY_TREE)/commands.h \ + $(DVI2TTY_TREE)/dvi2tty.c \ + $(DVI2TTY_TREE)/dvi2tty.h \ + $(DVI2TTY_TREE)/dvistuff.c $(dvi2tty_OBJECTS): $(KPATHSEA_DEPEND) -dist_man1_MANS = dvi2tty.1 - -## Not used -## -EXTRA_DIST = \ - DVI.format \ - MANIFEST \ - README.ORG \ - dvi2tty.patch +man1_MANS = \ + $(DVI2TTY_TREE)/disdvi.1 \ + $(DVI2TTY_TREE)/dvi2tty.1 diff --git a/Build/source/texk/dvi2tty/Makefile.in b/Build/source/texk/dvi2tty/Makefile.in index 6548647fd9f..bcb283b3f63 100644 --- a/Build/source/texk/dvi2tty/Makefile.in +++ b/Build/source/texk/dvi2tty/Makefile.in @@ -36,7 +36,7 @@ build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = disdvi$(EXEEXT) dvi2tty$(EXEEXT) subdir = . -DIST_COMMON = README $(am__configure_deps) $(dist_man1_MANS) \ +DIST_COMMON = $(am__configure_deps) \ $(srcdir)/../../build-aux/config.guess \ $(srcdir)/../../build-aux/config.sub \ $(srcdir)/../../build-aux/depcomp \ @@ -116,7 +116,7 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 NROFF = nroff -MANS = $(dist_man1_MANS) +MANS = $(man1_MANS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -149,6 +149,7 @@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ +DVI2TTY_TREE = @DVI2TTY_TREE@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -250,26 +251,24 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 +EXTRA_DIST = $(DVI2TTY_TREE) $(DVI2TTY_TREE)-PATCHES INCLUDES = $(KPATHSEA_INCLUDES) -AM_CPPFLAGS = -DUNIX -DKPATHSEA +AM_CPPFLAGS = -DKPATHSEA AM_CFLAGS = $(WARNING_CFLAGS) LDADD = $(KPATHSEA_LIBS) disdvi_SOURCES = \ - commands.h \ - disdvi.c + $(DVI2TTY_TREE)/commands.h \ + $(DVI2TTY_TREE)/disdvi.c dvi2tty_SOURCES = \ - commands.h \ - dvi2tty.c \ - dvi2tty.h \ - dvistuff.c - -dist_man1_MANS = dvi2tty.1 -EXTRA_DIST = \ - DVI.format \ - MANIFEST \ - README.ORG \ - dvi2tty.patch + $(DVI2TTY_TREE)/commands.h \ + $(DVI2TTY_TREE)/dvi2tty.c \ + $(DVI2TTY_TREE)/dvi2tty.h \ + $(DVI2TTY_TREE)/dvistuff.c + +man1_MANS = \ + $(DVI2TTY_TREE)/disdvi.1 \ + $(DVI2TTY_TREE)/dvi2tty.1 all: c-auto.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -408,6 +407,48 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +disdvi.o: $(DVI2TTY_TREE)/disdvi.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT disdvi.o -MD -MP -MF $(DEPDIR)/disdvi.Tpo -c -o disdvi.o `test -f '$(DVI2TTY_TREE)/disdvi.c' || echo '$(srcdir)/'`$(DVI2TTY_TREE)/disdvi.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/disdvi.Tpo $(DEPDIR)/disdvi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(DVI2TTY_TREE)/disdvi.c' object='disdvi.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o disdvi.o `test -f '$(DVI2TTY_TREE)/disdvi.c' || echo '$(srcdir)/'`$(DVI2TTY_TREE)/disdvi.c + +disdvi.obj: $(DVI2TTY_TREE)/disdvi.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT disdvi.obj -MD -MP -MF $(DEPDIR)/disdvi.Tpo -c -o disdvi.obj `if test -f '$(DVI2TTY_TREE)/disdvi.c'; then $(CYGPATH_W) '$(DVI2TTY_TREE)/disdvi.c'; else $(CYGPATH_W) '$(srcdir)/$(DVI2TTY_TREE)/disdvi.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/disdvi.Tpo $(DEPDIR)/disdvi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(DVI2TTY_TREE)/disdvi.c' object='disdvi.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o disdvi.obj `if test -f '$(DVI2TTY_TREE)/disdvi.c'; then $(CYGPATH_W) '$(DVI2TTY_TREE)/disdvi.c'; else $(CYGPATH_W) '$(srcdir)/$(DVI2TTY_TREE)/disdvi.c'; fi` + +dvi2tty.o: $(DVI2TTY_TREE)/dvi2tty.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvi2tty.o -MD -MP -MF $(DEPDIR)/dvi2tty.Tpo -c -o dvi2tty.o `test -f '$(DVI2TTY_TREE)/dvi2tty.c' || echo '$(srcdir)/'`$(DVI2TTY_TREE)/dvi2tty.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dvi2tty.Tpo $(DEPDIR)/dvi2tty.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(DVI2TTY_TREE)/dvi2tty.c' object='dvi2tty.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvi2tty.o `test -f '$(DVI2TTY_TREE)/dvi2tty.c' || echo '$(srcdir)/'`$(DVI2TTY_TREE)/dvi2tty.c + +dvi2tty.obj: $(DVI2TTY_TREE)/dvi2tty.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvi2tty.obj -MD -MP -MF $(DEPDIR)/dvi2tty.Tpo -c -o dvi2tty.obj `if test -f '$(DVI2TTY_TREE)/dvi2tty.c'; then $(CYGPATH_W) '$(DVI2TTY_TREE)/dvi2tty.c'; else $(CYGPATH_W) '$(srcdir)/$(DVI2TTY_TREE)/dvi2tty.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dvi2tty.Tpo $(DEPDIR)/dvi2tty.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(DVI2TTY_TREE)/dvi2tty.c' object='dvi2tty.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvi2tty.obj `if test -f '$(DVI2TTY_TREE)/dvi2tty.c'; then $(CYGPATH_W) '$(DVI2TTY_TREE)/dvi2tty.c'; else $(CYGPATH_W) '$(srcdir)/$(DVI2TTY_TREE)/dvi2tty.c'; fi` + +dvistuff.o: $(DVI2TTY_TREE)/dvistuff.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvistuff.o -MD -MP -MF $(DEPDIR)/dvistuff.Tpo -c -o dvistuff.o `test -f '$(DVI2TTY_TREE)/dvistuff.c' || echo '$(srcdir)/'`$(DVI2TTY_TREE)/dvistuff.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dvistuff.Tpo $(DEPDIR)/dvistuff.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(DVI2TTY_TREE)/dvistuff.c' object='dvistuff.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvistuff.o `test -f '$(DVI2TTY_TREE)/dvistuff.c' || echo '$(srcdir)/'`$(DVI2TTY_TREE)/dvistuff.c + +dvistuff.obj: $(DVI2TTY_TREE)/dvistuff.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvistuff.obj -MD -MP -MF $(DEPDIR)/dvistuff.Tpo -c -o dvistuff.obj `if test -f '$(DVI2TTY_TREE)/dvistuff.c'; then $(CYGPATH_W) '$(DVI2TTY_TREE)/dvistuff.c'; else $(CYGPATH_W) '$(srcdir)/$(DVI2TTY_TREE)/dvistuff.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dvistuff.Tpo $(DEPDIR)/dvistuff.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(DVI2TTY_TREE)/dvistuff.c' object='dvistuff.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvistuff.obj `if test -f '$(DVI2TTY_TREE)/dvistuff.c'; then $(CYGPATH_W) '$(DVI2TTY_TREE)/dvistuff.c'; else $(CYGPATH_W) '$(srcdir)/$(DVI2TTY_TREE)/dvistuff.c'; fi` + mostlyclean-libtool: -rm -f *.lo @@ -416,10 +457,10 @@ clean-libtool: distclean-libtool: -rm -f libtool config.lt -install-man1: $(dist_man1_MANS) +install-man1: $(man1_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" - @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ + @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ @@ -443,7 +484,7 @@ install-man1: $(dist_man1_MANS) uninstall-man1: @$(NORMAL_UNINSTALL) - @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ + @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ @@ -548,6 +589,9 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ @@ -774,22 +818,26 @@ uninstall-man: uninstall-man1 .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool ctags dist \ - dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-man1 install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-man \ - uninstall-man1 - + dist-all dist-bzip2 dist-gzip dist-hook dist-lzma dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-man1 install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-man uninstall-man1 + + +# in case of an SVN repository +dist-hook: + rm -rf `find $(distdir) -name .svn` $(disdvi_OBJECTS): $(KPATHSEA_DEPEND) diff --git a/Build/source/texk/dvi2tty/README b/Build/source/texk/dvi2tty/README deleted file mode 100644 index 991e82e71e9..00000000000 --- a/Build/source/texk/dvi2tty/README +++ /dev/null @@ -1,53 +0,0 @@ - DVI2TTY - - -dvi2tty is intended for previewing dvi-files on text-only -devices (terminals and lineprinters). -The program is basically 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 (at) mesa dot nl | You can't follow the rules. ------------------------------------------ - Lennon diff --git a/Build/source/texk/dvi2tty/README.ORG b/Build/source/texk/dvi2tty/README.ORG deleted file mode 100644 index 9f8b337b16a..00000000000 --- a/Build/source/texk/dvi2tty/README.ORG +++ /dev/null @@ -1,23 +0,0 @@ - -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 -tex-k@tug.org, since this is a modified version of the original, written -by -Svante Lindahl, NADA, KTH Numerical Analysis & Computer Science - Royal Institute of Technology, Sweden diff --git a/Build/source/texk/dvi2tty/commands.h b/Build/source/texk/dvi2tty/commands.h deleted file mode 100644 index 9624713ea1f..00000000000 --- a/Build/source/texk/dvi2tty/commands.h +++ /dev/null @@ -1,76 +0,0 @@ -/* 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 63 */ -#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 */ - -/* additional DVI commands for XeTeX extensions */ -#define PIC_FILE 251 -#define NAT_FNT 252 /* define a native font */ -#define SET_GL_AR 253 -#define SET_GL_ST 254 - -/* additional DVI command for pTeX extensions */ -#define DVI_DIR 255 /* set direction */ diff --git a/Build/source/texk/dvi2tty/configure b/Build/source/texk/dvi2tty/configure index f39090ca809..80ef74d5903 100755 --- a/Build/source/texk/dvi2tty/configure +++ b/Build/source/texk/dvi2tty/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for dvi2tty for TeX Live 4.0. +# Generated by GNU Autoconf 2.68 for dvi2tty for TeX Live 5.3.1. # # Report bugs to . # @@ -570,12 +570,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dvi2tty for TeX Live' PACKAGE_TARNAME='dvi2tty-for-tex-live' -PACKAGE_VERSION='4.0' -PACKAGE_STRING='dvi2tty for TeX Live 4.0' +PACKAGE_VERSION='5.3.1' +PACKAGE_STRING='dvi2tty for TeX Live 5.3.1' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' -ac_unique_file="dvi2tty.c" +ac_unique_file="dvi2tty-5.3.1/dvi2tty.c" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -616,6 +616,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +DVI2TTY_TREE KPATHSEA_RULE KPATHSEA_DEPEND KPATHSEA_LIBS @@ -1302,7 +1303,7 @@ if test "$ac_init_help" = "long"; then # 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 <<_ACEOF -\`configure' configures dvi2tty for TeX Live 4.0 to adapt to many kinds of systems. +\`configure' configures dvi2tty for TeX Live 5.3.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1373,7 +1374,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dvi2tty for TeX Live 4.0:";; + short | recursive ) echo "Configuration of dvi2tty for TeX Live 5.3.1:";; esac cat <<\_ACEOF @@ -1485,7 +1486,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dvi2tty for TeX Live configure 4.0 +dvi2tty for TeX Live configure 5.3.1 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1965,7 +1966,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dvi2tty for TeX Live $as_me 4.0, which was +It was created by dvi2tty for TeX Live $as_me 5.3.1, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -7318,7 +7319,7 @@ fi # Define the identity of the package. PACKAGE='dvi2tty-for-tex-live' - VERSION='4.0' + VERSION='5.3.1' cat >>confdefs.h <<_ACEOF @@ -12965,7 +12966,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -dvi2tty for TeX Live config.lt 4.0 +dvi2tty for TeX Live config.lt 5.3.1 configured by $0, generated by GNU Autoconf 2.68. Copyright (C) 2010 Free Software Foundation, Inc. @@ -14017,6 +14018,9 @@ if test "x$kpse_cv_kpse_debug" != xyes; then : fi +DVI2TTY_TREE=dvi2tty-5.3.1 + + ac_config_files="$ac_config_files Makefile" @@ -14558,7 +14562,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dvi2tty for TeX Live $as_me 4.0, which was +This file was extended by dvi2tty for TeX Live $as_me 5.3.1, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14624,7 +14628,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dvi2tty for TeX Live config.status 4.0 +dvi2tty for TeX Live config.status 5.3.1 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/dvi2tty/configure.ac b/Build/source/texk/dvi2tty/configure.ac index 3b167b3b081..e40422c1c28 100644 --- a/Build/source/texk/dvi2tty/configure.ac +++ b/Build/source/texk/dvi2tty/configure.ac @@ -1,14 +1,15 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl Copyright (C) 2009 Peter Breitenlohner +dnl Copyright (C) 2009, 2010 Peter Breitenlohner dnl dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl -AC_INIT([dvi2tty for TeX Live], [4.0], [tex-k@tug.org]) +m4_define([dvi2tty_version], [5.3.1])[]dnl using unmodified dvi2tty source tree +AC_INIT([dvi2tty for TeX Live], dvi2tty_version, [tex-k@tug.org]) AC_PREREQ([2.65]) -AC_CONFIG_SRCDIR([dvi2tty.c]) +AC_CONFIG_SRCDIR([dvi2tty-]dvi2tty_version[/dvi2tty.c]) AC_CONFIG_AUX_DIR([../../build-aux]) AC_CONFIG_MACRO_DIR([../../m4]) @@ -19,6 +20,9 @@ AC_CONFIG_HEADERS([c-auto.h:c-auto.in]) KPSE_KPATHSEA_FLAGS +DVI2TTY_TREE=[dvi2tty-]dvi2tty_version +AC_SUBST([DVI2TTY_TREE]) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/Build/source/texk/dvi2tty/disdvi.c b/Build/source/texk/dvi2tty/disdvi.c deleted file mode 100644 index 39032587ca8..00000000000 --- a/Build/source/texk/dvi2tty/disdvi.c +++ /dev/null @@ -1,669 +0,0 @@ -/*****************************************************************************/ -/* */ -/* 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 */ -/* */ -/* */ -/*****************************************************************************/ - - -#if 0 -char *disdvi = "@(#) disdvi.c 2.1 19/01/90 M.J.E. Mol (c) 1989, 1990"; -#endif - -#include -#include -#include "commands.h" - -#if defined(KPATHSEA) -#define NO_DEBUG 1 -#include -#include -#else -#if defined(MSDOS) -#include -#include -#include -#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; - -int is_ptex = 0; -int is_xetex = 0; -const char * dvi_ext = ".dvi"; - -#ifdef KPATHSEA -extern void bop(void); -extern void postamble(void); -extern void preamble(void); -extern void postpostamble(void); -extern void special(int x); -extern void fontdef(int x); -extern const char *fontname(long fntnum); -extern void printnonprint(int ch); -extern unsigned long num(int size); -extern long snum(int size); -extern void picfile(int opcode); -extern void natfontdef(int opcode); -extern void glyphs(int opcode); -extern void dvidir(int opcode); -extern void invalid(int opcode); -#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 (); -void picfile (); -void natfontdef (); -void glyphs (); -void dvidir (); -void invalid (); -#endif - - - -/*---------------------------------------------------------------------------*/ - -int main(int argc, char **argv) -{ - register int opcode; /* dvi opcode */ - register int i; - int fontnum; - char * progname; - - progname = *argv; - - if ((argc > 1) && (argv[1][0] == '-')) { - if (!strcmp(argv[1], "-p") || !strcmp(argv[1], "--ptex")) { - is_ptex = 1; - } else if (!strcmp(argv[1], "-x") || !strcmp(argv[1], "--xetex")) { - is_xetex = 1; - dvi_ext = ".xdv"; - } else { - fprintf(stderr, "Invalid option `%s'\n", argv[1]); - fprintf(stderr, "Usage: %s [-p|--ptex|-x|--xetex] [dvi-file]\n", progname); - exit(3); - } - argv++; - argc--; - } - - if (argc > 2) { - fprintf(stderr, "To many arguments\n"); - fprintf(stderr, "Usage: %s [-p|--ptex|-x|--xetex] [dvi-file]\n", progname); - exit(1); - } - - if (argc == 2) { - if ((i = strlen(argv[1])) == 0) { - fprintf(stderr, "Illegal empty filename\n"); - fprintf(stderr, "Usage: %s [-p|--ptex|-x|--xetex] [dvi-file]\n", progname); - exit(2); - } - if ((i >= 5) && !strcmp(argv[1]+(i-4), dvi_ext)) - dvi_name = argv[1]; - else { - dvi_name = malloc((i+5) * sizeof(char)); - strcpy(dvi_name, argv[1]); - strcat(dvi_name, dvi_ext); - } - 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; - case PIC_FILE : picfile(opcode); break; - case NAT_FNT : natfontdef(opcode); break; - case SET_GL_AR: - case SET_GL_ST: glyphs(opcode); break; - case DVI_DIR : dvidir(opcode); break; - default : invalid(opcode); - } - } - - return 0; -} /* main */ - - -/*----------------------------------------------------------------------------*/ - - -void bop(void) -{ - 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(void) -{ - - 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(void) -{ - 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(void) -{ - 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(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(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 */ - - - -const char * -fontname(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(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(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(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 */ - - - -void picfile(int opcode) -{ - int i; - - if (!is_xetex) { - invalid(opcode); - return; - } - - printf("PIC_FILE flags : %ld\n", get1()); - printf("%06ld: trans :", pc); - for (i=0; i<6; i++) - printf(" %ld", sget4()); - printf("\n%06ld: ", pc); - printf(" page : %ld\n", get2()); - printf("%06ld: ", pc); - i = (int) get1(); - printf(" path name (%3d) :", i); - while (i-- > 0) - putchar((int) get1()); - putchar('\n'); -} /* picfile */ - - - -void natfontdef(int opcode) -{ - register int i; - char * name; - font * fnt; - int flags, namelen, famlen, stylen; - long fntnum; - int new = 0; - - if (!is_xetex) { - invalid(opcode); - return; - } - - fntnum = num(4); - printf("NAT_FNT: %ld\n", fntnum); - printf("%06ld: ", pc); - printf(" scale : %ld\n", get4()); - printf("%06ld: ", pc); - flags = get2(); - printf(" flags : %d\n", flags); - printf("%06ld: ", pc); - printf(" name : "); - namelen = (int) get1(); - famlen = (int) get1(); - stylen = (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); - - if (famlen) { - printf(" family : "); - while (famlen-- > 0) - putchar((int) get1()); - putchar('\n'); - } - - if (stylen) { - printf(" style : "); - while (stylen-- > 0) - putchar((int) get1()); - putchar('\n'); - } -} /* fontdef */ - - - -void glyphs(int opcode) -{ - long width; - int x, n, i, j; - long * xy; - - if (!is_xetex) { - invalid(opcode); - return; - } - - x = SET_GL_ST - opcode + 1; - width = sget4(); - n = get2(); - printf("GLYPH_%s width : %ld\n", x == 2 ? "ARR" : "STR", width); - if ((xy = (long *) malloc(n * x * sizeof(long))) == NULL) { - perror("glyphs"); - exit(1); - } - for (j=0; j < n * x; j++) - xy[j] = sget4(); - for (i=0, j=0; i < n; i++) { - printf(" x: %ld", xy[j++]); - if (x == 2) - printf(" y: %ld", xy[j++]); - printf(" g: %ld\n", get2()); - } -} /* glyphs */ - - - -void dvidir(int opcode) -{ - if (!is_ptex) { - invalid(opcode); - return; - } - - printf("DVI_DIR: %ld\n", get1()); -} /* dvidir */ - - - -void invalid(int opcode) -{ - printf("INVALID %d\n", opcode); -} /* invalid */ diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/TL-Changes b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/TL-Changes new file mode 100644 index 00000000000..6adeeebc1c7 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/TL-Changes @@ -0,0 +1,9 @@ +Changes applied to the dvi2tty-5.3.1 tree as obtained from: + http://www.mesa.nl/pub/dvi2tty/dvi2tty-5.3.1.tar.gz. + +Removed: + dvistuff.c.bak + +Renamed: + test.dvi.org -> test.org.dvi + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-01-texk b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-01-texk new file mode 100644 index 00000000000..4639c2823e4 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-01-texk @@ -0,0 +1,37 @@ +diff -ur dvi2tty-5.3.1.orig/README.ORG dvi2tty-5.3.1/README.ORG +--- dvi2tty-5.3.1.orig/README.ORG 1990-11-14 23:36:08.000000000 +0100 ++++ dvi2tty-5.3.1/README.ORG 2009-06-15 00:59:36.000000000 +0200 +@@ -16,11 +16,8 @@ + 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: +- ++Please report complaints, suggestions, bugs and/or fixes to ++tex-k@tug.org, since this is a modified version of the original, written ++by + 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. ++ Royal Institute of Technology, Sweden +diff -ur dvi2tty-5.3.1.orig/disdvi.1 dvi2tty-5.3.1/disdvi.1 +--- dvi2tty-5.3.1.orig/disdvi.1 1996-03-23 17:07:21.000000000 +0100 ++++ dvi2tty-5.3.1/disdvi.1 2010-10-20 14:21:13.000000000 +0200 +@@ -1,4 +1,4 @@ +-.TH DISDVI Local "4 April 1989" ++.TH DISDVI 1 "20 October 2010" "TeX Live" + .SH NAME + disdvi \- `disassemble' a TeX DVI file + .SH SYNOPSIS +diff -ur dvi2tty-5.3.1.orig/dvi2tty.1 dvi2tty-5.3.1/dvi2tty.1 +--- dvi2tty-5.3.1.orig/dvi2tty.1 1996-03-23 20:45:03.000000000 +0100 ++++ dvi2tty-5.3.1/dvi2tty.1 2010-10-20 14:21:13.000000000 +0200 +@@ -1,4 +1,4 @@ +-.TH DVI2TTY Local "13 November 1990" ++.TH DVI2TTY 1 "20 October 2010" "TeX Live" + .SH NAME + dvi2tty \- preview a TeX DVI\-file on an ordinary ascii terminal + .SH SYNOPSIS diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-02-simple-typos b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-02-simple-typos new file mode 100644 index 00000000000..82863912e0d --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-02-simple-typos @@ -0,0 +1,24 @@ +diff -ur dvi2tty-5.3.1.orig/README dvi2tty-5.3.1/README +--- dvi2tty-5.3.1.orig/README 2003-01-23 04:02:43.000000000 +0100 ++++ dvi2tty-5.3.1/README 2009-06-15 00:59:36.000000000 +0200 +@@ -3,7 +3,7 @@ + + 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 ++The program is basically 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. +diff -ur dvi2tty-5.3.1.orig/commands.h dvi2tty-5.3.1/commands.h +--- dvi2tty-5.3.1.orig/commands.h 2003-01-23 04:00:22.000000000 +0100 ++++ dvi2tty-5.3.1/commands.h 2010-10-19 11:34:16.000000000 +0200 +@@ -65,7 +65,7 @@ + #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 FONT_63 234 /* set current font to 63 */ + #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 */ diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-03-ANSI-C b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-03-ANSI-C new file mode 100644 index 00000000000..1833fad4306 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-03-ANSI-C @@ -0,0 +1,59 @@ +diff -ur dvi2tty-5.3.1.orig/disdvi.c dvi2tty-5.3.1/disdvi.c +--- dvi2tty-5.3.1.orig/disdvi.c 2003-01-23 11:31:00.000000000 +0100 ++++ dvi2tty-5.3.1/disdvi.c 2010-10-21 08:07:43.000000000 +0200 +@@ -113,8 +113,6 @@ + + #if defined(VMS) + main (int argc, char ** argv); +-#else +-void main (int argc, char ** argv); + #endif + void bop (void); + void preamble (void); +@@ -138,7 +136,7 @@ + #if defined(VMS) + main(int argc, char **argv) + #else +-void main(int argc, char **argv) ++int main(int argc, char **argv) + #endif + { + register int opcode; /* dvi opcode */ +diff -ur dvi2tty-5.3.1.orig/dvi2tty.c dvi2tty-5.3.1/dvi2tty.c +--- dvi2tty-5.3.1.orig/dvi2tty.c 2003-01-23 11:28:30.000000000 +0100 ++++ dvi2tty-5.3.1/dvi2tty.c 2010-10-21 08:31:44.000000000 +0200 +@@ -252,7 +252,6 @@ + */ + + #if defined(MSDOS) +-void main (int, char **); + void setoption (char *); + void getargs (void); + void getpages (int, char *); +@@ -265,8 +264,6 @@ + + # if defined(VMS) + main (int argc, char ** argv); +-# else +-void main (int argc, char ** argv); + # endif + void setoption (char * optarg); + void getargs (void); +@@ -288,7 +285,7 @@ + #if defined(VMS) + main(int argc, char **argv) + #else +-void main(int argc, char **argv) ++int main(int argc, char **argv) + #endif + { + +@@ -361,7 +358,7 @@ + * GETARGS -- Process options from command line and from environment. + */ + +-void getargs() ++void getargs(void) + { + char *str, *envp; + bool DVIfound; /* if a dvi filename found */ diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-04-pager b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-04-pager new file mode 100644 index 00000000000..81cb872384f --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-04-pager @@ -0,0 +1,12 @@ +diff -ur dvi2tty-5.3.1.orig/dvi2tty.c dvi2tty-5.3.1/dvi2tty.c +--- dvi2tty-5.3.1.orig/dvi2tty.c 2010-10-21 08:31:44.000000000 +0200 ++++ dvi2tty-5.3.1/dvi2tty.c 2010-10-21 11:15:43.000000000 +0200 +@@ -180,7 +180,7 @@ + /* 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 "/usr/bin/pg" /* CHANGE TO YOUR LOCAL PAGER */ ++#define DEFPAGER "more" /* CHANGE TO YOUR LOCAL PAGER */ + + /*------------------ end of customization constants ---------------------*/ + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-05-getline b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-05-getline new file mode 100644 index 00000000000..29cf25e2d9e --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-05-getline @@ -0,0 +1,78 @@ + Apparently POSIX 2008 has getline and glibc 2.9.90 exports it. + Rename our getline to something that a standard won't usurp. + +diff -ur dvi2tty-5.3.1.orig/dvistuff.c dvi2tty-5.3.1/dvistuff.c +--- dvi2tty-5.3.1.orig/dvistuff.c 2003-01-23 04:01:12.000000000 +0100 ++++ dvi2tty-5.3.1/dvistuff.c 2010-10-22 11:03:32.000000000 +0200 +@@ -179,7 +181,7 @@ + void ruleaux (long, long, char); + long horizontalmove (long); + int skipnops (void); +-linetype * getline (void); ++linetype * texlive_getline (void); + linetype * findline (void); + unsigned long num (int); + long snum (int); +@@ -208,7 +210,7 @@ + void ruleaux (long rulewt, long ruleht, char ch); + long horizontalmove (long amount); + int skipnops (void); +-linetype * getline (void); ++linetype * texlive_getline (void); + linetype * findline (void); + unsigned long num (int size); + long snum (int size); +@@ -376,7 +376,7 @@ + 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 = texlive_getline(); /* initialize list of lines */ + currentline->vv = 0L; + firstline = currentline; + lastline = currentline; +@@ -777,7 +777,7 @@ + * GETLINE -- Returns an initialized line-object + */ + +-linetype *getline(void) ++linetype *texlive_getline(void) + { + register int i; + register linetype *temp; +@@ -793,7 +793,7 @@ + + return temp; + +-} /* getline */ ++} /* texlive_getline */ + + + +@@ -809,7 +809,7 @@ + + if (v <= firstline->vv) { /* above first line */ + if (firstline->vv - v > lineheight) { +- temp = getline(); ++ temp = texlive_getline(); + temp->next = firstline; + firstline->prev = temp; + temp->vv = v; +@@ -820,7 +820,7 @@ + + if (v >= lastline->vv) { /* below last line */ + if (v - lastline->vv > lineheight) { +- temp = getline(); ++ temp = texlive_getline(); + temp->prev = lastline; + lastline->next = temp; + temp->vv = v; +@@ -843,7 +843,7 @@ + return temp->next; + + /* no line fits suitable, generate a new one */ +- currentline = getline(); ++ currentline = texlive_getline(); + currentline->next = temp->next; + currentline->prev = temp; + temp->next->prev = currentline; diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-06-bug-fix b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-06-bug-fix new file mode 100644 index 00000000000..927f20ac1b3 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-06-bug-fix @@ -0,0 +1,22 @@ +diff -ur dvi2tty-5.3.1.orig/dvistuff.c dvi2tty-5.3.1/dvistuff.c +--- dvi2tty-5.3.1.orig/dvistuff.c 2010-10-22 11:03:32.000000000 +0200 ++++ dvi2tty-5.3.1/dvistuff.c 2010-10-22 13:45:27.000000000 +0200 +@@ -596,7 +596,8 @@ + currentline = currentline->next) { + if (currentline != firstline) { + foo = ((currentline->vv - currentline->prev->vv)/lineheight)-1; +- foo &= 3; /* linespacings not too large */ ++ if (foo > 3) ++ foo = 3; /* linespacings not too large */ + for (i = 1; i <= (int) foo; i++) + putc('\n', output); + } +@@ -1246,7 +1245,7 @@ + + for (i = 0; i < namelen; i++) + name[i] = get1(); +- name[i] = '\0'; /* just to be sure */ ++ name[i] = '\0'; /* required */ + fnt->name = name; + if (new) { + fnt->next = fonts; diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-50-kpathsea b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-50-kpathsea new file mode 100644 index 00000000000..9ca1eb8f22b --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-50-kpathsea @@ -0,0 +1,116 @@ +diff -ur dvi2tty-5.3.1.orig/disdvi.c dvi2tty-5.3.1/disdvi.c +--- dvi2tty-5.3.1.orig/disdvi.c 2010-10-21 08:07:43.000000000 +0200 ++++ dvi2tty-5.3.1/disdvi.c 2010-10-22 09:08:02.000000000 +0200 +@@ -60,6 +60,11 @@ + # include "macintosh.h" + #endif + ++#if defined(KPATHSEA) ++#define NO_DEBUG 1 ++#include ++#include ++#endif + + + /* +@@ -181,7 +150,7 @@ + else + dvifp = stdin; + +-#if defined(MSDOS) ++#if defined(MSDOS) || defined(WIN32) + setmode(fileno(dvifp), O_BINARY); + #endif + +diff -ur dvi2tty-5.3.1.orig/dvi2tty.c dvi2tty-5.3.1/dvi2tty.c +--- dvi2tty-5.3.1.orig/dvi2tty.c 2010-10-21 11:15:43.000000000 +0200 ++++ dvi2tty-5.3.1/dvi2tty.c 2010-10-22 14:10:28.000000000 +0200 +@@ -301,7 +301,7 @@ + #if defined(THINK_C) + if (inputfromfile) { + #endif +-#if defined(MSDOS) ++#if defined(MSDOS) || defined(WIN32) + if ((DVIfile = fopen(DVIfilename, "rb")) == NULL) + #else + # if defined(VMS) +@@ -648,6 +648,48 @@ + } /* 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 ++ ++static char * ++readable_file(char *name) ++{ ++ char *ret; ++ ++#ifdef WIN32 ++ unsigned int fa; ++ ++ fa = GetFileAttributes(name); ++ if (fa == 0xFFFFFFFF) { ++ ret = NULL; ++ } ++ else if ((fa & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) { ++ ret = NULL; ++ } ++ else { ++ ret = name; ++ } ++#else /* ! WIN32 */ ++ struct stat st; ++ ++ if (READABLE (name, st)) { ++ ret = name; ++ ++ } else { /* Some other error. */ ++ ret = NULL; ++ } ++#endif ++ return ret; ++ ++} ++#endif + + /* + * GETFNAME -- {Make sure we have a .dvi filename. +@@ -661,7 +704,11 @@ + if (i == 0) + usage(ign); + strcpy(DVIfilename, str); ++#ifdef KPATHSEA ++ if (!readable_file(DVIfilename)) ++#else + if ((i < 5) || strcmp(str+i-4, ".dvi")) ++#endif + strcat(DVIfilename, ".dvi"); + + return; +diff -ur dvi2tty-5.3.1.orig/dvi2tty.h dvi2tty-5.3.1/dvi2tty.h +--- dvi2tty-5.3.1.orig/dvi2tty.h 2003-01-23 04:01:04.000000000 +0100 ++++ dvi2tty-5.3.1/dvi2tty.h 2010-10-22 15:08:40.000000000 +0200 +@@ -32,8 +32,15 @@ + # endif + #endif + ++#if defined(KPATHSEA) ++#define NO_DEBUG 1 ++#include ++#include ++#include ++#else + #define TRUE 1 + #define FALSE 0 ++#endif + #define nil NULL + + /* diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-60-warnings b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-60-warnings new file mode 100644 index 00000000000..d090508a274 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-60-warnings @@ -0,0 +1,236 @@ +diff -ur dvi2tty-5.3.1.orig/disdvi.c dvi2tty-5.3.1/disdvi.c +--- dvi2tty-5.3.1.orig/disdvi.c 2010-10-22 09:08:02.000000000 +0200 ++++ dvi2tty-5.3.1/disdvi.c 2010-10-22 09:15:58.000000000 +0200 +@@ -124,7 +124,7 @@ + void postamble (void); + void postpostamble (void); + void fontdef (int x); +-char * fontname (unsigned long fntnum); ++const char * fontname (unsigned long fntnum); + void special (int x); + void printnonprint (int ch); + unsigned long num (int size); +@@ -493,7 +493,7 @@ + * FONTNAME -- Return font name. + */ + +-char * fontname(unsigned long fntnum) ++const char * fontname(unsigned long fntnum) + { + font * fnt; + +diff -ur dvi2tty-5.3.1.orig/dvi2tty.c dvi2tty-5.3.1/dvi2tty.c +--- dvi2tty-5.3.1.orig/dvi2tty.c 2010-10-22 14:10:28.000000000 +0200 ++++ dvi2tty-5.3.1/dvi2tty.c 2010-10-22 14:15:38.000000000 +0200 +@@ -236,13 +236,13 @@ + long foo; /* utility variable, "register" */ + #if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) && !defined(AMIGA) + bool pager; /* tells if output is piped to a pager */ +-char * path; /* name of the pager to run */ ++const char * path; /* name of the pager to run */ + #endif + char * progname; /* our name */ + int Argc; + char ** Argv; + char DVIfilename[MAXLEN]; +-char * OUTfilename; ++const char * OUTfilename; + char optch; /* for option handling */ + + +@@ -252,26 +252,26 @@ + */ + + #if defined(MSDOS) +-void setoption (char *); ++void setoption (const char *); + void getargs (void); +-void getpages (int, char *); ++void getpages (int, const char *); + void plcnxt (int); +-void getfname (char *); +-int getinteger(int *, int *, char *); +-int getlong (long *, int *, char *); ++void getfname (const char *); ++int getinteger(int *, int *, const char *); ++int getlong (long *, int *, const char *); + void usage (int); + #else + + # if defined(VMS) + main (int argc, char ** argv); + # endif +-void setoption (char * optarg); ++void setoption (const char * optarg); + void getargs (void); +-void getpages (int j, char * str); ++void getpages (int j, const char * str); + void plcnxt (int pagnr); +-void getfname (char * str); +-int getinteger(int * dest, int * j, char * str); +-int getlong (long * dest, int * j, char * str); ++void getfname (const char * str); ++int getinteger(int * dest, int * j, const char * str); ++int getlong (long * dest, int * j, const char * str); + void usage (int uerr); + #endif + +@@ -360,7 +360,8 @@ + + void getargs(void) + { +- char *str, *envp; ++ const char *str; ++ char *envp; + bool DVIfound; /* if a dvi filename found */ + + #if !defined(THINK_C) +@@ -494,7 +495,7 @@ + * SETOPTION -- Process an option. + */ + +-void setoption(char *optarg) ++void setoption(const char *optarg) + { + int j = 0; + +@@ -571,7 +572,7 @@ + * GETPAGES -- Getr a list of pages to print. + */ + +-void getpages(int j, char *str) ++void getpages(int j, const char *str) + { + int i, c; + int num; +@@ -695,7 +696,7 @@ + * GETFNAME -- {Make sure we have a .dvi filename. + */ + +-void getfname(char *str) ++void getfname(const char *str) + { + int i; + +@@ -722,7 +723,7 @@ + * call for it. + */ + +-int getinteger(int *dest, int *j, char *str) ++int getinteger(int *dest, int *j, const char *str) + { + int cum; + int sgn; +@@ -758,7 +759,7 @@ + * call for it. + */ + +-int getlong(long *dest, int *j, char *str) ++int getlong(long *dest, int *j, const char *str) + { + long cum; + int sgn; +diff -ur dvi2tty-5.3.1.orig/dvistuff.c dvi2tty-5.3.1/dvistuff.c +--- dvi2tty-5.3.1.orig/dvistuff.c 2010-10-22 13:45:27.000000000 +0200 ++++ dvi2tty-5.3.1/dvistuff.c 2010-10-22 14:07:21.391142887 +0200 +@@ -93,7 +93,9 @@ + * Structure and variable definitions + */ + ++#if 0 + char *dvistuff = "@(#) dvistuff.c 5.12 27may1996 M.J.E. Mol (c) 1989-1996"; ++#endif + + typedef struct { + long hh; +@@ -186,7 +188,7 @@ + void dochar (char); + void symchar (char); + void normchar (char); +-void outchar (char); ++void outchar (unsigned char); + void putcharacter (long); + void setchar (long); + void fontdef (int); +@@ -215,7 +217,7 @@ + void dochar (char ch); + void symchar (char ch); + void normchar (char ch); +-void outchar (char ch); ++void outchar (unsigned char ch); + void putcharacter (long charnr); + void setchar (long charnr); + void fontdef (int x); +@@ -382,18 +384,20 @@ + lastline = currentline; + firstcolumn = rightmargin; + if (pageswitchon) { +- if ((sequenceon ? pagecounter : pagenr) != firstpage->pag) ++ if ((sequenceon ? pagecounter : pagenr) != firstpage->pag) { + if (noffd) + fprintf(output, "^L\n"); + else + putc(FORM, output); ++ } + } + else +- if (backpointer != -1) /* not FORM at first page */ ++ if (backpointer != -1) { /* not FORM at first page */ + if (noffd) + fprintf(output, "^L\n"); + else + putc(FORM, output); ++ } + + return; + +@@ -588,7 +592,7 @@ + void printpage(void) + { + register int i, j; +- register char ch; ++ register unsigned char ch; + + if (sptr != 0) + fprintf(stderr, "dvi2tty: warning - stack not empty at eop.\n"); +@@ -667,7 +671,7 @@ + { + + register char ch; /* character to set rule with */ +- register long saveh, savev; ++ register long saveh = 0, savev; + /* rule -- starts up the recursive routine */ + if (!moving) + saveh = h; +@@ -837,11 +841,12 @@ + /* temp->vv < v < temp->next->vv --- temp is above, temp->next is below */ + topd = v - temp->vv; + botd = temp->next->vv - v; +- if ((topd < lineheight) || (botd < lineheight)) ++ if ((topd < lineheight) || (botd < lineheight)) { + if (topd < botd) /* take best fit */ + return temp; + else + return temp->next; ++ } + + /* no line fits suitable, generate a new one */ + currentline = texlive_getline(); +@@ -1071,7 +1076,7 @@ + * SHOULD BE MOVED OUT. + */ + +-void outchar(char ch) ++void outchar(unsigned char ch) + { + register int i, j; + +@@ -1201,7 +1206,7 @@ + void setchar(long charnr) + { + +- outchar(allchar ? charnr : '#'); ++ outchar(allchar ? (unsigned char)charnr : '#'); + + return; + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-70-disdvi-xetex b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-70-disdvi-xetex new file mode 100644 index 00000000000..626051ec381 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-70-disdvi-xetex @@ -0,0 +1,298 @@ +diff -ur dvi2tty-5.3.1.orig/commands.h dvi2tty-5.3.1/commands.h +--- dvi2tty-5.3.1.orig/commands.h 2010-10-19 11:34:16.000000000 +0200 ++++ dvi2tty-5.3.1/commands.h 2010-10-20 11:34:16.000000000 +0200 +@@ -85,3 +85,12 @@ + #define TRAILER 223 /* trailer bytes in dvi file */ + + /* undefined_commands 250,251,252,253,254,255 */ ++ ++/* additional DVI commands for XeTeX extensions */ ++#define PIC_FILE 251 ++#define NAT_FNT 252 /* define a native font */ ++#define SET_GL_AR 253 ++#define SET_GL_ST 254 ++ ++/* additional DVI command for pTeX extensions */ ++#define DVI_DIR 255 /* set direction */ +diff -ur dvi2tty-5.3.1.orig/disdvi.1 dvi2tty-5.3.1/disdvi.1 +--- dvi2tty-5.3.1.orig/disdvi.1 2010-10-20 14:21:13.000000000 +0200 ++++ dvi2tty-5.3.1/disdvi.1 2010-10-23 13:10:17.000000000 +0200 +@@ -1,17 +1,25 @@ +-.TH DISDVI 1 "20 October 2010" "TeX Live" ++.TH DISDVI 1 "23 October 2010" "TeX Live" + .SH NAME +-disdvi \- `disassemble' a TeX DVI file ++disdvi \- `disassemble' a (p)TeX DVI or XeTeX XDV file + .SH SYNOPSIS + .B disdvi +-dvi\-file ++.RB [ \-p ] ++.RI [ dvi_file [ \fB.dvi\fP ]] ++.br ++.B disdvi \-x ++.RI [ xdv_file [ \fB.xdv\fP ]] ++.br ++.B disdvi \-h + .SH DESCRIPTION + .I disdvi + interprets the contents of +-.IR dvi\-file , ++.IR dvi_file ++or ++.IR xdv_file , + printing the DVI commands and text in a human-readable ASCII format on + the standard output. + .SH "SEE ALSO" +-dvi2tty(SIPB) ++.BR dvi2tty (1) + .SH AUTHOR + Marcel J.E. Mol, Delft University of Technology, The Netherlands + .br +diff -ur dvi2tty-5.3.1.orig/disdvi.c dvi2tty-5.3.1/disdvi.c +--- dvi2tty-5.3.1.orig/disdvi.c 2010-10-22 09:15:58.000000000 +0200 ++++ dvi2tty-5.3.1/disdvi.c 2010-10-22 09:17:28.000000000 +0200 +@@ -107,6 +107,9 @@ + + char * progname; + ++int is_ptex = 0; ++int is_xetex = 0; ++const char * dvi_ext = ".dvi"; + + /* + * Function declarations +@@ -130,6 +133,11 @@ + unsigned long num (int size); + long snum (int size); + void usage (void); ++void picfile (int opcode); ++void natfontdef (int opcode); ++void glyphs (int opcode); ++void dvidir (int opcode); ++void invalid (int opcode); + + + +@@ -155,6 +163,25 @@ + + progname = *argv++; + ++ if ((argc > 1) && (*argv[0] == '-')) { ++ if (!strcmp(*argv, "-h")) { ++ usage(); ++ exit(0); ++ } ++ if (!strcmp(*argv, "-p")) ++ is_ptex = 1; ++ else if (!strcmp(*argv, "-x")) { ++ is_xetex = 1; ++ dvi_ext = ".xdv"; ++ } else { ++ fprintf(stderr, "Invalid option `%s'\n", *argv); ++ usage(); ++ exit(3); ++ } ++ argv++; ++ argc--; ++ } ++ + if (argc > 2) { + fprintf(stderr, "To many arguments\n"); + usage(); +@@ -162,21 +189,17 @@ + } + + if (argc == 2) { +- if (!strcmp(*argv, "-h")) { +- usage(); +- exit(0); +- } + if ((i = strlen(*argv)) == 0) { + fprintf(stderr, "Illegal empty filename\n"); + usage(); + exit(2); + } +- if ((i >= 5) && (!strcmp(*argv+i-4, ".dvi"))) ++ if ((i >= 5) && (!strcmp(*argv+i-4, dvi_ext))) + dvi_name = *argv; + else { + dvi_name = malloc((i+5) * sizeof(char)); + strcpy(dvi_name, *argv); +- strcat(dvi_name, ".dvi"); ++ strcat(dvi_name, dvi_ext); + } + if ((dvifp = fopen(dvi_name, "r")) == NULL) { + perror(dvi_name); +@@ -293,6 +316,12 @@ + case PRE : preamble(); break; + case POST : postamble(); break; + case POST_POST: postpostamble(); break; ++ case PIC_FILE : picfile(opcode); break; ++ case NAT_FNT : natfontdef(opcode); break; ++ case SET_GL_AR: ++ case SET_GL_ST: glyphs(opcode); break; ++ case DVI_DIR : dvidir(opcode); break; ++ default : invalid(opcode); + } + } + +@@ -616,9 +645,157 @@ + { + + fprintf(stderr, "\n%s\n\n", disdvi); +- fprintf(stderr, " disassembles TeX dvi files\n"); +- fprintf(stderr, "Usage: %s [-h | [.dvi]]\n", progname); ++ fprintf(stderr, " disassembles (p)TeX dvi and XeTeX xdv files\n"); ++ fprintf(stderr, "Usage: %s [-h | [-p] [dvi_file[.dvi]]\n", progname); ++ fprintf(stderr, " | -x [xdv_file[.xdv]]]\n"); + + return; + + } /* usage */ ++ ++ ++ ++void picfile(int opcode) ++{ ++ int i; ++ ++ if (!is_xetex) { ++ invalid(opcode); ++ return; ++ } ++ ++ printf("PIC_FILE flags : %ld\n", get1()); ++ printf("%06ld: trans :", pc); ++ for (i=0; i<6; i++) ++ printf(" %ld", sget4()); ++ printf("\n%06ld: ", pc); ++ printf(" page : %ld\n", get2()); ++ printf("%06ld: ", pc); ++ i = (int) get1(); ++ printf(" path name (%3d) :", i); ++ while (i-- > 0) ++ putchar((int) get1()); ++ putchar('\n'); ++} /* picfile */ ++ ++ ++ ++void natfontdef(int opcode) ++{ ++ register int i; ++ char * name; ++ font * fnt; ++ int flags, namelen, famlen, stylen; ++ long fntnum; ++ int new = 0; ++ ++ if (!is_xetex) { ++ invalid(opcode); ++ return; ++ } ++ ++ fntnum = num(4); ++ printf("NAT_FNT: %ld\n", fntnum); ++ printf("%06ld: ", pc); ++ printf(" scale : %ld\n", get4()); ++ printf("%06ld: ", pc); ++ flags = get2(); ++ printf(" flags : %d\n", flags); ++ printf("%06ld: ", pc); ++ printf(" name : "); ++ namelen = (int) get1(); ++ famlen = (int) get1(); ++ stylen = (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); ++ ++ if (famlen) { ++ printf(" family : "); ++ while (famlen-- > 0) ++ putchar((int) get1()); ++ putchar('\n'); ++ } ++ ++ if (stylen) { ++ printf(" style : "); ++ while (stylen-- > 0) ++ putchar((int) get1()); ++ putchar('\n'); ++ } ++} /* fontdef */ ++ ++ ++ ++void glyphs(int opcode) ++{ ++ long width; ++ int x, n, i, j; ++ long * xy; ++ ++ if (!is_xetex) { ++ invalid(opcode); ++ return; ++ } ++ ++ x = SET_GL_ST - opcode + 1; ++ width = sget4(); ++ n = get2(); ++ printf("GLYPH_%s width : %ld\n", x == 2 ? "ARR" : "STR", width); ++ if ((xy = (long *) malloc(n * x * sizeof(long))) == NULL) { ++ perror("glyphs"); ++ exit(1); ++ } ++ for (j=0; j < n * x; j++) ++ xy[j] = sget4(); ++ for (i=0, j=0; i < n; i++) { ++ printf(" x: %ld", xy[j++]); ++ if (x == 2) ++ printf(" y: %ld", xy[j++]); ++ printf(" g: %ld\n", get2()); ++ } ++} /* glyphs */ ++ ++ ++ ++void dvidir(int opcode) ++{ ++ if (!is_ptex) { ++ invalid(opcode); ++ return; ++ } ++ ++ printf("DVI_DIR: %ld\n", get1()); ++} /* dvidir */ ++ ++ ++ ++void invalid(int opcode) ++{ ++ printf("INVALID %d\n", opcode); ++} /* invalid */ diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-80-maybe-bug-fix b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-80-maybe-bug-fix new file mode 100644 index 00000000000..dc76051abdf --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-80-maybe-bug-fix @@ -0,0 +1,13 @@ +diff -ur dvi2tty-5.3.1.orig/dvistuff.c dvi2tty-5.3.1/dvistuff.c +--- dvi2tty-5.3.1.orig/dvistuff.c 2010-10-22 14:07:21.000000000 +0200 ++++ dvi2tty-5.3.1/dvistuff.c 2010-10-22 14:58:46.000000000 +0200 +@@ -1165,8 +1165,8 @@ + currentline->charactercount = j; + if (j < firstcolumn) + firstcolumn = j; ++ h += charwidth; + } +- h += charwidth; + + return; + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-81-maybe-scand b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-81-maybe-scand new file mode 100644 index 00000000000..39a1c07f4ae --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-81-maybe-scand @@ -0,0 +1,61 @@ +diff -ur dvi2tty-5.3.1.orig/dvistuff.c dvi2tty-5.3.1/dvistuff.c +--- dvi2tty-5.3.1.orig/dvistuff.c 2010-10-22 14:58:46.000000000 +0200 ++++ dvi2tty-5.3.1/dvistuff.c 2010-10-23 19:03:03.000000000 +0200 +@@ -1104,18 +1104,18 @@ + * This code does not really belong here ... + * + *-------------------------------------------------------------* +- * The following is very specialized code, it handles national * +- * Swe/Fin characters. They are respectively: a and o with two * +- * dots ("a & "o) and a with a circle (Oa). In Swe/Fin "ASCII" * +- * these characters replace {}|[] and \. TeX outputs these by * ++ * 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 or o. When dvi2tty finds an a or o it searches in the * +- * near vicinity for the character codes that represent circle * +- * or dots and if one is found the corresponding national char * +- * replaces the special character codes. * ++ * 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 (!allchar && scascii) { +- if ((ch == 'a') || (ch == 'A') || (ch == 'o') || (ch == 'O')) { ++ 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++) +@@ -1129,18 +1129,22 @@ + case 127 : + case 34 : /* DEL or " */ + if (ch == 'a') +- ch = '{'; /* } vi */ ++ ch = 0xe4; + else if (ch == 'A') /* dots ... */ +- ch = '['; ++ ch = 0xc4; + else if (ch == 'o') +- ch = '|'; ++ ch = 0xf6; + else if (ch == 'O') +- ch = '\\'; ++ ch = 0xd6; ++ else if (ch == 'u') ++ ch = 0xfc; ++ else if (ch == 'U') ++ ch = 0xdc; + break; + case 23 : if (ch == 'a') +- ch = /* { vi */ '}'; ++ ch = 0xe5; + else if (ch == 'A') /* circle */ +- ch = ']'; ++ ch = 0xc5; + break; + } + } diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-90-undo-some b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-90-undo-some new file mode 100644 index 00000000000..61d5d06ba2e --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-90-undo-some @@ -0,0 +1,1668 @@ +diff -ur dvi2tty-5.3.1.orig/disdvi.c dvi2tty-5.3.1/disdvi.c +--- dvi2tty-5.3.1.orig/disdvi.c 2010-10-22 09:17:28.000000000 +0200 ++++ dvi2tty-5.3.1/disdvi.c 2010-10-24 14:03:20.000000000 +0200 +@@ -154,7 +154,7 @@ + { + register int opcode; /* dvi opcode */ + register int i; +- unsigned long fontnum; ++ int fontnum; + + #if defined(THINK_C) + argc = process_disdvi_command_line(&argv); +@@ -229,7 +229,7 @@ + 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((unsigned long) opcode - FONT_00)); ++ fontname(opcode - FONT_00)); + else + switch (opcode) { + case SET1 : +@@ -301,7 +301,7 @@ + case FNT2 : + case FNT3 : + case FNT4 : fontnum = num(opcode -FNT1 + 1); +- printf("FNT%d: %ld /* %s */\n", ++ printf("FNT%d: %d /* %s */\n", + opcode - FNT1 + 1, fontnum, + fontname(fontnum)); + break; +@@ -469,7 +469,7 @@ + char * name; + font * fnt; + int namelen; +- unsigned long fntnum; ++ long fntnum; + int new = 0; + + fntnum = num(x); +@@ -522,7 +522,7 @@ + * FONTNAME -- Return font name. + */ + +-const char * fontname(unsigned long fntnum) ++const char * fontname(long fntnum) + { + font * fnt; + +diff -ur dvi2tty-5.3.1.orig/dvi2tty.c dvi2tty-5.3.1/dvi2tty.c +--- dvi2tty-5.3.1.orig/dvi2tty.c 2010-10-22 14:15:38.000000000 +0200 ++++ dvi2tty-5.3.1/dvi2tty.c 2010-10-24 14:28:11.424244541 +0200 +@@ -180,17 +180,17 @@ + /* 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 */ ++#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) || defined(AMIGA) +-#define OPTSET "haJwepPousltvbc" /* legal options */ +-#define OPTWARG "wepPovb" /* options with argument */ ++#if defined(MSDOS) || defined(VMS) ++#define OPTSET "wepPousl" /* legal options */ ++#define OPTWARG "wepPo" /* options with argument */ + #else +-#define OPTSET "haJwepPousqlfFtvbc"/* legal options */ +-#define OPTWARG "wepPoFvb" /* options with argument */ ++#define OPTSET "wepPousqlfF"/* legal options */ ++#define OPTWARG "wepPoF" /* options with argument */ + #endif + + /* +@@ -206,19 +206,12 @@ + #define bdopt 7 /* bad option */ + #define onepp 8 /* only one page list allowed */ + #define noarg 9 /* argument expected */ +-#if defined(THINK_C) +-#define nored 10 /* if no input file, redirect stdin */ +-#endif +- + ++#if 0 ++char *dvi2tty = "@(#) dvi2tty.c 4.1 27/03/90 M.J.E. Mol (c) 1989, 1990"; ++#endif + +-/* +- * Variable definitions +- */ +- +-char *dvi2tty = "@(#) dvi2tty.c 5.12 27may1996 M.J.E. Mol (c) 1989-1996"; +-#define VERSION 5.2 +- ++/*---------------------------------------------------------------------------*/ + + printlisttype * currentpage; /* current page to print */ + printlisttype * firstpage; /* first page selected */ +@@ -227,14 +220,11 @@ + FILE * DVIfile; + FILE * output; + bool outputtofile; /* tells if output goes to file or stdout */ +-#if defined(THINK_C) +-bool inputfromfile; /* tells if input comes from file or stdin */ +-#endif + 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) && !defined(THINK_C) && !defined(AMIGA) ++#if !defined(MSDOS) && !defined(VMS) + bool pager; /* tells if output is piped to a pager */ + const char * path; /* name of the pager to run */ + #endif +@@ -245,94 +235,67 @@ + const char * OUTfilename; + char optch; /* for option handling */ + ++/*---------------------------------------------------------------------------*/ + +- +-/* +- * Function declarations +- */ +- +-#if defined(MSDOS) +-void setoption (const char *); +-void getargs (void); +-void getpages (int, const char *); +-void plcnxt (int); +-void getfname (const char *); +-int getinteger(int *, int *, const char *); +-int getlong (long *, int *, const char *); +-void usage (int); ++#if defined(KPATHSEA) || defined(MSDOS) ++int main (int, char **); ++void setoption (const char *); ++void getargs (void); ++void getpages (int, const char *); ++void plcnxt (int); ++void getfname (const char *); ++int getinteger (int *, int *, const char *); ++void usage (int); + #else ++char * getenv (); ++FILE * popen (); + +-# if defined(VMS) +- main (int argc, char ** argv); +-# endif +-void setoption (const char * optarg); +-void getargs (void); +-void getpages (int j, const char * str); +-void plcnxt (int pagnr); +-void getfname (const char * str); +-int getinteger(int * dest, int * j, const char * str); +-int getlong (long * dest, int * j, const char * str); +-void usage (int uerr); ++int main (); ++void setoption (); ++void getargs (); ++void getpages (); ++void plcnxt (); ++void getfname (); ++int getinteger(); ++void usage (); + #endif + +- + /****************************************************************************/ + /* */ + /* M A I N */ + /* */ + /****************************************************************************/ + +-#if defined(VMS) +-main(int argc, char **argv) +-#else + int main(int argc, char **argv) +-#endif + { + +-#if defined(THINK_C) +- argc = process_dvi_command_line(&argv); +-#endif +- + progname = *argv; + Argc = argc; + Argv = argv; + + getargs(); /* read command line arguments */ +-#if defined(THINK_C) +- if (inputfromfile) { +-#endif +-#if defined(MSDOS) || defined(WIN32) +- if ((DVIfile = fopen(DVIfilename, "rb")) == NULL) ++#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 ++#if defined(VMS) ++ if ((DVIfile = fopen(DVIfilename, "r","ctx=rec")) == NULL) ++#else ++ if ((DVIfile = fopen(DVIfilename, "r")) == NULL) + #endif +- errorexit(filop); /* can't open dvifile */ +-#if defined(THINK_C) +- } +- else +- DVIfile = stdin; + #endif ++ errorexit(filop); /* can't open dvifile */ + + if (outputtofile) { /* open the outfile, if needed */ + if ((output = fopen(OUTfilename, "w")) == NULL) + errorexit(filcr); +-#if defined(THINK_C) +- else +- set_creator((unsigned char*) OUTfilename); +-#endif +- +-#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) ++#if !defined(MSDOS) && !defined(VMS) + pager = FALSE; + #endif + } + else { + output = stdout; +-#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) +- if (pager && isatty(fileno(output))) { /* try to pipe to a pager */ ++#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 */ + } +@@ -343,20 +306,79 @@ + + dvimain(); + +-#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) ++#if !defined(MSDOS) && !defined(VMS) + if (pager) + pclose(output); /* close pipe to pager */ + #endif + +- exit(0); ++ return 0; + + } /* main */ + ++/*----------------------------------------------------------------------------*/ + ++void setoption(const 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 */ + +-/* +- * GETARGS -- Process options from command line and from environment. +- */ ++/*----------------------------------------------------------------------------*/ + + void getargs(void) + { +@@ -364,67 +386,33 @@ + char *envp; + bool DVIfound; /* if a dvi filename found */ + +-#if !defined(THINK_C) + if (Argc <= 1) + usage(ign); +-#endif + + pageswitchon = FALSE; /* show all pages */ + sequenceon = FALSE; /* selected pages are TeX-numbered */ + outputtofile = FALSE; /* write to stdout */ +-#if defined(THINK_C) +- inputfromfile = FALSE; /* read from stdin */ +-#endif +-#if !defined(MSDOS) && !defined(VMS) && !defined (THINK_C) && !defined(AMIGA) ++#if !defined(MSDOS) && !defined(VMS) + pager = WANTPAGER; /* want paging, compile time option */ + #endif +- accent = TRUE; /* show all accent etc. as extra char */ +- ttfont = FALSE; /* assume tt font (verbatim mode) */ + 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; +- printfont = FALSE; /* do not print font switches */ +- allchar = FALSE; /* do not put out all characters */ + +-#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) && !defined(AMIGA) ++#if !defined(MSDOS) && !defined(VMS) + if ((path = getenv("PAGER")) == NULL) /* find default pathname of page */ + path = DEFPAGER; /* program in case paging is wanted */ + #endif + +- /* +- * +- * With VAX-C under VMS getenv normally searches the environment array +- * looking for the variables HOME, TERM, PATH, and USER. In certain +- * situations getenv attempts to first perform a logical name translation +- * if none of the environment array strings are matched and then trying +- * to translate a CLI symbol. Unfortunately we need a CLI symbol defined +- * as; +- * +- * dvi2tty :== $path:dvi2tty.exe +- * +- * to invoke dvi2tty with command line arguments as it would be invoked +- * under Unix. So we use the logical DVI$DVI2TYY as the environment +- * variable from which options may be set. +- * +- */ +- +- /* +- * First process environment variable. +- */ +- +-#if defined(VMS) +- if ((envp = getenv("DVI$DVI2TTY")) != NULL) { +-#else +- if ((envp = getenv("DVI2TTY")) != NULL) { /* } keep vi happy */ +-#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 ourselfes, ++ * we always pass one option, and arrange for optarg ourselfves, + * so setoption does not mesh up Argv + */ + if (strchr(OPTWARG, optch) != NULL) { +@@ -449,19 +437,12 @@ + } + } + +- /* +- * Now process command line options. +- */ +- + 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); +-#if defined(THINK_C) +- inputfromfile = +-#endif + DVIfound = TRUE; + } + else if (strchr(OPTSET, optch = *++str) != NULL) { +@@ -478,99 +459,11 @@ + } + + if (!DVIfound) +-#if defined(THINK_C) /* Allow use of stdin for */ +- if (isatty(fileno(stdin))) +- usage(nored); /* Mac, if redirected */ +-#else + usage(ign); +-#endif +- +- return; + + } /* getargs */ + +- +- +-/* +- * SETOPTION -- Process an option. +- */ +- +-void setoption(const char *optarg) +-{ +- int j = 0; +- +- while (strchr(OPTSET, optch) != NULL) { +- switch (optch) { +- case 'h' : usage(ign); break; +-#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) && !defined(AMIGA) +- case 'q' : pager = FALSE; break; +- case 'f' : pager = TRUE; break; +- case 'F' : pager = TRUE; +- path = optarg; +- j = strlen(optarg); +- break; +-#endif +- case 'J' : japan = TRUE; break; +- case 't' : ttfont = TRUE; break; +- case 'l' : noffd = TRUE; break; +- case 's' : scascii = TRUE; break; +- case 'u' : scascii = FALSE; break; +- case 'a' : accent = FALSE; break; +- case 'c' : allchar = TRUE; 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 > MAXTERMWIDTH)) +- usage(wrnge); +- break; +- case 'e' : if (getinteger(&espace, &j, optarg)) +- usage(nan); +- if (optarg[j] != '\0') +- usage(gae); +- break; +- case 'v' : if (getlong(&lineheight, &j, optarg)) +- usage(nan); +- if (optarg[j] != '\0') +- usage(gae); +- /* lineheight *= 65536L; */ +- /* want to specify in pt, but have no getfloat */ +- break; +- case 'o' : OUTfilename = optarg; +- outputtofile = TRUE; +- j = strlen(optarg); +- break; +- case 'b' : printfont = TRUE; +- delim = optarg; +- if (!strlen(optarg)) +- printfont = FALSE; +- break; +- default : usage(bdopt); +- } +- if ((optch = optarg[j++]) == '\0') +- break; +- if ( (optarg[j] == '\0') && (strchr(OPTWARG, optch) != NULL) ) { +- if (--Argc <= 0) +- usage(noarg); +- optarg = *++Argv; +- j = 0; +- } +- } +- +- return; +- +-} /* setoption */ +- +- +- +-/* +- * GETPAGES -- Getr a list of pages to print. +- */ ++/*---------------------------------------------------------------------------*/ + + void getpages(int j, const char *str) + { +@@ -623,19 +516,11 @@ + } + currentpage = firstpage; + +- return; +- + } /* getpages */ + + +- +-/* +- * PLCNXT -- Place page-nr next in list. +- */ +- +-void plcnxt(int pagnr) ++void plcnxt(int pagnr) /* place page-nr next in list */ + { +- + currentpage = lastpage; + currentpage->pag = pagnr; + lastpage = (printlisttype *) malloc(sizeof(printlisttype)); +@@ -644,10 +529,9 @@ + lastpage->pag = 0; + currentpage->nxt = lastpage; + +- return; +- + } /* plcnxt */ + ++/*----------------------------------------------------------------------------*/ + + #ifdef KPATHSEA + #ifdef __DJGPP__ +@@ -675,13 +559,13 @@ + ret = NULL; + } + else { +- ret = name; ++ ret = (string) name; + } + #else /* ! WIN32 */ + struct stat st; + + if (READABLE (name, st)) { +- ret = name; ++ ret = (string) name; + + } else { /* Some other error. */ + ret = NULL; +@@ -692,10 +576,6 @@ + } + #endif + +-/* +- * GETFNAME -- {Make sure we have a .dvi filename. +- */ +- + void getfname(const char *str) + { + int i; +@@ -705,23 +585,21 @@ + usage(ign); + strcpy(DVIfilename, str); + #ifdef KPATHSEA +- if (!readable_file(DVIfilename)) ++ if (readable_file(DVIfilename)) ++ return; ++ ++ strcat(DVIfilename, ".dvi"); ++ + #else +- if ((i < 5) || strcmp(str+i-4, ".dvi")) +-#endif ++ if (!((i >= 5) && (str[i-1] == 'i') && (str[i-2] == 'v') && ++ (str[i-3] == 'd') && (str[i-4] == '.'))) { + strcat(DVIfilename, ".dvi"); +- +- return; ++ } ++#endif + + } /* getfname */ + +- +- +- +-/* +- * GETINTEGER -- Convert ascii to an integer. I'm sure there is a library +- * call for it. +- */ ++/*----------------------------------------------------------------------------*/ + + int getinteger(int *dest, int *j, const char *str) + { +@@ -736,7 +614,6 @@ + } + else + sgn = 1; +- + if ((ch >= '0') && (ch <= '9')) { + cum = 0; + while ((ch >= '0') && (ch <= '9')) { +@@ -744,55 +621,13 @@ + ch = str[++(*j)]; + } + *dest = sgn * cum; +- + return 0; /* return ok */ + } +- + return 1; /* return error */ + + } /* getinteger */ + +- +- +-/* +- * GETLONG -- Convert ascii to a long. I'm sure there is a library +- * call for it. +- */ +- +-int getlong(long *dest, int *j, const char *str) +-{ +- long 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*10L + ch - '0'; +- ch = str[++(*j)]; +- } +- *dest = (long) sgn * cum; +- +- return 0; /* return ok */ +- } +- +- return 1; /* return error */ +- +-} /* getinteger */ +- +- +- +-/* +- * ERROREXIT -- Exit program with an erro message. +- */ ++/*----------------------------------------------------------------------------*/ + + void errorexit(int errorcode) + { +@@ -839,7 +674,7 @@ + break; + case filcr : fprintf(stderr, "Cannot create outfile\n"); + break; +-#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) && !defined(AMIGA) ++#if !defined(MSDOS) && !defined(VMS) + case pipcr : fprintf(stderr, "Cannot create pipe to pager\n"); + break; + #endif +@@ -852,31 +687,23 @@ + #else + unlink(OUTfilename); + #endif +- + exit(errorcode); + + } /* errorexit */ + +- +- +-/* +- * USAGE -- Print the usage info. Also print a warning/error message +- * if needed. +- */ ++/*----------------------------------------------------------------------------*/ + + void usage(int uerr) + { + +- fprintf(stderr, "%s", Copyright); +- + if (uerr != ign) { + fprintf(stderr,"%s: ", progname); + switch (uerr) { +- case wrnge : fprintf(stderr, "width arg out of range:16-%d", +- MAXTERMWIDTH); ++ 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", ++ case nan : fprintf(stderr, "numeric argument expected for option %c", + optch); + break; + case gae : fprintf(stderr, "garbage in argument for option %c", +@@ -886,47 +713,29 @@ + break; + case onef : fprintf(stderr, "only one infile argument allowed"); + break; +- case noarg : fprintf(stderr, +- "option argument expected for option %c", ++ 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; +-#if defined(THINK_C) +- case nored : fprintf(stderr, "\nIf no input file is given in\ +- command string,\n\Standard Input must be redirected with the radio button."); +- break; +-#endif + default : fprintf(stderr, "unknown usage error"); + break; + } + fprintf(stderr, "\n"); + } +- +- fprintf(stderr, "\n%s\n\n", dvi2tty); +-#if defined(THINK_C) +- fprintf(stderr, "Usage: %s [ options ] [[.dvi]]\n", progname); +- fprintf(stderr, "Read input from , else read from Standard Input,\ +-\nwhich must be redirected by means of the radio button.\n"); +-#else +- fprintf(stderr, "Usage: %s [ options ] [.dvi]\n", progname); +-#endif ++ 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 whose TeX-page-number are in list.\n"); ++ " -plist Print pages whos TeX-page-number are in list.\n"); + fprintf(stderr, +- " -Plist Print pages whose sequential number are in list.\n"); ++ " -Plist Print pages whos sequential number are in list.\n"); + fprintf(stderr, + " -wn Print the lines with width n characters, default 80.\n"); +- fprintf(stderr, +- " -vn Use n for vertical line height, default 450000.\n"); +- fprintf(stderr, +- " -evalue Add/Substract this value for spacing (-20..20)\n"); +-#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) && !defined(AMIGA) ++#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"); +@@ -940,23 +749,19 @@ + fprintf(stderr, " -Fprog Pipe output to pager prog.\n"); + #endif + fprintf(stderr, +- " -a Remove accents grave etc. from output: \\'{e} -> e.\n"); +- fprintf(stderr, +- " -t Assuming that document was made with tt fonts\n"); +- fprintf(stderr, + " -l Write ''^L'' instead of formfeed between pages.\n"); + fprintf(stderr, +- " -u National Swedish/Finnish characters printed as aaoAAO (default %s).\n", DEFSCAND ? "off" : "on"); +- fprintf(stderr, +- " -s National Swedish/Finnish characters printed as }{|][\\ (default %s).\n", DEFSCAND ? "on" : "off"); +- fprintf(stderr, +- " -J Allow processing of japanese fonts\n"); +- fprintf(stderr, +- " -c Override -a -u -s and print all characters 0-255.\n"); ++ " -u National Swedish/Finnish characters printed as aaoAAO"); ++ if (DEFSCAND) ++ fprintf(stderr, ".\n"); ++ else ++ fprintf(stderr, " (default).\n"); + fprintf(stderr, +- " -bdelim Print font switch as text: delimcmr10miled\n"); +- fprintf(stderr, " -h This help message.\n"); +- ++ " -s National Swedish/Finnish characters printed as }{|][\\"); ++ if (DEFSCAND) ++ fprintf(stderr, " (default).\n"); ++ else ++ fprintf(stderr, ".\n"); + exit(uerr); + + } /* usage */ +diff -ur dvi2tty-5.3.1.orig/dvi2tty.h dvi2tty-5.3.1/dvi2tty.h +--- dvi2tty-5.3.1.orig/dvi2tty.h 2010-10-22 15:08:40.000000000 +0200 ++++ dvi2tty-5.3.1/dvi2tty.h 2010-10-24 14:29:23.814830452 +0200 +@@ -23,33 +23,28 @@ + + #include + #include +-#include ++ ++#include ++#include ++ + #if defined(MSDOS) +-# include +-#else +-# if !defined(THINK_C) +-# include +-# endif ++#define DOSISH ++#include ++#include + #endif + + #if defined(KPATHSEA) + #define NO_DEBUG 1 + #include +-#include +-#include +-#else ++#endif ++ ++#ifndef KPATHSEA + #define TRUE 1 + #define FALSE 0 + #endif + #define nil NULL + + /* +- * Define the maximum width of the terminal +- * (this is also used to define the with of the line structure in dvistuff.c) +- */ +-#define MAXTERMWIDTH 332 +- +-/* + * ERROR CODES , don't start with 0 + */ + +@@ -76,11 +71,7 @@ + #define pipcr 20 /* cannot creat pipe */ + #endif + +- +- +-/* +- * Type definitions +- */ ++/*---------------------------------------------------------------------------*/ + + typedef char bool; + +@@ -91,22 +82,13 @@ + struct prlistptr *nxt; /* next item in list */ + } printlisttype; + +- +- +-/* +- * Variable definitions +- */ ++/*---------------------------------------------------------------------------*/ + + 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 accent; /* Output accent stuff(dvistuff.c) */ +-extern bool ttfont; /* tt font assumed (dvistuff.c) */ +-extern bool japan; /* japanes font support (dvistuff.c) */ + extern bool noffd; /* output ^L or formfeed (dvistuff.c) */ +-extern bool printfont; /* include font switches (dvistuff.c) */ +-extern bool allchar; /* output all characters (dvistuff.c */ + + extern printlisttype *currentpage; /* current page to print (dvi2tty.c) */ + extern printlisttype *firstpage; /* first page selected (dvi2tty.c) */ +@@ -115,29 +97,15 @@ + extern int ttywidth; /* screen width (dvi2tty.c) */ + extern int espace; /* extra screen width (dvi2tty.c) */ + extern long foo; /* temporary 'register' (dvi2tty.c) */ +-extern long lineheight; /* height of a line (dvistuff.c) */ + extern int opcode; /* dvi opcode (dvistuff.c) */ +-extern char * delim; /* printer font delim (dvistuff.c) */ + + extern FILE *DVIfile; /* dvi file (dvi2tty.c) */ + extern FILE *output; /* output file (dvi2tty.c) */ + +- +- +-/* +- * Funtion declarations +- */ ++/*---------------------------------------------------------------------------*/ + + /* dvi2tty.c */ +-#if defined(MSDOS) + void errorexit(int); +-#else +-void errorexit(int errorcode); +-#endif + + /* dvistuff.c */ +-#if defined(MSDOS) +-void dvimain(void); +-#else + void dvimain(void); +-#endif +diff -ur dvi2tty-5.3.1.orig/dvistuff.c dvi2tty-5.3.1/dvistuff.c +--- dvi2tty-5.3.1.orig/dvistuff.c 2010-10-23 19:03:03.000000000 +0200 ++++ dvi2tty-5.3.1/dvistuff.c 2010-10-24 15:01:30.719544412 +0200 +@@ -23,23 +23,15 @@ + */ + + #include "dvi2tty.h" +- ++#include ++#include + #if defined(VMS) +-# include types.h +-# include stat +-#else +-# if defined(THINK_C) +-# include +-# else +-# include +-# include +-# endif ++#include types.h ++#include stat + #endif +- +-#if defined(MSDOS) || defined(THINK_C) +-# include ++#if defined(MSDOS) ++#include + #endif +- + #include "commands.h" + + +@@ -58,10 +50,9 @@ + #define VERSIONID 2 /* dvi version number that pgm handles */ + #define VERTICALEPSILON 450000L /* crlf when increasing v more than this */ + +-#define rightmargin MAXTERMWIDTH+20 +- /* nr of columns allowed to the right of h=0*/ ++#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 rightmargin - leftmargin + 1 ++#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 */ +@@ -125,17 +116,7 @@ + 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 accent; /* if true output accents etc: \'{e} etc. */ +-bool ttfont = FALSE; /* if true we assumed ttfonts, not cmr */ +-bool symbolfont = FALSE; /* true if font is a symbol font */ +-bool japan = FALSE; /* switch to japanese fonts ... */ +-bool mifont = FALSE; +-int jfontnum = 0; + bool noffd; /* if true output ^L instead of formfeed */ +-char * delim; /* -bdelim for font switch printing */ +-bool printfont; /* true if user wants font switches printed */ +-bool allchar; /* true if user sets all characters */ +- /* overrides sscasci, accent */ + + int opcode; /* dvi-opcodes */ + +@@ -149,8 +130,6 @@ + + long maxpagewidth; /* width of widest page in file */ + long charwidth; /* aprox width of character */ +-long lineheight = VERTICALEPSILON; +- /* aprox height of a line */ + + linetype * currentline; /* pointer to current line on current page */ + linetype * firstline; /* pointer to first line on current page */ +@@ -161,6 +140,7 @@ + int sptr; /* stack pointer */ + + font * fonts = NULL; /* List of fontnames defined */ ++int symbolfont = FALSE; /* true if font is a symbol font */ + + + +@@ -168,7 +148,7 @@ + * Function definitions + */ + +-#if defined(MSDOS) ++#if defined(KPATHSEA) || defined(MSDOS) + void postamble (void); + void preamble (void); + void walkpages (void); +@@ -193,38 +173,31 @@ + void setchar (long); + void fontdef (int); + void setfont (long); +-void jischar (long); +-int compute_jis (int, int, int *, int *); +-int getjsubfont (char *); +- + #else +-void postamble (void); +-void preamble (void); +-void walkpages (void); +-void initpage (void); +-void dopage (void); +-void skippage (void); +-void printpage (void); +-bool inlist (long pagenr); +-void rule (bool moving, long rulewt, long ruleht); +-void ruleaux (long rulewt, long ruleht, char ch); +-long horizontalmove (long amount); +-int skipnops (void); +-linetype * texlive_getline (void); +-linetype * findline (void); +-unsigned long num (int size); +-long snum (int size); +-void dochar (char ch); +-void symchar (char ch); +-void normchar (char ch); +-void outchar (unsigned char ch); +-void putcharacter (long charnr); +-void setchar (long charnr); +-void fontdef (int x); +-void setfont (long fntnum); +-void jischar (long charnr); +-void compute_jis (int f, int c, int * ku, int * ten); +-int getjsubfont (char * s); ++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 * texlive_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 (); +@@ -249,8 +222,8 @@ + /* note that walkpages *must* immediately follow preamble */ + walkpages(); /* time to do the actual work! */ + +- return; +- ++- return; ++- + } /* dvimain */ + + +@@ -340,26 +313,30 @@ + + 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; + +- pagecounter++; +- pagenr = sget4(); /* get TeX page number */ +- mseek(DVIfile, 36L, relative); /* skip page header */ +- backpointer = sget4(); /* get previous page offset */ +- if (pageswitchon) +- wantpage = inlist(sequenceon ? pagecounter : pagenr); +- else +- wantpage = TRUE; +- +- if (wantpage) { +- initpage(); +- dopage(); +- printpage(); +- } +- else ++ if (wantpage) { ++ initpage(); ++ dopage(); ++ printpage(); ++ } ++ else { + skippage(); ++ } ++ } + } + + return; +@@ -417,12 +394,12 @@ + if (opcode <= LASTCHAR) + dochar((char) opcode); + else if ((opcode >= FONT_00) && (opcode <= FONT_63)) +- setfont((long) opcode - FONT_00); ++ setfont(opcode - FONT_00); + else if (opcode > POST_POST) + errorexit(illop); + else + switch (opcode) { +- case SET1 : japan ? jischar(get1()) : setchar(get1());break; ++ case SET1 : setchar(get1()); break; + case SET2 : setchar(get2()); break; + case SET3 : setchar(get3()); break; + case SET4 : setchar(get4()); break; +@@ -599,9 +576,9 @@ + for (currentline = firstline; currentline != nil; + currentline = currentline->next) { + if (currentline != firstline) { +- foo = ((currentline->vv - currentline->prev->vv)/lineheight)-1; ++ foo = ((currentline->vv - currentline->prev->vv)/VERTICALEPSILON)-1; + if (foo > 3) +- foo = 3; /* linespacings not too large */ ++ foo = 3; /* linespacings not too large */ + for (i = 1; i <= (int) foo; i++) + putc('\n', output); + } +@@ -610,7 +587,7 @@ + for (i = firstcolumn, j = 1; i <= currentline->charactercount; + i++, j++) { + ch = currentline->text[i - leftmargin]; +- if (ch >= SPACE || allchar) ++ if (ch >= SPACE) + putc(ch, output); + if ((j > (int) foo) && (currentline->charactercount > i+1)) { + fprintf(output, "*\n"); /* if line to large */ +@@ -681,7 +658,7 @@ + savev = v; + if ((ruleht / rulewt) > 0) /* value < 1 truncates to 0 */ + ch = '|'; +- else if (ruleht > (lineheight / 2)) ++ else if (ruleht > (VERTICALEPSILON / 2)) + ch = '='; + else + ch = '_'; +@@ -716,11 +693,11 @@ + outchar(ch); + wt -= (h-rmh); /* decrease the width left on line */ + } +- ruleht -= lineheight; /* decrease the height */ +- if (ruleht > lineheight) { /* still more vertical? */ ++ ruleht -= VERTICALEPSILON; /* decrease the height */ ++ if (ruleht > VERTICALEPSILON) { /* still more vertical? */ + rmh = h; /* save current h (right margin) */ + h = lmh; /* restore left margin */ +- v -= (lineheight + lineheight / 10); ++ v -= (VERTICALEPSILON + VERTICALEPSILON / 10); + ruleaux(rulewt, ruleht, ch); + h = rmh; /* restore right margin */ + } +@@ -813,7 +790,7 @@ + register long topd, botd; + + if (v <= firstline->vv) { /* above first line */ +- if (firstline->vv - v > lineheight) { ++ if (firstline->vv - v > VERTICALEPSILON) { + temp = texlive_getline(); + temp->next = firstline; + firstline->prev = temp; +@@ -824,7 +801,7 @@ + } + + if (v >= lastline->vv) { /* below last line */ +- if (v - lastline->vv > lineheight) { ++ if (v - lastline->vv > VERTICALEPSILON) { + temp = texlive_getline(); + temp->prev = lastline; + lastline->next = temp; +@@ -841,7 +818,7 @@ + /* temp->vv < v < temp->next->vv --- temp is above, temp->next is below */ + topd = v - temp->vv; + botd = temp->next->vv - v; +- if ((topd < lineheight) || (botd < lineheight)) { ++ if ((topd < VERTICALEPSILON) || (botd < VERTICALEPSILON)) { + if (topd < botd) /* take best fit */ + return temp; + else +@@ -886,7 +863,7 @@ + long snum(int size) + { + register int i; +- register long x; ++ register long x = 0; + + x = getc(DVIfile); + if (x & 0x80) +@@ -906,10 +883,8 @@ + + void dochar(char ch) + { +- +- if (japan && jfontnum) +- jischar((long) ch); +- else if (symbolfont == TRUE) ++ ++ if (symbolfont == TRUE) + symchar(ch); + else + normchar(ch); +@@ -936,8 +911,6 @@ + case 14: ch = 'O'; break; + case 15: ch = 'o'; break; + case 24: ch = '~'; break; +- case 32: ch = japan ? '<' : 32; break; /* really only for japan? */ +- case 33: ch = japan ? '>' : 33; break; /* really only for japan? */ + case 102: ch = '{'; break; + case 103: ch = '}'; break; + case 104: ch = '<'; break; +@@ -962,104 +935,58 @@ + { + + switch (ch) { +- case 11 : if (ttfont) +- ch = '^'; /* up symbol */ +- else if (!allchar) { +- outchar('f'); ch = 'f'; /* ligature */ +- } +- break; +- case 12 : if (ttfont) +- ch = 'v'; /* low symbol */ +- else if (!allchar) { +- outchar('f'); ch = 'i'; /* ligature */ +- } ++ 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 13 : if (ttfont) +- ch = '`'; +- else if (!allchar) { +- outchar('f'); ch = 'l'; /* ligature */ +- } +- break; +- case 14 : if (ttfont) +- ch = 'i'; /* spanish ! */ +- else if (!allchar) { +- outchar('f'); outchar('f'); +- ch = 'i'; /* ligature */ +- } ++ case 26 : if (scascii) /* Dane/Norw ae */ ++ ch = 0xe6; ++ else ++ {outchar('a'); ch = 'e';} + break; +- case 15 : if (ttfont) +- ch = '.'; /* spanish ? */ +- else if (!allchar) { +- outchar('f'); outchar('f'); +- ch = 'l'; /* ligature */ +- } ++ case 27 : outchar('o'); ch = 'e'; break; /* Dane/Norw oe */ ++ case 28 : if (scascii) /* Dane/Norw /o */ ++ ch = 0xf8; ++ else ++ ch = 'o'; + break; +- case 16 : if (!allchar) ch = 'i'; break; +- case 17 : if (!allchar) ch = 'j'; break; +- case 25 : if (!allchar) { +- outchar('s'); +- ch = 's'; +- } +- break; /* German double s */ +- case 26 : if (!allchar) { +- outchar('a'); +- ch = 'e'; +- } +- break; /* Dane/Norw ae */ +- case 27 : if (!allchar) { +- outchar('o'); +- ch = 'e'; +- } +- break; /* Dane/Norw oe */ +- case 28 : if (!allchar) { +- if (scascii) +- ch = '|'; /* Dane/Norw /o */ +- else +- ch = 'o'; +- } ++ case 29 : if (scascii) /* Dane/Norw AE */ ++ ch = 0xc6; ++ else ++ {outchar('A'); ch = 'E';} + break; +- case 29 : if (!allchar) { +- outchar('A'); +- ch = 'E'; +- } +- break; /* Dane/Norw AE */ +- case 30 : if (!allchar) { +- outchar('O'); +- ch = 'E'; +- } +- break; /* Dane/Norw OE */ +- case 31 : if (!allchar) { +- if (scascii) +- ch = '\\'; /* Dane/Norw /O */ +- else +- ch = 'O'; +- } ++ case 30 : outchar('O'); ch = 'E'; break; /* Dane/Norw OE */ ++ case 31 : if (scascii) ++ ch = 0xd8; /* Dane/Norw /O */ ++ else ++ ch = 'O'; + break; +- case 32 : ch = allchar || ttfont ? ch : '_'; break; +- /* underlined blank */ +- case 58 : ch = allchar || !mifont ? ch : '.'; break; /* if japan */ +- case 59 : ch = allchar || !mifont ? ch : ','; break; /* if japan */ +- case 92 : ch = allchar || ttfont ? ch : '"'; break; /* \ from `` */ +- case 123 : ch = allchar || ttfont ? ch : '-'; break; /* { from -- */ +- case 124 : ch = allchar || ttfont ? ch : '_'; break; /* | from --- */ +- case 125 : ch = allchar || ttfont ? ch : '"'; break; /* } from \H */ +- case 126 : ch = allchar || ttfont ? ch : '"'; break; /* ~ from \~ */ +- case 127 : if (!allchar) ch = '"'; break; /* DEL from \" */ +- +- /* +- * Or should I use SPACE for non-accents ??? +- * This seems to work ... +- */ +- case 18 : ch = !allchar && accent ? '`' : ch; break; /* from \` */ +- case 19 : ch = !allchar && accent ? 0x27 : ch; break; /* from \' */ +- case 20 : ch = !allchar && accent ? '~' : ch; break; /* from \v */ +- case 21 : ch = !allchar && accent ? '~' : ch; break; /* from \u */ +- case 22 : ch = !allchar && accent ? '~' : ch; break; /* from \= */ +- case 24 : ch = !allchar && accent ? ',' : ch; break; /* from \c */ +- case 94 : ch = (!allchar && accent && !ttfont) ? '^' : ch; break; +- /* ^ from \^ */ +- case 95 : ch = (!allchar && accent && !ttfont) ? '`' : ch; break; +- /* _ from \. */ ++ 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); + +@@ -1080,12 +1007,10 @@ + { + register int i, j; + +-/* fprintf(stderr, "hor: %ld, ver: %ld\n", h, v); */ +- +-#if defined(MSDOS) || defined(THINK_C) +- if (labs(v - currentline->vv) > lineheight / 2L) ++#if defined(MSDOS) ++ if (labs(v - currentline->vv) > VERTICALEPSILON / 2L) + #else +- if (abs(v - currentline->vv) > lineheight / 2L) ++ if (abs(v - currentline->vv) > VERTICALEPSILON / 2L) + #endif + currentline = findline(); + +@@ -1119,15 +1044,14 @@ + for (i = IMAX(leftmargin, j-2); + i <= IMIN(rightmargin, j+2); + i++) +- if ((currentline->text[i - leftmargin] == 127) || /* DEL */ +- (currentline->text[i - leftmargin] == 34) || /* " */ ++ 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 : /* DEL or " */ ++ case 127 : case 34: + if (ch == 'a') + ch = 0xe4; + else if (ch == 'A') /* dots ... */ +@@ -1151,16 +1075,15 @@ + } + } + /*----------------- end of 'Scandinavian code' ----------------*/ +- + if (foo == leftmargin-1) + while ((currentline->text[j - leftmargin] != SPACE) + && (j < rightmargin)) { + j++; + h += charwidth; + } +- if ( allchar || ((ch >= SPACE) && (ch != DEL)) || ++ if ( ((ch >= SPACE) && (ch != DEL)) || + (scascii && (ch == 23)) ) { +- /* (scascii && (ch == DEL)) ) if VMS ??? */ ++ /* (scascii && (ch == DEL)) ) { if VMS ??? */ + if (j < rightmargin) + currentline->text[j - leftmargin] = ch; + else +@@ -1187,9 +1110,7 @@ + register long saveh; + + saveh = h; +- if (japan) +- dochar((char) charnr); +- else if (allchar || ((charnr >= 0) && (charnr <= LASTCHAR))) ++ if ((charnr >= 0) && (charnr <= LASTCHAR)) + outchar((char) charnr); + else + setchar(charnr); +@@ -1210,7 +1131,7 @@ + void setchar(long charnr) + { + +- outchar(allchar ? (unsigned char)charnr : '#'); ++ outchar((unsigned char)(charnr)); + + return; + +@@ -1280,147 +1201,29 @@ + { + font * fnt; + char * s; +- char * d; + + fnt = fonts; + while (fnt != NULL && fnt->num != fntnum) + fnt = fnt->next; +- symbolfont = FALSE; +- ttfont = FALSE; +- mifont = FALSE; +- jfontnum = 0; + if (fnt == NULL) { + /* error : font not found */ ++ symbolfont = FALSE; + return; + } + + s = fnt->name; +- d = delim; /* print delim and font name if -b was chosen */ +- if (printfont) { +- while (*d !=0) {putcharacter(*d); d++;} +- d = s; +- while (*d !=0) {putcharacter(*d); d++;} +- /* d = strrev(delim); */ +- while (*d !=0) {putcharacter(*d); d++;} +- } +- +- if (japan) +- jfontnum = getjsubfont(s); +- if (jfontnum == 0) { +- while ((s = strchr(s, 's')) != NULL) { +- if (strncmp("sy", s, 2) == 0) { +- symbolfont = TRUE; +- break; +- } +- s++; /* New line to fix bug; font names with 's' would hang */ +- } +- +- s = fnt->name; +- while ((s = strchr(s, 't')) != NULL) { +- if (strncmp("tt", s, 2) == 0) { +- ttfont = TRUE; +- break; +- } +- s++; /* New line to fix bug; font names with 's' would hang */ +- } +- +- s = fnt->name; +- while ((s = strchr(s, 'm')) != NULL) { +- if (strncmp("mi", s, 2) == 0) { +- mifont = TRUE; +- break; +- } +- s++; /* New line to fix bug; font names with 's' would hang */ ++ 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 */ +- +- +- +-void jischar(long charnr) +-{ +- int Ku, Ten; +- +- compute_jis(jfontnum, (int) charnr, &Ku, &Ten); +- outchar(Ku+128); +- outchar(Ten+128); +- +- return; +- +-} /* jischar */ +- +-#define kushift(c) c+0x20 +-#define tenshift(c) c+0x20 +- +-void compute_jis(int f, int c, int *ku, int *ten) +-{ +- int n; +- +- if (f <= 7) { +- if (f == 1) { +- if (c >= 100) { +- *ku = kushift(2); +- *ten = tenshift(c-100); +- } +- else { +- *ku = kushift(1); +- *ten = tenshift(c); +- } +- } +- else if (f == 2) { +- *ku = kushift(3); +- *ten = tenshift(c-32); +- } +- else { +- *ku = kushift(f+1); +- *ten = tenshift(c); +- } +- } +- else if (f <= 19) { /* Daiichi Suijun */ +- n = (f-8)*256+c; +- *ku = kushift((n/94)+16); +- *ten = tenshift((n%94)+1); +- } +- else { /* Daini Suijun */ +- n = (f-20)*256+c; +- *ku = kushift((n/94)+48); +- *ten = tenshift((n%94)+1); +- } +- +- return; +- +-} /* compute_jis */ +- +- +-#define NJSUBS 33 +-char *jsf_names[]={ +- "jsy", "jroma", "jhira", "jkata", "jgreek", "jrussian", "jkeisen", +- "jka", "jkb", "jkc", "jkd", "jke", "jkf", "jkg", "jkh", "jki", "jkj", +- "jkk", "jkl", "jkm", "jkn", "jko", "jkp", "jkq", "jkr", "jks", "jkt", +- "jku", "jkv", "jkw", "jkx", "jky", "jkz" +-}; +- +- +-int getjsubfont(char *s) +-{ +- int jf; +- +- if (s[0] == 'd' && (s[1] == 'm' || s[1] == 'g')) { +- for (jf = 0; jf < NJSUBS; jf++) { +- if (strncmp(&s[2], jsf_names[jf], strlen(jsf_names[jf])) == 0) +- return jf+1; +- } +- return 0; +- } +- else +- return 0; +- +-} /* getjsubfont */ +- + + + +@@ -1429,10 +1232,7 @@ + */ + + #if defined(VMS) +-long vmsseek(fp,n,dir) +-FILE *fp; +-long n; +-long dir; ++long vmsseek(FILE *fp, long n, long dir) + { + long k,m,pos,val,oldpos; + struct stat buffer; +@@ -1484,8 +1284,7 @@ + + + +-long vms_ftell(fp) +-FILE *fp; ++long vms_ftell(FILE *fp) + { + char c; + long pos; +@@ -1507,9 +1306,7 @@ + + + +-long vms_ungetc(c,fp) +-char c; +-FILE *fp; ++long vms_ungetc(char c, FILE *fp) + { + + if ((c == EOF) && feof(fp)) diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-91-undo-rest b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-91-undo-rest new file mode 100644 index 00000000000..e79c8251ec2 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1-PATCHES/patch-91-undo-rest @@ -0,0 +1,1630 @@ +diff -ur dvi2tty-5.3.1.orig/commands.h dvi2tty-5.3.1/commands.h +--- dvi2tty-5.3.1.orig/commands.h 2010-10-20 11:34:16.000000000 +0200 ++++ dvi2tty-5.3.1/commands.h 2010-10-15 11:34:23.000000000 +0200 +@@ -1,23 +1,3 @@ +-/* +- * dvi2tty +- * Copyright (C) 2003 Marcel J.E. Mol +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version 2 +- * of the License, or (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +- * +- */ +- + /* DVI COMMANDS */ + #define SETC_000 0 /* typeset character 0 and move right */ + #define SETC_127 127 /* typeset character 127 and move right */ +diff -ur dvi2tty-5.3.1.orig/disdvi.c dvi2tty-5.3.1/disdvi.c +--- dvi2tty-5.3.1.orig/disdvi.c 2010-10-24 14:03:20.000000000 +0200 ++++ dvi2tty-5.3.1/disdvi.c 2010-10-15 11:36:32.000000000 +0200 +@@ -3,73 +3,34 @@ + /* disdvi --- disassembles TeX dvi files. */ + /* */ + /* */ +-/* 2.25 23jan2003 M.J.E. Mol fixed bug in copying font name (name[i]) */ +-/* 2.24 27may96 M.J.E. Mol A few typecasts added */ +-/* 2.23 23jul95 M.J.E. Mol Cleanups from duz@roxi.ez.fht-mannheim.de */ +-/* 2.22 13dec90 M.J.E. Mol Fixed bug in num(). Cleaned up code. */ +-/* 2.21 03may90 M.J.E. Mol Created usage(). */ +-/* 2.2 02may90 M.J.E. Mol Included port to VAX/VMS VAXC by */ +-/* Robert Schneider. */ +-/* 2.1 19jan90 M.J.E. Mol Maintain a list of fonts and */ ++/* 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 */ +-/* 2.0 23jan89 M.J.E. Mol (c) 1989 */ +-/* marcel@mesa.nl */ ++/* */ + /* */ + /*****************************************************************************/ + +-/* +- * dvi2tty +- * Copyright (C) 2003 Marcel J.E. Mol +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version 2 +- * of the License, or (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +- * +- */ +- +-char *disdvi = "@(#) disdvi.c 2.25 23jan2003 M.J.E. Mol (c) 1989-1996, marcel@mesa.nl"; +- +-/* +- * Include files +- */ + +-#include +-#include +-#if defined(MSDOS) +-# include +-#else +-# if !defined(THINK_C) /* Macintosh */ +-# include +-# endif ++#if 0 ++char *disdvi = "@(#) disdvi.c 2.1 19/01/90 M.J.E. Mol (c) 1989, 1990"; + #endif ++ ++#include + #include +-#include + #include "commands.h" +-#if defined(THINK_C) +-# include "macintosh.h" +-#endif + + #if defined(KPATHSEA) + #define NO_DEBUG 1 + #include + #include ++#else ++#if defined(MSDOS) ++#include ++#include ++#include ++#endif + #endif +- +- +-/* +- * Constant definitions +- */ + + #define LASTCHAR 127 /* max dvi character, above are commands */ + +@@ -82,100 +43,80 @@ + #define sget3() snum(3) + #define sget4() snum(4) + +- +- +-/* +- * Type definitions +- */ +- + typedef struct _font { + long num; + struct _font * next; + char * name; + } font; + +- +- +-/* +- * Variable declarations +- */ +- + font * fonts = NULL; + FILE * dvifp; + char * dvi_name; + long pc = 0; + +-char * progname; +- + int is_ptex = 0; + int is_xetex = 0; + const char * dvi_ext = ".dvi"; + +-/* +- * Function declarations +- */ +- +-#if !defined(THINK_C) ++#ifdef KPATHSEA ++extern void bop(void); ++extern void postamble(void); ++extern void preamble(void); ++extern void postpostamble(void); ++extern void special(int x); ++extern void fontdef(int x); ++extern const char *fontname(long fntnum); ++extern void printnonprint(int ch); ++extern unsigned long num(int size); ++extern long snum(int size); ++extern void picfile(int opcode); ++extern void natfontdef(int opcode); ++extern void glyphs(int opcode); ++extern void dvidir(int opcode); ++extern void invalid(int opcode); ++#else + char * malloc (); +-#endif + +-#if defined(VMS) +- main (int argc, char ** argv); ++int main (); ++void bop (); ++void preamble (); ++void postamble (); ++void postpostamble (); ++void fontdef (); ++char * fontname (); ++void special (); ++void printnonprint (); ++unsigned long num (); ++long snum (); ++void picfile (); ++void natfontdef (); ++void glyphs (); ++void dvidir (); ++void invalid (); + #endif +-void bop (void); +-void preamble (void); +-void postamble (void); +-void postpostamble (void); +-void fontdef (int x); +-const char * fontname (unsigned long fntnum); +-void special (int x); +-void printnonprint (int ch); +-unsigned long num (int size); +-long snum (int size); +-void usage (void); +-void picfile (int opcode); +-void natfontdef (int opcode); +-void glyphs (int opcode); +-void dvidir (int opcode); +-void invalid (int opcode); +- + + + +-/* +- * MAIN -- +- */ ++/*---------------------------------------------------------------------------*/ + +-#if defined(VMS) +- main(int argc, char **argv) +-#else + int main(int argc, char **argv) +-#endif + { + register int opcode; /* dvi opcode */ + register int i; + int fontnum; ++ char * progname; + +-#if defined(THINK_C) +- argc = process_disdvi_command_line(&argv); +-#endif +- ++ progname = *argv; + +- progname = *argv++; +- +- if ((argc > 1) && (*argv[0] == '-')) { +- if (!strcmp(*argv, "-h")) { +- usage(); +- exit(0); +- } +- if (!strcmp(*argv, "-p")) ++ if ((argc > 1) && (argv[1][0] == '-')) { ++ if (!strcmp(argv[1], "-p") || !strcmp(argv[1], "--ptex")) { + is_ptex = 1; +- else if (!strcmp(*argv, "-x")) { ++ } else if (!strcmp(argv[1], "-x") || !strcmp(argv[1], "--xetex")) { + is_xetex = 1; + dvi_ext = ".xdv"; + } else { +- fprintf(stderr, "Invalid option `%s'\n", *argv); +- usage(); ++ fprintf(stderr, "Invalid option `%s'\n", argv[1]); ++ fprintf(stderr, "Usage: %s [-p|--ptex|-x|--xetex] [dvi-file]\n", progname); + exit(3); + } + argv++; +@@ -184,21 +125,21 @@ + + if (argc > 2) { + fprintf(stderr, "To many arguments\n"); +- usage(); ++ fprintf(stderr, "Usage: %s [-p|--ptex|-x|--xetex] [dvi-file]\n", progname); + exit(1); + } + + if (argc == 2) { +- if ((i = strlen(*argv)) == 0) { ++ if ((i = strlen(argv[1])) == 0) { + fprintf(stderr, "Illegal empty filename\n"); +- usage(); ++ fprintf(stderr, "Usage: %s [-p|--ptex|-x|--xetex] [dvi-file]\n", progname); + exit(2); + } +- if ((i >= 5) && (!strcmp(*argv+i-4, dvi_ext))) +- dvi_name = *argv; ++ if ((i >= 5) && !strcmp(argv[1]+(i-4), dvi_ext)) ++ dvi_name = argv[1]; + else { + dvi_name = malloc((i+5) * sizeof(char)); +- strcpy(dvi_name, *argv); ++ strcpy(dvi_name, argv[1]); + strcat(dvi_name, dvi_ext); + } + if ((dvifp = fopen(dvi_name, "r")) == NULL) { +@@ -325,22 +266,19 @@ + } + } + +- exit(0); +- ++ return 0; + } /* main */ + + ++/*----------------------------------------------------------------------------*/ + +-/* +- * BOP -- Process beginning of page. +- */ + + void bop(void) + { + int i; + + printf("BOP page number : %ld", sget4()); +- for (i=9; i > 0; i--) { ++ for (i=0; i < 9; i++) { + if (i % 3 == 0) + printf("\n%06ld: ", pc); + printf(" %6ld", sget4()); +@@ -348,15 +286,10 @@ + printf("\n%06ld: ", pc); + printf(" prev page offset : %06ld\n", sget4()); + +- return; +- + } /* bop */ + + +- +-/* +- * POSTAMBLE -- Process post amble. +- */ ++/*---------------------------------------------------------------------------*/ + + void postamble(void) + { +@@ -377,16 +310,8 @@ + printf("%06ld: ", pc); + printf(" number of pages : %d\n", (int) get2()); + +- return; +- + } /* postamble */ + +- +- +-/* +- * PREAMBLE -- Process pre amble. +- */ +- + void preamble(void) + { + register int i; +@@ -405,16 +330,9 @@ + putchar((int) get1()); + putchar('\n'); + +- return; +- + } /* preamble */ + + +- +-/* +- * POSTPOSTAMBLE -- Process post post amble. +- */ +- + void postpostamble(void) + { + register int i; +@@ -432,38 +350,27 @@ + i = (int) get1(); + } + +- return; +- + } /* postpostamble */ + + + +-/* +- * SPECIAL -- Process special opcode. +- */ +- +-void special(int x) ++void special(register int x) + { + register long len; ++ register long i; + + len = num(x); + printf("XXX%d: %ld bytes\n", x, len); + printf("%06ld: ", pc); +- for (; len>0; len--) /* a bit dangerous ... */ ++ for (i = 0; i < len; i++) /* a bit dangerous ... */ + putchar((int) get1()); /* can be non-printables */ + putchar('\n'); + +- return; +- + } /* special */ + + + +-/* +- * FONTDEF -- Process a font definition. +- */ +- +-void fontdef(int x) ++void fontdef(register int x) + { + register int i; + char * name; +@@ -503,7 +410,7 @@ + + for (i = 0; i < namelen; i++) + name[i] = get1(); +- name[i] = '\0'; ++ name[namelen] = '\0'; + fnt->name = name; + if (new) { + fnt->next = fonts; +@@ -512,17 +419,12 @@ + + printf("%s\n", name); + +- return; +- + } /* fontdef */ + + + +-/* +- * FONTNAME -- Return font name. +- */ +- +-const char * fontname(long fntnum) ++const char * ++fontname(long fntnum) + { + font * fnt; + +@@ -531,18 +433,14 @@ + fnt = fnt->next; + if (fnt != NULL) + return fnt->name; +- +- return "unknown fontname"; ++ else ++ return "unknown fontname"; + + } /* fontname */ + + + +-/* +- * PRINTNONPRINT -- Translate non-printable characters. +- */ +- +-void printnonprint(int ch) ++void printnonprint(register int ch) + { + + printf("Char: "); +@@ -590,71 +488,41 @@ + } + putchar('\n'); + +- return; +- +-} /* printnonprint */ ++} + + + +-/* +- * NUM -- +- */ +- +-unsigned long num(int size) ++unsigned long num(register int size) + { + register int i; +- register unsigned long x = 0; ++ register long x = 0; + + pc += size; +- for (i = size; i > 0; i--) ++ for (i = 0; i < size; i++) + x = (x << 8) + (unsigned) getc(dvifp); +- + return x; + + } /* num */ + + + +-/* +- * SNUM -- +- */ +- +-long snum(int size) ++long snum(register int size) + { + register int i; +- register long x; ++ register long x = 0; + + pc += size; + x = getc(dvifp); + if (x & 0x80) + x -= 0x100; +- for (i = size - 1; i > 0; i--) ++ for (i = 1; i < size; i++) + x = (x << 8) + (unsigned) getc(dvifp); +- + return x; + + } /* snum */ + + + +-/* +- * USAGE -- +- */ +- +-void usage(void) +-{ +- +- fprintf(stderr, "\n%s\n\n", disdvi); +- fprintf(stderr, " disassembles (p)TeX dvi and XeTeX xdv files\n"); +- fprintf(stderr, "Usage: %s [-h | [-p] [dvi_file[.dvi]]\n", progname); +- fprintf(stderr, " | -x [xdv_file[.xdv]]]\n"); +- +- return; +- +-} /* usage */ +- +- +- + void picfile(int opcode) + { + int i; +diff -ur dvi2tty-5.3.1.orig/dvi2tty.1 dvi2tty-5.3.1/dvi2tty.1 +--- dvi2tty-5.3.1.orig/dvi2tty.1 2010-10-20 14:21:13.000000000 +0200 ++++ dvi2tty-5.3.1/dvi2tty.1 2006-01-17 22:41:51.000000000 +0100 +@@ -1,38 +1,36 @@ +-.TH DVI2TTY 1 "20 October 2010" "TeX Live" ++.TH DVI2TTY Local "7 June 1986" + .SH NAME +-dvi2tty \- preview a TeX DVI\-file on an ordinary ascii terminal ++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 appropriate for terminals +-and line printers. The program is intended to be used for ++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 +-useful if you want to avoid walking to the +-laser printer (or whatever) for each iteration of your ++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 line printers the ++produces output for terminals and lineprinters the + representation of documents is naturally quite primitive. +-In principle Font Changes are totally ignored, but +-.I dvi2tty +-recognizes +-a few mathematical and special symbols that can be be displayed on an +-ordinary ascii terminal, such as the '+' and '-' symbol. ++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. laser printers). To show that a broken line is really ++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 +@@ -41,7 +39,7 @@ + in the first two columns. + .PP + Options may be specified in the environment variable DVI2TTY. +-Any option on the command line, conflicting with one in the ++Any option on the commandline, conflicting with one in the + environment, will override the one from the environment. + .PP + .B Options: +@@ -56,7 +54,7 @@ + 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''. ++e g \-1 comes before \-4 as in ``\-p-1:-4,17''. + .TP + .B \-P list + Like \-p except that page numbers refer to +@@ -73,59 +71,35 @@ + terminal into this mode as output will + probably look somewhat better. + .TP +-.B \-v +-Specify height of lines. Default value 450000. Allows to adjust linespacing. +-.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 person installing the program). +-.TP +-.B \-e n +-This option can be used to influence the spacing between words. +-With a negative value the number of spaces +-between words becomes less, with a positive value it becomes more. +-\-e\-11 seems to worked well. ++(depending on the whims of the SA installing the program). + .TP + .B \-f +-Pipe through a pager, $PAGER if defined, or whatever the installer of +-the program compiled ++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 overrides the $PAGER and the default pager. ++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 \-t +-\\tt fonts were used (instead of cm) to produce dvi file. (screen.sty +-is a powerfull mean to do that with LaTeX). +-.TP +-.B \-a +-Dvi2tty normally tries to output accented characters. With the -a option, +-accented characters are output without the accent sign. +-.TP + .B \-l +-Mark page breaks with the two-character sequence ``^L''. The default is +-to mark them with a form-feed character. ++Mark pagebreaks with the two-character sequence ``^L''. The default is ++to mark them with a formfeed character. + .TP +-.B \-c +-Do not attempt to trnaslate any characters (like the Scandinavion mode) +-except when running in tt-font. + .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 installer +-makes this decision when the program is installed.) ++This is probably the default outside of Scandinavia. (The SA made ++the decision when the program was installed.) + .TP +-.B \-bdelim +-Print the name of fonts when switching to it (and ending it). The delim +-argument is used to delimit the fontname. + .B \-s + Try to find the special Scandinavian characters that on most (?) + terminals in Scandinavia are mapped to ``{|}[\\]''. +@@ -139,7 +113,7 @@ + the pager to use. + .br + DVI2TTY \ \ \ \ \ \ \ \ \ \ \ +-can be set to hold command-line options. ++can be set to hold commandline options. + .SH "SEE ALSO" + TeX, dvi2ps + .SH AUTHOR +@@ -147,10 +121,11 @@ + .br + Improved C version: Marcel Mol + .br +-marcel@mesa.nl, MESA Consulting ++{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 command line. +- ++Only one file may be specified on the commandline. +diff -ur dvi2tty-5.3.1.orig/dvi2tty.c dvi2tty-5.3.1/dvi2tty.c +--- dvi2tty-5.3.1.orig/dvi2tty.c 2010-10-24 14:28:11.000000000 +0200 ++++ dvi2tty-5.3.1/dvi2tty.c 2010-02-23 13:42:05.000000000 +0100 +@@ -1,60 +1,18 @@ + /****************************************************************************** +- * Marcel Mol: 22jan2003 (Internet: marcel@mesa.nl) +- * From: jose@monkey.org: clearly state license (GPL). +- * Marcel Mol: 27may1996 (Internet: marcel@mesa.nl) +- * From: mlemos@ua.pt (Manuel Lemos): Port to AMIGA. +- * Marcel Mol: 24mar1996 (Internet: marcel@mesa.nl) +- * From: Alex Viskovatoff : Port to Macintosh +- * From: Anton vd Repe 1995-6-9 (UUCP: arp@neabbs.uucp): +- * Added option to skip translation of Scandinavian/Finnish +- * and skip the constraint to ASCII characters only. +- * Added option to include font name in output when new font +- * is chosen. +- * Limit line width of 132 expanded to 332. +- * Marcel Mol: 23jun1995 (Internet: marcel@duteca.et.tudelft.nl) +- * Included patch form Hideki ISOZAKI (isozaki@ntt-20.ntt.jp) +- * to allow japanese fonts generated by NTT JTeX (March 1992). +- * Added cleanups (protoize + includes) by D.U. Zoller +- * (1995-07-17 duz@roxi.rz.fht-mannheim.de) +- * Version 5.1 +- * Marcel Mol: 09sep1993 (Internet: marcel@duteca.et.tudelft.nl) +- * In dvistuff.c: added auto detection for 'ttfont'. +- * This make -t flag unneeded, but it is still left in for +- * people who like to force 'verbatim' mode. +- * Thanks to: Diomidis Spinellis +- * Marcel Mol: 05sep1993 (Internet: marcel@duteca.et.tudelft.nl) +- * In dvistuff.c: put some extra chars arround the 'ttfont' +- * flag in the 'normchar' function. +- * Marcel Mol: 01oct1991 (Internet: marcel@duteca.et.tudelft.nl) +- * (From Igor Romanenko, igor@d245.icyb.kiev.ua.) +- * Fixed unneccesary * in *envp++. +- * Marcel Mol: 24jul1991 (Internet: marcel@duteca.et.tudelft.nl) +- * Suggestion From: peter@julian.uwo.ca [uwo] +- * vertical bars "|" and the tilde "~" print properly in +- * typewriter font. +- * Marcel Mol: 1990-11-29 (UUCP: marcel@duteca.et.tudelft.nl) +- * Fixed bug in option handling. Cleanup of code. +- * Other minor changes/optimizations. +- * Marcel Mol: 1990-11-13 (UUCP: marcel@duteca.et.tudelft.nl) +- * Included patches of Bernard Gaulle in my version. +- * Version 4.4 +- * Bernard Gaulle: 1990-10-16 (gaulle@murnau.circe.fr) +- * Add -t option (assuming tt fonts were used) +- * (Version 3.3) +- * Marcel Mol: 1990-05-03 (UUCP: marcel@duteca.tudelft.nl) +- * Now displays accents etc. on characters again. Added option +- * (-a) to switch this off. If switched off it now uses proper +- * spacing. +- * Cleaned up and show version number in usage(); +- * Version 4.3 +- * Marcel Mol: 1990-05-02 (UUCP: marcel@duteca.tudelft.nl) +- * Included patches for VAX/VMS VAXC, done by Robert Schneider. +- * Version 4.2 ++ * dvitty - get an ascii representation of a dvi-file, suitable for ttys ++ ++This program was originally written in Pascal by ++Svante Lindahl ++and then converted to C by Marcel Mol . ++Some changes have been made for TeX Live (see ./ChangeLog). ++ ++It is released under the GNU GPL, version 2 or any later version. ++(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=424018) ++ + * 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). +- * Version 4.1 + * 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 +@@ -84,9 +42,9 @@ + * Fixed a bugs concerning pager programs + * and scanning environment variable DVI2TTY. + * Marcel Mol: 1988-10-25 (UUCP: duteca!marcel) +- * Renamed to dvi2tty and converted to C. +- * Filenames: dvi2tty.c dvi2tty.h dvistuff.c commands.h +- * Improved spacing between words/characters. ++ * 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: +@@ -94,6 +52,24 @@ + * 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' & +@@ -117,58 +93,14 @@ + * VERA::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. +- * +- * +- * 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 + */ + + +-/* +- * dvi2tty +- * Copyright (C) 2003 Marcel J.E. Mol +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version 2 +- * of the License, or (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +- * +- */ +- +-/* +- * Include files +- */ +- + #include "dvi2tty.h" + #if defined(VMS) +-# include unixio ++#include unixio + #endif +-#if defined(THINK_C) +-# include +-# include "macintosh.h" +-#endif +- + +- +-/* +- * Constant definitons +- */ + /*-----------------------------------------------------------------------*/ + /* The following constants may be toggled before compilation to */ + /* customize the default behaviour of the program for your site. */ +diff -ur dvi2tty-5.3.1.orig/dvi2tty.h dvi2tty-5.3.1/dvi2tty.h +--- dvi2tty-5.3.1.orig/dvi2tty.h 2010-10-24 14:29:23.000000000 +0200 ++++ dvi2tty-5.3.1/dvi2tty.h 2010-02-23 13:41:58.000000000 +0100 +@@ -1,25 +1,5 @@ +-/* +- * dvi2tty +- * Copyright (C) 2003 Marcel J.E. Mol +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version 2 +- * of the License, or (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +- * +- */ +- +-#define Copyright "dvi2tty Copyright (C) 1984, 1985, 1986 Svante Lindahl.\n\ +-Copyright (C) 1989-1996 M.J.E. Mol" ++#define Copyright "dvi2tty.c Copyright (C) 1984, 1985, 1986 Svante Lindahl.\n\ ++Copyright (C) 1988 M.J.E. Mol 1989, 1990" + + #include + #include +diff -ur dvi2tty-5.3.1.orig/dvistuff.c dvi2tty-5.3.1/dvistuff.c +--- dvi2tty-5.3.1.orig/dvistuff.c 2010-10-24 15:01:30.000000000 +0200 ++++ dvi2tty-5.3.1/dvistuff.c 2009-09-01 14:14:47.000000000 +0200 +@@ -1,26 +1,3 @@ +-/* +- * dvi2tty +- * Copyright (C) 2003 Marcel J.E. Mol +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version 2 +- * of the License, or (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +- * +- */ +- +-/* +- * Include files +- */ + + #include "dvi2tty.h" + #include +@@ -34,12 +11,6 @@ + #endif + #include "commands.h" + +- +- +-/* +- * Constant definitions +- */ +- + #if defined(VMS) + #define mseek vmsseek + #define ROUND(a) (a>=0.0 ? (int) (a + 0.5) : (int) (a - 0.5) ) +@@ -78,16 +49,12 @@ + #define sget3() snum(3) + #define sget4() snum(4) + +- +- +-/* +- * Structure and variable definitions +- */ +- + #if 0 +-char *dvistuff = "@(#) dvistuff.c 5.12 27may1996 M.J.E. Mol (c) 1989-1996"; ++char *dvistuff = "@(#) dvistuff.c 4.1 27/03/90 M.J.E. Mol (c) 1989, 1990"; + #endif + ++/*---------------------------------------------------------------------------*/ ++ + typedef struct { + long hh; + long vv; +@@ -112,6 +79,7 @@ + } font; + + ++/*---------------------------------------------------------------------------*/ + + bool pageswitchon; /* true if user-set pages to print */ + bool sequenceon; /* false if pagesw-nrs refers to TeX-nrs */ +@@ -142,11 +110,7 @@ + font * fonts = NULL; /* List of fontnames defined */ + int symbolfont = FALSE; /* true if font is a symbol font */ + +- +- +-/* +- * Function definitions +- */ ++/*---------------------------------------------------------------------------*/ + + #if defined(KPATHSEA) || defined(MSDOS) + void postamble (void); +@@ -205,51 +169,41 @@ + #endif + #endif + +- ++/*---------------------------------------------------------------------------*/ ++/*---------------------------------------------------------------------------*/ + + /* +- * DVIMAIN -- 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. ++ * 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(void) + { + + postamble(); /* seek and process the postamble */ +- preamble(); /* process preamble */ + /* note that walkpages *must* immediately follow preamble */ ++ preamble(); /* process preamble */ + walkpages(); /* time to do the actual work! */ + +-- return; +-- + } /* dvimain */ + ++/*---------------------------------------------------------------------------*/ + +- /* +- * POSTAMBLE -- Find and process postamble, use random access +- */ +- +-void postamble(void) ++void postamble(void) /* find and process postamble, use random access */ + { + register long size; + register int count; +-#if !defined (THINK_C) + struct stat st; +-#endif + +-#if defined (THINK_C) +- size = DVIfile->len; +-#else + fstat (fileno(DVIfile), &st); + size = (long) st.st_size; /* get size of file */ +-#endif +- + count = -1; + do { /* back file up past signature bytes (223), to id-byte */ +- if (size-- == 0) ++ if (size == 0) + errorexit(nopst); ++ size--; + mseek(DVIfile, size, absolute); + opcode = (int) get1(); + count++; +@@ -261,7 +215,7 @@ + if (opcode != VERSIONID) + errorexit(badid); + mseek(DVIfile, size-4, absolute); /* back up to back-pointer */ +- mseek(DVIfile, sget4(), absolute); /* and to start of postamble */ ++ mseek(DVIfile, sget4(), absolute); /* and to start of postamble */ + if (get1() != POST) + errorexit(nopst); + mseek(DVIfile, 20L, relative); /* lastpageoffset, numerator, denominator */ +@@ -275,17 +229,11 @@ + /* get2() -- totalpages */ + /* fontdefs do fontdefs in flight ... */ + +- return; +- + } /* postamble */ + ++/*---------------------------------------------------------------------------*/ + +- +-/* +- * PREAMBLE --process preamble, use random access +- */ +- +-void preamble(void) ++void preamble(void) /* process preamble, use random access */ + { + + mseek(DVIfile, 0L, absolute); /* read the dvifile from the start */ +@@ -297,17 +245,11 @@ + mseek(DVIfile, 12L, relative); /* numerator, denominator, magnification */ + mseek(DVIfile, get1(), relative); /* skip job identification */ + +- return; +- + } /* preamble */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * WALKPAGES -- process the pages in the DVI-file +- */ +- +-void walkpages(void) ++void walkpages(void) /* process the pages in the DVI-file */ + { + register bool wantpage; + +@@ -339,15 +281,9 @@ + } + } + +- return; +- + } /* walkpages */ + +- +- +-/* +- * INITPAGE -- Setup a new, empty page. +- */ ++/*---------------------------------------------------------------------------*/ + + void initpage(void) + { +@@ -361,7 +297,8 @@ + lastline = currentline; + firstcolumn = rightmargin; + if (pageswitchon) { +- if ((sequenceon ? pagecounter : pagenr) != firstpage->pag) { ++ if ((sequenceon && (pagecounter != firstpage->pag)) || ++ (!sequenceon && (pagenr != firstpage->pag))) { + if (noffd) + fprintf(output, "^L\n"); + else +@@ -369,23 +306,16 @@ + } + } + else +- if (backpointer != -1) { /* not FORM at first page */ ++ if (backpointer != -1) { /* not FORM at first page */ + if (noffd) + fprintf(output, "^L\n"); + else + putc(FORM, output); + } + +- return; +- + } /* initpage */ + +- +- +-/* +- * DOPAGE -- Process the dvi file until an end-off-page. +- * Build up a page image. +- */ ++/*----------------------------------------------------------------------------*/ + + void dopage(void) + { +@@ -426,8 +356,9 @@ + stack[sptr].zz = z; + sptr++; + break; +- case POP : if (sptr-- == 0) /* pop */ ++ case POP : if (sptr == 0) /* pop */ + errorexit(stkuf); ++ sptr--; + h = stack[sptr].hh; + v = stack[sptr].vv; + w = stack[sptr].ww; +@@ -483,18 +414,11 @@ + } + } + +- return; +- + } /* dopage */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * SKIPPAGE -- Scan the dvi file until an end-off-page. +- * Skip this page. +- */ +- +-void skippage(void) ++void skippage(void) /* skip past one page */ + { + register int opcode; + +@@ -556,17 +480,11 @@ + } + } + +- return; +- + } /* skippage */ + ++/*---------------------------------------------------------------------------*/ + +- +-/* +- * PRINTPAGE -- 'end of page', writes lines of page to output file +- */ +- +-void printpage(void) ++void printpage(void) /* 'end of page', writes lines of page to output file */ + { + register int i, j; + register unsigned char ch; +@@ -607,17 +525,11 @@ + free(currentline); /* free last line */ + currentline = nil; + +- return; +- + } /* printpage */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * INLIST -- return true if pagenr is in the list of pages to be printed. +- */ +- +-bool inlist(long pagenr) ++bool inlist(register long pagenr) /* ret true if in list of pages */ + { + + while ((currentpage->pag < 0) && (currentpage->pag != pagenr) && +@@ -632,20 +544,14 @@ + if (currentpage->pag == pagenr) + return TRUE; + } +- + return FALSE; + + } /* inlist */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * RULE -- Output a rule (vertical or horizontal). +- * Increment h if moving is true. +- */ +- + 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; +@@ -668,17 +574,11 @@ + if (!moving) + h = saveh; + +- return; +- + } /* rule */ + + + +-/* +- * RULEAUX -- do the actual outtput for the rule recursively. +- */ +- +-void ruleaux(long rulewt, long ruleht, char ch) ++void ruleaux(long rulewt, long ruleht, char ch) /* recursive that does the job */ + { + register long wt, lmh, rmh; + +@@ -702,21 +602,15 @@ + h = rmh; /* restore right margin */ + } + +- return; +- + } /* ruleaux */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * HORIZONTALMOVE -- Move the h pointer by amount. +- */ +- +-long horizontalmove(long amount) ++long horizontalmove(register long amount) + { + +-#if defined(MSDOS) || defined(THINK_C) +- if (labs(amount) > charwidth / 4L) { /* } to make vi happy */ ++#if defined(MSDOS) ++ if (labs(amount) > charwidth / 4L) { + #else + if (abs(amount) > charwidth / 4L) { + #endif +@@ -737,29 +631,20 @@ + + } /* horizontalmove */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * SKIPNOPS -- Return first non NOP opcode. +- */ +- +-int skipnops(void) ++int skipnops(void) /* skips by no-op commands */ + { + register int opcode; + + while ((opcode = (int) num(1)) == NOP); +- + return opcode; + + } /* skipnops */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * GETLINE -- Returns an initialized line-object +- */ +- +-linetype *texlive_getline(void) ++linetype *texlive_getline(void) /* returns an initialized line-object */ + { + register int i; + register linetype *temp; +@@ -772,20 +657,14 @@ + for (i = 0; i < LINELEN; i++) + temp->text[i] = ' '; + temp->text[i] = '\0'; +- + return temp; + + } /* texlive_getline */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * FINDLINE -- Find best fit line were text should go +- * and generate new line if needed. +- */ +- +-linetype *findline(void) +-{ ++linetype *findline(void) /* find best fit line were text should go */ ++{ /* and generate new line if needed */ + register linetype *temp; + register long topd, botd; + +@@ -832,35 +711,25 @@ + temp->next->prev = currentline; + temp->next = currentline; + currentline->vv = v; +- + return currentline; + + } /* findline */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * NUM -- +- */ +- +-unsigned long num(int size) ++unsigned long num(register int size) + { + register int i; +- register unsigned long x = 0; ++ register long x = 0; + +- for (i = size; i > 0; i--) ++ for (i = 0; i < size; i++) + x = (x << 8) + (unsigned) getc(DVIfile); +- + return x; + + } /* num */ + + +-/* +- * SNUM -- +- */ +- +-long snum(int size) ++long snum(register int size) + { + register int i; + register long x = 0; +@@ -868,18 +737,13 @@ + x = getc(DVIfile); + if (x & 0x80) + x -= 0x100; +- for (i = size - 1; i > 0; i--) ++ for (i = 1; i < size; i++) + x = (x << 8) + (unsigned) getc(DVIfile); +- + return x; + + } /* snum */ + +- +- +-/* +- * DOCHAR -- Process a character opcode. +- */ ++/*----------------------------------------------------------------------------*/ + + void dochar(char ch) + { +@@ -895,11 +759,7 @@ + + + +-/* +- * SYMCHAR -- Process a character opcode for a symbol font. +- */ +- +-void symchar(char ch) ++void symchar(char ch) /* output ch to appropriate line */ + { + + switch (ch) { /* can do a lot more on MSDOS machines ... */ +@@ -918,7 +778,6 @@ + case 106: ch = '|'; break; + case 110: ch = '\\'; break; + } +- + outchar(ch); + + return; +@@ -927,10 +786,6 @@ + + + +-/* +- * NORMCHAR -- Process a character opcode for a normal font. +- */ +- + void normchar(char ch) + { + +@@ -992,18 +847,11 @@ + + return; + +-} /* normchar */ +- ++} /*normchar */ + + +-/* +- * OUTCHAR -- Here we put the character into the current page. +- * This function includes some code to handle Scandinavian +- * characters. I think that code doesn't belong here. IT +- * SHOULD BE MOVED OUT. +- */ + +-void outchar(unsigned char ch) ++void outchar(unsigned char ch) /* output ch to appropriate line */ + { + register int i, j; + +@@ -1024,7 +872,6 @@ + else if (j < leftmargin) + j = leftmargin; + foo = leftmargin - 1; +- + /* + * This code does not really belong here ... + * +@@ -1095,17 +942,11 @@ + h += charwidth; + } + +- return; +- + } /* outchar */ + ++/*----------------------------------------------------------------------------*/ + +- +-/* +- * PUTCHARACTER -- Output character, don't change h +- */ +- +-void putcharacter(long charnr) ++void putcharacter(register long charnr) /* output character, don't change h */ + { + register long saveh; + +@@ -1116,34 +957,23 @@ + setchar(charnr); + h = saveh; + +- return; +- + } /* putcharacter */ + +- +- +-/* +- * SETCHAR -- Should print characters with character code>127 from +- * current font. Note that the parameter is a dummy, since +- * ascii-chars are<=127. +- */ ++/*----------------------------------------------------------------------------*/ + + void setchar(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)); + +- return; +- + } /* setchar */ + + ++/*----------------------------------------------------------------------------*/ + +-/* +- * FONTDEF -- Process a font definition. +- */ + +-void fontdef(int x) ++void fontdef(register int x) + { + register int i; + char * name; +@@ -1177,7 +1007,7 @@ + + for (i = 0; i < namelen; i++) + name[i] = get1(); +- name[i] = '\0'; /* required */ ++ name[namelen] = '\0'; + fnt->name = name; + if (new) { + fnt->next = fonts; +@@ -1190,13 +1020,6 @@ + + + +-/* +- * SETFONT -- Switch to specific font. Try to find out if it is a symbol +- * font. +- * Option -c allchar does not pertain to this portion, so symbols +- * are still translated. +- */ +- + void setfont(long fntnum) + { + font * fnt; +@@ -1227,9 +1050,8 @@ + + + +-/* +- * VMS CODE +- */ ++/*----------------------------------------------------------------------------*/ ++ + + #if defined(VMS) + long vmsseek(FILE *fp, long n, long dir) +@@ -1237,9 +1059,9 @@ + long k,m,pos,val,oldpos; + struct stat buffer; + +- for (;;) { /* loops only once or twice */ ++ for (;;) { /*loops only once or twice*/ + switch (dir) { +- case 0: /* from BOF */ ++ case 0: /*from BOF*/ + oldpos = vms_ftell(fp); + k = n & 511; + m = n >> 9; +@@ -1278,8 +1100,6 @@ + } + } + +- /* NOTREACHED */ +- + } /* vmsseek */ + + +@@ -1289,7 +1109,6 @@ + char c; + long pos; + long val; +- + if ((*fp)->_cnt == 0) { + c = fgetc(fp); + val = vms_ungetc(c, fp); +@@ -1299,7 +1118,6 @@ + pos = ftell(fp); + if (pos >= 0) + pos += ((*fp)->_ptr) - ((*fp)->_base); +- + return (pos); + + } /* vms_ftell */ +@@ -1308,18 +1126,16 @@ + + long vms_ungetc(char c, FILE *fp) + { +- + if ((c == EOF) && feof(fp)) + return (EOF); +- +- if ((*fp)->_cnt >= 512) ++ else if ((*fp)->_cnt >= 512) + return (EOF); +- +- (*fp)->_cnt++; +- (*fp)->_ptr--; +- *((*fp)->_ptr) = c; +- +- return (c); ++ else { ++ (*fp)->_cnt++; ++ (*fp)->_ptr--; ++ *((*fp)->_ptr) = c; ++ return (c); ++ } + + } /*vms_ungetc */ + #endif diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/COPYING b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/COPYING new file mode 100644 index 00000000000..520e7de1d76 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/COPYING @@ -0,0 +1,343 @@ +dvi2tty +Copyright (C) 1989-2003 many, including Marcel J.E. Mol + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/DVI.format b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/DVI.format new file mode 100644 index 00000000000..4ce5d3936a3 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/DVI.format @@ -0,0 +1,102 @@ +/* + + +================================================================================ +== 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) + + + +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. + + +-Marcel Mol + + +*/ + +From: schrod@iti.informatik.th-darmstadt.de (Joachim Schrod) +Date: 2 Jan 92 18:26:27 GMT + +Since this question comes up often, I post the answer: + +The following file format definitions are part of the TUG DVI Driver +Standards Draft: + DVI + GF + PK + TFM +You can ftp them from ftp.th-darmstadt.de, directory +pub/tex/dvi-standard/standards. + +Take either draft-0.05a.tar.Z (the complete standard) or +.tex+fileform.sty where you have to replace by dvi, gf, +etc. + In the latter case -- when you fetch single files -- you'll need +to add a LaTeX standard frame (\documentstyle{article} + +\begin{document} + \end{document}) to get a full, LaTeXable document. + +-- +Joachim + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Joachim Schrod Email: schrod@iti.informatik.th-darmstadt.de +Secretary of TUG DVI Driver Standards Committee + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/Makefile b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/Makefile new file mode 100644 index 00000000000..e1635eaccf7 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/Makefile @@ -0,0 +1,40 @@ +# Makefile for dvi2tty and disdvi 23/01/89 M.J.E. Mol +# +# 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. +# +CC = gcc + +CFLAGS = -Wall -O2 +# CFLAGS = -Wall -O2 -fomit-frame-pointer +LDFLAGS = -s + +prefix = /usr/local +mandir = $(prefix)/man/man1 +bindir = $(prefix)/bin + + +all: dvi2tty disdvi + +dvi2tty:dvi2tty.o dvistuff.o + $(CC) $(LFLAGS) -o dvi2tty dvi2tty.o dvistuff.o + +disdvi:disdvi.o + $(CC) $(LFLAGS) -o disdvi disdvi.o + +dvi2tty.o: dvi2tty.c dvi2tty.h + +dvistuff.o: dvistuff.c dvi2tty.h commands.h + +disdvi.o: disdvi.c commands.h + +clean: + rm -f dvi2tty disdvi *.o + +install: all + install dvi2tty disdvi $(bindir) + install dvi2tty.1 $(mandir) + install disdvi.1 $(mandir) diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README new file mode 100644 index 00000000000..b0dbc964fdb --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README @@ -0,0 +1,57 @@ + DVI2TTY + + +dvi2tty is intended for previewing dvi-files on text-only +devices (terminals and lineprinters). +The program is basically 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). + + + 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 + +When set, just type: + + make + +to build disdvi and dvi2tty + +dvi2tty is licensed under the GPL version 2. It has had a history of many +authors, I am just one of the latest maintainers. + +Thats all, good luck. + + +- Marcel +######################################### +# Marcel J.E. Mol # +# # +# MESA Consulting +31-(0)6-54724868 # +# email: marcel@mesa.nl # +# The Netherlands # +# # +######################################### diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.MAC b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.MAC new file mode 100644 index 00000000000..2aa17b3055b --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.MAC @@ -0,0 +1,11 @@ +Macintosh port for THINK_C + +Done by Alex Viskovatoff + +Guess the Makefile (if it is used by Think C) +must be changed a bit to include the UNIXtoMacLib/ +for include files and some supporting functions. + +Cannot test this.. + +-Marcel Mol diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.ORG b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.ORG new file mode 100644 index 00000000000..9f8b337b16a --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.ORG @@ -0,0 +1,23 @@ + +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 +tex-k@tug.org, since this is a modified version of the original, written +by +Svante Lindahl, NADA, KTH Numerical Analysis & Computer Science + Royal Institute of Technology, Sweden diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.VMS b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.VMS new file mode 100644 index 00000000000..1d07f22389c --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/README.VMS @@ -0,0 +1,38 @@ +README file for using dvi2tty on VAX/VMS using VAXC +Created and submitted as a saveset by: + + Robert Schneider Internet: robert@perv.pe.utexas.edu + Department of Petroleum Engineering BITNET: pefv673@utchpc + University of Texas at Austin THEnet: PERV::ROBERT + + Marcel Mol +---------------------------------- + +dvi2tty for VAX/VMS + + +This is a version of dvi2tty for VAX/VMS which may be compiled with VAXC +and used as a filter for converting the device independent output files +produced by TeX to files which may be printed on ASCII terminals or line +printers. The original version of dvi2tty was written by Svante Lindahl. +The improved C version of dvi2tty on which this port was based was done +by Marcel Mol. Only a few minor modifications were necessary to make +dvi2tty work under VMS with VAXC. Please see the file README. for further +information on the authors and capabilities of dvi2tty. + +This saveset includes all sources which are necessary to compile and +link dvi2tty under VMS using VAXC. Also included in the saveset are object +files and images generated from these sources. The command file for +building dvi2tty under VMS and the TeX documentation file for dvi2tty were +done at The University of Texas at Austin. The TeX documentation file +was derived from the Unix man page by tr2tex and then converted to match +local documentation styles. Please see the "NOTE ---" comments in the +documentation file to make the appropriate modifications for your site. + +If you need to rebuild the images used, simply execute VMS_VAXC_DVI2TTY.COM. + + +Robert Schneider + + + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/TODO b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/TODO new file mode 100644 index 00000000000..56b7facaad0 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/TODO @@ -0,0 +1,50 @@ +Date: Mon, 9 Mar 92 02:34:22 -0500 +From: rosen@cns.bu.edu (David B. Rosen) +Subject: suggestion for dvi2tty + +Would it be difficult to have an option where enough blanks would be +inserted between words to make the right edge of a line of text appear +where it should? This would be wonderful for justified text. In +other words, wherever there is a line or string of text, would it be +possible to calculate the correct position of the rightmost character, +and justify the line so that both the leftmost and rightmost +characters are correctly positioned, even if some intermediate +characters are not? + +----------------------------------------------------------------------------- + +Redo font handling. + Bit of spagetti now. Japanes, scandinavian, finxed fonts, symbols, math + etc. Is a commandline option necessary for selecting japan? Selecting based + font jfontnum should do it, doesn't it? + +----------------------------------------------------------------------------- + +For character handling 'char' might not be a good type. May need to +change it to 'unsigned char' or 'int'. + +----------------------------------------------------------------------------- + +Date: Mon, 29 Jan 96 15:36:31 MET +From: Erick Branderhorst + +% Mocht je nog eens naar dvi2tty kijken zou je dan wellicht iets aan dit +% soort tabular rariteiten kunnen doen? Een optie misschien waarmee alle +% tabular info wordt weggevaagd? Of bestaat zoiets reeds. + +\documentclass{article} + +\begin{document} +\begin{tabular}[h]{|c||c||c|c||} +\hline +-11.1 & -22.2 & -33.3 & -44.4 \\ +\hline +\end{tabular} +\end{document} + +% Output via dvi2tty versie 5.1 +% +% ____________________________ +% |_-11.1_|-|22.2-|3|3.3-|44.4_| | +% + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/getopt.c b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/getopt.c new file mode 100644 index 00000000000..a0db51e2520 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/getopt.c @@ -0,0 +1,124 @@ +/* getopt.c + * Modified slightly to port to Think C by AV 4.5.1993. + */ + +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include "getopt.h" + +/* + * get option letter from argument vector + */ +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt; /* character checked for validity */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define EMSG "" + +int +getopt(nargc, nargv, ostr) + int nargc; + char * const *nargv; + const char *ostr; +{ + static char *place = EMSG; /* option letter processing */ + register char *oli; /* option letter list index */ + char *p; + if (!*place) { /* update scanning pointer */ + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return(EOF); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return(EOF); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = index(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means EOF. + */ + if (optopt == (int)'-') + return(EOF); + if (!*place) + ++optind; + if (opterr) { + if (!(p = rindex(*nargv, '/'))) + p = *nargv; + else + ++p; + (void)fprintf(stderr, "%s: illegal option -- %c\n", + p, optopt); + } + return(BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (!(p = rindex(*nargv, '/'))) + p = *nargv; + else + ++p; + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + p, optopt); + return(BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return(optopt); /* dump back option letter */ +} diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/macintosh.h b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/macintosh.h new file mode 100644 index 00000000000..24843f507c7 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/macintosh.h @@ -0,0 +1,34 @@ +/* macintosh.h 24.2.1996 Alex Viskovatoff + * + * Header file accompanying unix-to-macintosh.c. + * + * Written and copyright (c) 1996 by Alex Viskovatoff. + * Permission is granted to distribute and modify this file. + */ + + +#define PATHNAME_LENGTH 256 + +#define isascii(c) (((unsigned) c) <= 0x7f) + + +/* "DVI2ODVI" is equivalent to an arry of static unsigned long + initialized to {'DVI2', 'ODVI'} - Textures and OzTeX + type signatures of dvi files, respectively. */ + +#define process_dvi_command_line(args) \ + docommand(args,0L,2,(unsigned long*)"DVI2ODVI") + +int docommand(char ***,void*,int,unsigned long*); +void set_creator(const unsigned char *outfilename); +int getopt(int nargc, char * const *nargv, const char *ostr); +char *get_home_dir(void); +char *get_file_from_dialog(void); +pascal unsigned char not_rtf_file_p(void *parms); + + +/* The following are defined in getopt.c */ + +#define index strchr +#define rindex strrchr +int getopt(int nargc, char * const *nargv, const char *ostr); diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/unix-to-macintosh.c b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/unix-to-macintosh.c new file mode 100644 index 00000000000..f29b0334256 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/UNIXtoMacLib/unix-to-macintosh.c @@ -0,0 +1,460 @@ +/* unix-to-macintosh.c 24.2.1996 + + * Macintosh THINK-C file system and user interface + * library for use by dvi2tty, disdvi, and rtf2LaTeX. + * + * Written and copyright (c) 1996 by Alex Viskovatoff + * (av@mixcom.com). Permission is granted to distribute + * and modify this file. + */ + +#include +#include +#include "macintosh.h" + + +static char home_pathname_buf[PATHNAME_LENGTH]; + +static char *make_pathname(char *q,long dir_id, int vol_num) +{ + CInfoPBRec directory; + Str31 dir_name; + int n; + directory.dirInfo.ioDrDirID = dir_id; + directory.dirInfo.ioVRefNum = vol_num; + directory.dirInfo.ioFDirIndex = -1; + directory.dirInfo.ioNamePtr = dir_name; + for (;;directory.dirInfo.ioDrDirID = directory.dirInfo.ioDrParID) { + *q-- = ':'; + PBGetCatInfoSync(&directory); + for (n=*dir_name; n; n--) *q-- = (char) dir_name[n]; + if (directory.dirInfo.ioDrDirID == 2) break; + } + return q+1; +} + +char *get_home_dir() +{ + FCBPBRec home_dir; + Str31 dir_name; + Str31 apName; + int pathRefNum; + Handle apParam; + char *p = home_pathname_buf+PATHNAME_LENGTH-1; + GetAppParms(&apName,&pathRefNum,&apParam); + home_dir.ioRefNum = pathRefNum; + home_dir.ioFCBIndx = 0; + home_dir.ioNamePtr = dir_name; + PBGetFCBInfoSync(&home_dir); + *p-- = 0; + return make_pathname(p,home_dir.ioFCBParID,home_dir.ioFCBVRefNum); +} + +pascal unsigned char not_rtf_file_p(void *parms) +{ + StringPtr name = ((IOParam*)parms)->ioNamePtr; + char *p, *q; + static char extension[] = ".rtf"; + int i; + if (name[0] < 5) return TRUE; + for (i=4, p = (char*) name + name[0] - 3, q=extension; i; i--) + if (*p++ != *q++) return TRUE; + return FALSE; +} + +void set_creator(const unsigned char *outfilename) +{ + FInfo finfo; + Str255 filename; + StringHandle h; + strcpy((char*)filename,(char*)outfilename); + CtoPstr(filename); + if (!GetFInfo(filename,0,&finfo)) { + finfo.fdCreator = *((OSType*)*(h=GetString(128))); + ReleaseResource(h); + SetFInfo(filename,0,&finfo); + } +} + + + +/* The rest of file is a modification of the file ccomand.c (part of + * Think C 5.0), with the function ccommand renamed to "docommand", + * and changed to take three more arguments: a filter procedure to use + * when displaying files in the open input file dialog, the length of + * a list of signatures of file types that should be displayed in that + * dialog, and a pointer to this list. Furthermore, the file creator + * signature for the output file, which is of type 'TEXT', is now set + * by a call to the new function set_creator. The signature is stored + * as a string resource, and so can be modified by means of ResEdit. + * (In the distribution, the signature used is '*TEX', that of Textures.) + */ + + +/* + * ccommand.c + * + * Copyright (c) 1991 Symantec Corporation. All rights reserved. + * + * This routine should be called from "main" as follows: + * + * main(int argc, char **argv) + * { + * argc = ccommand(&argv); + * ... + * + * A dialog is presented allowing entry of command line arguments + * and redirection of stdin/stdout. + * + */ + +#include + +#include "stdlib.h" +#include "errno.h" +#include "console.h" +#include "ansi_private.h" + +#define NARGS 25 + +static char *argv[NARGS+1]; +static char argbuf[256]; + +static void create_dialog(void); +static Handle ditem(int); +static void radio(int, int, int); +static pascal void drawRing(DialogPtr, short); + +static Point getWhere = { 90, 82 }; +static Point putWhere = { 106, 104 }; + +static void setfile(char *, SFReply *); + +static void init_command_line(char *, char *); +static int parse(char *, char *); + +enum { + cmdLine = 3, + inCon, inFile, + outCon, outFile, outEcho, outPrint, + okRing, + labelIn, labelOut, labelLine +}; + +static struct { + short count; + struct { + Handle h; + Rect box; + char kind; + } item[13]; +} itemList = { 12, + + /* OK */ + 0, { 176, 115, 196, 175 }, ctrlItem+btnCtrl, + + /* Cancel */ + 0, { 176, 225, 196, 285 }, ctrlItem+btnCtrl, + + /* command line */ + 0, { 141, 34, 157, 376 }, editText+itemDisable, + + /* (stdin) console */ + 0, { 34, 30, 50, 180 }, ctrlItem+radCtrl, + + /* (stdin) file */ + 0, { 54, 30, 70, 180 }, ctrlItem+radCtrl, + + /* (stdout) console */ + 0, { 34, 230, 50, 380 }, ctrlItem+radCtrl, + + /* (stdout) file */ + 0, { 54, 230, 70, 380 }, ctrlItem+radCtrl, + + /* (stdout) console+file */ + 0, { 74, 230, 90, 380 }, ctrlItem+radCtrl, + + /* (stdout) console+printer */ + 0, { 94, 230, 110, 380 }, ctrlItem+radCtrl, + + /* ring around OK button */ + (Handle) drawRing, { 172, 111, 200, 179 }, userItem+itemDisable, + + /* "Standard Input:" */ + 0, { 10, 20, 26, 170 }, statText+itemDisable, + + /* "Standard Output:" */ + 0, { 10, 220, 26, 370 }, statText+itemDisable, + + /* "Command Line:" */ + 0, { 114, 20, 130, 170 }, statText+itemDisable, +}; + +static DialogPtr dp; +static Rect bounds = { 60, 51, 270, 461 }; +static int inChoice = inCon, outChoice = outCon; + + +/* + * ccommand - process "command line" + * + */ + +int +docommand(char ***av, ProcPtr file_filter, int num_types, SFTypeList type_list) +{ + short i, argc; + SFReply input, output, scratch; + char buf[256]; + + /* present dialog */ + + cshow(stdin); + create_dialog(); + init_command_line(buf, argbuf); + SetCtlValue(ditem(inCon), 1); + SetCtlValue(ditem(outCon), 1); + ShowWindow(dp); + + /* engage in dialog */ + + do { + ModalDialog(0, &i); + switch (i) { + case cancel: + abort(); + case inFile: + SFGetFile(getWhere, "", file_filter, num_types, type_list, NULL, &scratch); + if (!scratch.good) + break; + input = scratch; + /* ... */ + case inCon: + radio(inChoice = i, inCon, 2); + break; + case outFile: + case outEcho: + SFPutFile(putWhere, "", "", NULL, &scratch); + if (!scratch.good) + break; + output = scratch; + /* ... */ + case outCon: + case outPrint: + radio(outChoice = i, outCon, 4); + break; + } + } while (i != ok); + + /* parse command line */ + + GetIText(ditem(cmdLine), argbuf); + sprintf(buf, "%#s", argbuf); + argc = parse(buf, argbuf); + *av = argv; + DisposDialog(dp); + + /* redirect stdout */ + + if (outChoice == outPrint) + cecho2printer(stdout); + else if (outChoice != outCon) { + setfile((char *) scratch.fName, &output); + if (outChoice == outFile) + freopen((char *) scratch.fName, "w", stdout); + else cecho2file((char *) scratch.fName, 0, stdout); + set_creator(scratch.fName); /*** Added by av ***/ + } + + /* redirect stdin */ + + if (inChoice == inFile) { + setfile((char *) scratch.fName, &input); + freopen((char *) scratch.fName, "r", stdin); + } + + /* done */ + + errno = 0; + return(argc); +} + + +/* ---------- dialog utilities ---------- */ + + +/* + * create_dialog - build dialog in memory + * + */ + +static void +create_dialog(void) +{ + Handle items; + + asm { + lea itemList,a0 + move.l #sizeof itemList,d0 + _PtrToHand + move.l a0,items + } + dp = NewDialog(0, &bounds, "", 0, 1, (Ptr) -1, 0, 0, items); + SetCTitle(ditem(ok), "\pOK"); + SetCTitle(ditem(cancel), "\pCancel"); + SetCTitle(ditem(inCon), "\pconsole"); + SetCTitle(ditem(inFile), "\pfile"); + SetCTitle(ditem(outCon), "\pconsole"); + SetCTitle(ditem(outFile), "\pfile"); + SetCTitle(ditem(outEcho), "\pconsole+file"); + SetCTitle(ditem(outPrint), "\pconsole+printer"); + SetIText(ditem(labelIn), "\pStandard Input:"); + SetIText(ditem(labelOut), "\pStandard Output:"); + SetIText(ditem(labelLine), "\pCommand Line:"); +} + + +/* + * ditem - return item handle + * + */ + +static Handle +ditem(int i) +{ + short kind; + Handle item; + Rect box; + + GetDItem(dp, i, &kind, &item, &box); + return(item); +} + + +/* + * radio - adjust a cluster of radio buttons + * + */ + +static void +radio(int i, int j, int n) +{ + for (; n--; j++) + SetCtlValue(ditem(j), i == j); +} + + +/* + * drawRing - (user-item proc) draw ring around OK button + * + */ + +static pascal void +drawRing(DialogPtr dp, short i) +{ + PenNormal(); + PenSize(3, 3); + FrameRoundRect(&itemList.item[okRing-1].box, 16, 16); + PenNormal(); +} + + +/* ---------- file utilities ---------- */ + + +/* + * setfile - prepare to open file + * + */ + +static void +setfile(char *buf, SFReply *reply) +{ + IOParam pb; + + pb.ioNamePtr = 0; + pb.ioVRefNum = reply->vRefNum; + PBSetVolSync(&pb); + sprintf(buf, "%#s", reply->fName); +} + + +/* ---------- string utilities ---------- */ + + +/* + * init_command_line - prepare initial command line + * + * The command line is preset to show the name of the program. + * The program name is quoted as necessary. + * + */ + +static void +init_command_line(char *buf1, char *buf2) +{ + register char *s, *t = buf2; + int c, space = 0, dquote = 0, squote = 0, quote = 0; + + sprintf(s = buf1, "%#s", CurApName); + while (c = *s++) { + if (c == ' ') + space = 1; + else if (c == '"') + dquote = 1; + else if (c == '\'') + squote = 1; + } + if (space || dquote || squote) + *t++ = quote = dquote && !squote ? '\'' : '"'; + for (s = buf1; c = *s++; *t++ = c) { + if (c == quote || c == '\\') + *t++ = '\\'; + } + if (quote) + *t++ = quote; + *t++ = ' '; + *t++ = 0; + SetIText(ditem(cmdLine), __c2p(buf2, buf1)); + SelIText(dp, cmdLine, 9999, 9999); +} + + +/* + * parse - divide command line into "words" + * + * Words are delimited by one or more spaces. Any characters within + * matching single (') or double (") quotes are taken literally. Any + * character preceded by a backslash (\) is taken literally. + * + */ + +static int +parse(char *s, char *t) +{ + int c, quote = 0, argc = 0; + + while (c = *s++) { + if (c == ' ') + continue; + if (argc < NARGS) + argv[argc++] = t; + do { + if (c == '\\' && *s) + c = *s++; + else if (c == '"' || c == '\'') { + if (!quote) { + quote = c; + continue; + } + if (c == quote) { + quote = 0; + continue; + } + } + *t++ = c; + } while (*s && ((c = *s++) != ' ' || quote)); + *t++ = 0; + } + return(argc); +} diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/commands.h b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/commands.h new file mode 100644 index 00000000000..9624713ea1f --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/commands.h @@ -0,0 +1,76 @@ +/* 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 63 */ +#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 */ + +/* additional DVI commands for XeTeX extensions */ +#define PIC_FILE 251 +#define NAT_FNT 252 /* define a native font */ +#define SET_GL_AR 253 +#define SET_GL_ST 254 + +/* additional DVI command for pTeX extensions */ +#define DVI_DIR 255 /* set direction */ diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.1 b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.1 new file mode 100644 index 00000000000..38bfc278827 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.1 @@ -0,0 +1,27 @@ +.TH DISDVI 1 "23 October 2010" "TeX Live" +.SH NAME +disdvi \- `disassemble' a (p)TeX DVI or XeTeX XDV file +.SH SYNOPSIS +.B disdvi +.RB [ \-p ] +.RI [ dvi_file [ \fB.dvi\fP ]] +.br +.B disdvi \-x +.RI [ xdv_file [ \fB.xdv\fP ]] +.br +.B disdvi \-h +.SH DESCRIPTION +.I disdvi +interprets the contents of +.IR dvi_file +or +.IR xdv_file , +printing the DVI commands and text in a human-readable ASCII format on +the standard output. +.SH "SEE ALSO" +.BR dvi2tty (1) +.SH AUTHOR +Marcel J.E. Mol, Delft University of Technology, The Netherlands +.br +marcel@mesa.nl, MESA Consulting + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.c b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.c new file mode 100644 index 00000000000..fa461f255f4 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/disdvi.c @@ -0,0 +1,669 @@ +/*****************************************************************************/ +/* */ +/* 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 */ +/* */ +/* */ +/*****************************************************************************/ + + +#if 0 +char *disdvi = "@(#) disdvi.c 2.1 19/01/90 M.J.E. Mol (c) 1989, 1990"; +#endif + +#include +#include +#include "commands.h" + +#if defined(KPATHSEA) +#define NO_DEBUG 1 +#include +#include +#else +#if defined(MSDOS) +#include +#include +#include +#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; + +int is_ptex = 0; +int is_xetex = 0; +const char * dvi_ext = ".dvi"; + +#ifdef KPATHSEA +extern void bop(void); +extern void postamble(void); +extern void preamble(void); +extern void postpostamble(void); +extern void special(int x); +extern void fontdef(int x); +extern const char *fontname(long fntnum); +extern void printnonprint(int ch); +extern unsigned long num(int size); +extern long snum(int size); +extern void picfile(int opcode); +extern void natfontdef(int opcode); +extern void glyphs(int opcode); +extern void dvidir(int opcode); +extern void invalid(int opcode); +#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 (); +void picfile (); +void natfontdef (); +void glyphs (); +void dvidir (); +void invalid (); +#endif + + + +/*---------------------------------------------------------------------------*/ + +int main(int argc, char **argv) +{ + register int opcode; /* dvi opcode */ + register int i; + int fontnum; + char * progname; + + progname = *argv; + + if ((argc > 1) && (argv[1][0] == '-')) { + if (!strcmp(argv[1], "-p") || !strcmp(argv[1], "--ptex")) { + is_ptex = 1; + } else if (!strcmp(argv[1], "-x") || !strcmp(argv[1], "--xetex")) { + is_xetex = 1; + dvi_ext = ".xdv"; + } else { + fprintf(stderr, "Invalid option `%s'\n", argv[1]); + fprintf(stderr, "Usage: %s [-p|--ptex|-x|--xetex] [dvi-file]\n", progname); + exit(3); + } + argv++; + argc--; + } + + if (argc > 2) { + fprintf(stderr, "To many arguments\n"); + fprintf(stderr, "Usage: %s [-p|--ptex|-x|--xetex] [dvi-file]\n", progname); + exit(1); + } + + if (argc == 2) { + if ((i = strlen(argv[1])) == 0) { + fprintf(stderr, "Illegal empty filename\n"); + fprintf(stderr, "Usage: %s [-p|--ptex|-x|--xetex] [dvi-file]\n", progname); + exit(2); + } + if ((i >= 5) && !strcmp(argv[1]+(i-4), dvi_ext)) + dvi_name = argv[1]; + else { + dvi_name = malloc((i+5) * sizeof(char)); + strcpy(dvi_name, argv[1]); + strcat(dvi_name, dvi_ext); + } + if ((dvifp = fopen(dvi_name, "r")) == NULL) { + perror(dvi_name); + exit(3); + } + } + else + dvifp = stdin; + +#if defined(MSDOS) || defined(WIN32) + 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; + case PIC_FILE : picfile(opcode); break; + case NAT_FNT : natfontdef(opcode); break; + case SET_GL_AR: + case SET_GL_ST: glyphs(opcode); break; + case DVI_DIR : dvidir(opcode); break; + default : invalid(opcode); + } + } + + return 0; +} /* main */ + + +/*----------------------------------------------------------------------------*/ + + +void bop(void) +{ + 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(void) +{ + + 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(void) +{ + 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(void) +{ + 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(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(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 */ + + + +const char * +fontname(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(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(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(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 */ + + + +void picfile(int opcode) +{ + int i; + + if (!is_xetex) { + invalid(opcode); + return; + } + + printf("PIC_FILE flags : %ld\n", get1()); + printf("%06ld: trans :", pc); + for (i=0; i<6; i++) + printf(" %ld", sget4()); + printf("\n%06ld: ", pc); + printf(" page : %ld\n", get2()); + printf("%06ld: ", pc); + i = (int) get1(); + printf(" path name (%3d) :", i); + while (i-- > 0) + putchar((int) get1()); + putchar('\n'); +} /* picfile */ + + + +void natfontdef(int opcode) +{ + register int i; + char * name; + font * fnt; + int flags, namelen, famlen, stylen; + long fntnum; + int new = 0; + + if (!is_xetex) { + invalid(opcode); + return; + } + + fntnum = num(4); + printf("NAT_FNT: %ld\n", fntnum); + printf("%06ld: ", pc); + printf(" scale : %ld\n", get4()); + printf("%06ld: ", pc); + flags = get2(); + printf(" flags : %d\n", flags); + printf("%06ld: ", pc); + printf(" name : "); + namelen = (int) get1(); + famlen = (int) get1(); + stylen = (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); + + if (famlen) { + printf(" family : "); + while (famlen-- > 0) + putchar((int) get1()); + putchar('\n'); + } + + if (stylen) { + printf(" style : "); + while (stylen-- > 0) + putchar((int) get1()); + putchar('\n'); + } +} /* fontdef */ + + + +void glyphs(int opcode) +{ + long width; + int x, n, i, j; + long * xy; + + if (!is_xetex) { + invalid(opcode); + return; + } + + x = SET_GL_ST - opcode + 1; + width = sget4(); + n = get2(); + printf("GLYPH_%s width : %ld\n", x == 2 ? "ARR" : "STR", width); + if ((xy = (long *) malloc(n * x * sizeof(long))) == NULL) { + perror("glyphs"); + exit(1); + } + for (j=0; j < n * x; j++) + xy[j] = sget4(); + for (i=0, j=0; i < n; i++) { + printf(" x: %ld", xy[j++]); + if (x == 2) + printf(" y: %ld", xy[j++]); + printf(" g: %ld\n", get2()); + } +} /* glyphs */ + + + +void dvidir(int opcode) +{ + if (!is_ptex) { + invalid(opcode); + return; + } + + printf("DVI_DIR: %ld\n", get1()); +} /* dvidir */ + + + +void invalid(int opcode) +{ + printf("INVALID %d\n", opcode); +} /* invalid */ diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.1 b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.1 new file mode 100644 index 00000000000..168a073373d --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/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-5.3.1/dvi2tty.DCL b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.DCL new file mode 100644 index 00000000000..637a9c2000d --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.DCL @@ -0,0 +1,55 @@ +$ ! +$ ! Compile dvi2tty for VAX/VMS under VAXC +$ ! +$ ! +$ ! April 25, 1990 +$ ! +$ ! Robert Schneider +$ ! Department of Petroleum Engineering +$ ! The University of Texas at Austin +$ ! < robert@perv.pe.utexas.edu > +$ ! +$ SAY = "WRITE SYS$OUTPUT" +$ ASK = "INQUIRE /NOPUNCTUATION ANSWER" +$ ! +$ ! You can stick options for the C compiler in CC_DEFINES. As +$ ! an example you can be redundant and define CC_DEFINES to be +$ ! "/DEFINE=VMS". +$ ! +$ CC_DEFINES = "" +$ ! +$ SAY " " +$ ASK "Compile sources? " +$ inquire_test = ANSWER .eqs. "Y" +$ if .not. inquire_test then goto linkstep +$ ! +$ SAY " " +$ SAY "Compiling sources ..." +$ SAY " " +$ ! +$ SAY "DVI2TTY.C ..." +$ CC 'CC_DEFINES DVI2TTY.C +$ SAY "DVISTUFF.C ..." +$ CC 'CC_DEFINES DVISTUFF.C +$ SAY "DISDVI.C ..." +$ CC 'CC_DEFINES DISDVI.C +$ ! +$ linkstep: +$ SAY " " +$ SAY "Linking dvi2tty ..." +$ link /exe=dvi2tty.exe dvi2tty,dvistuff,sys$library:vaxcrtl/lib +$ SAY "Linking disdvi ..." +$ link /exe=disdvi.exe disdvi,sys$library:vaxcrtl/lib +$ SAY " " +$ SAY "Be sure and copy DVI2TTY.EXE to wherever you store your TeX" +$ SAY "images and define the symbol;" +$ SAY " " +$ SAY "$ dvi2tty :== $path:dvi2tty.exe" +$ SAY " " +$ SAY "in your TeX setup command file so it may be accessed. 'path'" +$ SAY "is the directory location where you store your TeX images." +$ SAY " " +$ SAY "Done." +$ SAY " " +$ exit + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.c b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.c new file mode 100644 index 00000000000..ede91b9e637 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.c @@ -0,0 +1,700 @@ +/****************************************************************************** + * dvitty - get an ascii representation of a dvi-file, suitable for ttys + +This program was originally written in Pascal by +Svante Lindahl +and then converted to C by Marcel Mol . +Some changes have been made for TeX Live (see ./ChangeLog). + +It is released under the GNU GPL, version 2 or any later version. +(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=424018) + + * 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:DVITTY.PAS.140, 30-Mar-85 05:43:56, + * Edit: Svante Lindahl + * VERA::SS:DVITTY.PAS.136, 15-Jan-85 13:52:59, + * Edit: Svante Lindahl, final Twenex version !!!?? + * VERA::SS:DVITTY.PAS.121, 14-Jan-85 03:10:22, + * Edit: Svante Lindahl, cleaned up and fixed a lot of little things + * VERA::SS:DVITTY.PAS.25, 15-Dec-84 05:29:56, + * Edit: Svante Lindahl, COMND-interface, including command line scanning + * VERA::SS:DVITTY.PAS.23, 10-Dec-84 21:24:41, + * Edit: Svante Lindahl, added command line scanning with Rscan-JSYS + * VERA::DVITTY.PAS.48, 8-Oct-84 13:26:30, + * Edit: Svante Lindahl, fixed switch-parsing, destroyed by earlier patches + * VERA::DVITTY.PAS.45, 29-Sep-84 18:29:53, + * Edit: Svante Lindahl + * + */ + + +#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 */ + +#if 0 +char *dvi2tty = "@(#) dvi2tty.c 4.1 27/03/90 M.J.E. Mol (c) 1989, 1990"; +#endif + +/*---------------------------------------------------------------------------*/ + +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 */ +const char * path; /* name of the pager to run */ +#endif +char * progname; /* our name */ +int Argc; +char ** Argv; +char DVIfilename[MAXLEN]; +const char * OUTfilename; +char optch; /* for option handling */ + +/*---------------------------------------------------------------------------*/ + +#if defined(KPATHSEA) || defined(MSDOS) +int main (int, char **); +void setoption (const char *); +void getargs (void); +void getpages (int, const char *); +void plcnxt (int); +void getfname (const char *); +int getinteger (int *, int *, const 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 + +/****************************************************************************/ +/* */ +/* M A I N */ +/* */ +/****************************************************************************/ + +int main(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(const 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(void) +{ + const char *str; + char *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(int j, const 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(int pagnr) /* place page-nr next in list */ +{ + 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 + +static char * +readable_file(char *name) +{ + char *ret; + +#ifdef WIN32 + unsigned int fa; + + 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(const 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(int *dest, int *j, const 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(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(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-5.3.1/dvi2tty.h b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.h new file mode 100644 index 00000000000..0dae38fce63 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.h @@ -0,0 +1,91 @@ +#define Copyright "dvi2tty.c Copyright (C) 1984, 1985, 1986 Svante Lindahl.\n\ +Copyright (C) 1988 M.J.E. Mol 1989, 1990" + +#include +#include + +#include +#include + +#if defined(MSDOS) +#define DOSISH +#include +#include +#endif + +#if defined(KPATHSEA) +#define NO_DEBUG 1 +#include +#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 */ +void errorexit(int); + +/* dvistuff.c */ +void dvimain(void); diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.lsm b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.lsm new file mode 100644 index 00000000000..a4b968a7ee7 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.lsm @@ -0,0 +1,16 @@ +Begin2 +Title = dvi2tty convert TeX dvi output to ascii. +Author = Svante Lindahl / Marcel Mol +Maintainer = Marcel Mol +Site1 = ftp.mesa.nl +Location = /pub/dvi2tty/... +File1 = dvi2tty53.tgz +FileSize1 = +CopyPolicy1 = Permision to distribute archive only +CopyPolicy2 = with (c) notice intact +Keywords = TeX dvi ascii tty printing +Entered = 23jun95 +EnteredBy = Marcel Mol +Company = MESA Consulting +CheckedEmail = marcel@@mesa.nl +End diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.tex b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.tex new file mode 100644 index 00000000000..fc4eaceeaab --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvi2tty.tex @@ -0,0 +1,262 @@ +% +% By: Robert Schneider +% +% LaTeX input file which describes how dvi2tty works under +% VMS with VAXC. When using this file as a source for documentation +% of dvi2tty on your system, look for the string "NOTE ---" to +% see what local variables need to be set. +% +% This file was created by modifying the original Unix man page. +% The majority of the conversion from troff to TeX was done by +% tr2tex. +% +\documentstyle{article} +% +% Set the page margins. +% +\parindent 0pt +\marginparpush 5pt +\headheight 5pt +\headsep 0pt +\footheight 5pt +\footskip 15pt +\columnsep 10pt +\columnseprule 0pt +\marginparwidth 0pt +\oddsidemargin 0pt +\evensidemargin 0pt +\marginparsep 0pt +\topmargin 0pt +\textwidth 6.5in +\textheight 9.0in +% +\newcommand{\bs}{$\backslash$} +% +\title{{\bf DVI2TTY for VAX/VMS}} +\author{} +\date{April 25, 1990} +% +\begin{document} +\maketitle +% +% NOTE --- We like to describe what something is and how to get it +% at the top of our files. You will probably want to +% delete from here to the next \section. +% +This document describes the use of {\bf dvi2tty}\/, a filter for converting +the device independent output files created by \TeX\/ to files which may +be printed on any ASCII terminal or line printer. +This document may be printed on the line printer in CPE-3.102 by entering +the command; +\\[1ex] +{\em DOCPRINT SYS\$DOCUMENT:DVI2TTY.DOC} +\\[1ex] +Copies of this document may be printed on the laser printer in CPE-3.159 +by entering the command; +\\[1ex] +{\em PSPRINT SYS\$DOCUMENT:DVI2TTY.PS} +\\[1ex] +You may view copies of this document on workstations or personal computers +which recognize the {\it X}\/ window system protocol by entering the command; +\\[1ex] +{\em XDVI SYS\$DOCUMENT:DVI2TTY.DVI} +\section*{Description} +{\bf dvi2tty} +converts a \TeX\/ DVI-file to a format that is appropriate for terminals +and line printers. The program is intended to be used for +preliminary proofreading of \TeX-ed documents. +By default the output is directed to the terminal. +% +% NOTE --- VMS can't pipe output to a pager. Maybe you are lucky +% and your system can. +% +%,possibly through a pager (depending on how the program was installed), +%but it can be directed to a file or a pipe. +\par\vspace{1.0\baselineskip} +The output leaves much to be desired, but is still +useful if you want to avoid walking to the +laser printer (or whatever) for each iteration of your +document. +\par\vspace{1.0\baselineskip} +Since {\bf dvi2tty}\/ produces output for terminals and line printers the +representation of documents is naturally quite primitive. +Font changes 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. +\par\vspace{1.0\baselineskip} +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 +{\bf dvi2tty} although they will be printed as one line on regular \TeX\/ output +devices (e.g. laser printers). 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 {\bf dvi2tty.} +Such a continuation line is started with a space and an asterisk +in the first two columns. +\section*{Format} +{\bf dvi2tty} +[ +{\bf -o} +{\it file} +] +[ +{\bf -p} +{\it list} +] +[ +{\bf -P} +{\it list} +] +[ +{\bf -w} +{\it n} +] +[ +{\bf -l} +] +[ +{\bf -u} +] +[ +{\bf -s} +] +{\it file\rm[\it.dvi\rm]} +\par\vspace{1.0\baselineskip} +{\bf dvi2tty}\/ is compiled with VAXC which converts uppercase command line +arguments to lowercase. To pass an uppercase argument to {\bf dvi2tty}, +the argument must be enclosed in quotation marks ( i.e. ``-P'' ). Arguments +enclosed in brackets ( [ ] ) are optional. +\section*{Options} +The {\it file}\/ [{\it .dvi}] argument is optional. +Options may be specified in either a symbol or logical which is named +% +% NOTE --- The definition of the following environment variable +% is implementation dependent. +% +DVI\$DVI2TTY or on the command line. +Any option on the command line, conflicting with one in the +environment, will override the one from the environment. +\begin{list}{}{\setlength{\leftmargin}{0.6in}\labelwidth 0.6in} +\item[{{\bf -o} {\it name}}] +Write output to file {\it name}. +\item[{{\bf -p} {\it list}}] +Print the pages chosen by {\it list}. +Numbers refer to \TeX-page numbers (known as \bs count0). +An example of format for {\it 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''. +\item[{{\bf -P} {\it 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... +\item[{{\bf -w} {\it n}}] +Specify terminal width {\it n.}\/ The legal range is 16-132 with a +default of 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. +% +% NOTE --- The ability to pipe to a pager is operating system dependent. +% +%\item[{{\bf -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). +%\item[{{\bf -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. +%\item[{{\bf -F}}] +%Specify the pager program to be used. +%This overides the \$PAGER and the default pager. +%\item[{{\bf -Fprog}}] +%Use ``prog'' as program to pipe output into. Can be used to choose an +%alternate pager (e g ``-Fless''). +\item[{{\bf -l}}] +Mark page breaks with the two-character sequence ``\^{}L''. The default is +to mark them with a form feed character. +\item[{{\bf -c}}] +Do not attempt to trnaslate any characters (like the Scandinavion mode) +except when running in tt-font. +\item[{{\bf -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.) +\item[{{\bf -bdelim}}] +Print the name of fonts when switching to it (and ending it). The delim +argument is used to delimit the fontname. +\item[{{\bf -s}}] +Try to find the special Scandinavian characters that on most (?) +terminals in Scandinavia are mapped to ``\{$|$\}[\bs ]''. +This can be the default, and output from files not containing these +special characters will be identical regardless of this option. +\end{list} +% +% NOTE --- No other files are used under VMS. +% +%\section*{FILES} +%/usr/ucb/more \ \ \ \ +%probably the default pager. +\section*{Environment} +% +% NOTE --- The PAGER variable isn't used under VMS. +% +%PAGER \ \ \ \ \ \ \ \ \ \ \ \ +%the pager to use. +%\nwl +% +% NOTE --- The definition of the following environment variable +% is operating system dependent. +% +Either a symbol or logical which is named DVI\$DVI2TTY can be set to hold +command line options. As an example, if you wish to normally have your +output written to the file {\it dvi2tty.output}\/ and wish to also have +the output be 132 columns in width, you may define the logical name +DVI\$DVI2TTY as in; +\par\vspace{1.0\baselineskip} +\begin{center} +{\bf \$ DEFINE DVI\$DVI2TTY ``{\it o dvi2tty.output w 132}''} +\end{center} +\par\vspace{1.0\baselineskip} +Options set in the environment variable will be overridden by conflicting +options on the command line. +\section*{See Also} +% +% NOTE --- How do you describe where your help files and manuals are? +% +For further information use the DCL command {\bf HELP TeX}\/ to obtain +information on \TeX\/ and how \TeX\/ may be used on our system. +You should also read the \LaTeX\/ {\it Local Guide}\/ which may be found +in SYS\$DOCUMENT:. +This document may be printed on the line printer in CPE-3.102 by entering +the command; +\\[1ex] +{\em DOCPRINT SYS\$DOCUMENT:LOCAL\_GUIDE.DOC} +\\[1ex] +Copies of this document may be printed on the laser printer in CPE-3.159 +by entering the command; +\\[1ex] +{\em PSPRINT SYS\$DOCUMENT:LOCAL\_GUIDE.PS} +\\[1ex] +You may view copies of this document on workstations or personal computers +which recognize the {\it X}\/ window system protocol by entering the command; +\\[1ex] +{\em XDVI SYS\$DOCUMENT:LOCAL\_GUIDE.DVI} +\section*{Bugs} +Blanks between words get lost quite easy. This is less +likely if you are using a wider output than the default 80. +\par\vspace{1.0\baselineskip} +Only one file may be specified on the command line. +\section*{Author} +Svante Lindahl, Royal Institute of Technology, Stockholm +\\[1ex] +\{seismo, mcvax\}!enea!ttds!zap +\\[1ex] +Improved C version: Marcel Mol +\\[1ex] +marcel@mesa.nl, MESA Consulting +\end{document} + diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvistuff.c b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvistuff.c new file mode 100644 index 00000000000..a7f2ef10a3b --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/dvistuff.c @@ -0,0 +1,1141 @@ + +#include "dvi2tty.h" +#include +#include +#if defined(VMS) +#include types.h +#include stat +#endif +#if defined(MSDOS) +#include +#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) (ab ? 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) + +#if 0 +char *dvistuff = "@(#) dvistuff.c 4.1 27/03/90 M.J.E. Mol (c) 1989, 1990"; +#endif + +/*---------------------------------------------------------------------------*/ + +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 */ + +/*---------------------------------------------------------------------------*/ + +#if defined(KPATHSEA) || 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 * texlive_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 * texlive_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 + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ + +/* + * 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(void) +{ + + 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(void) /* 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(void) /* 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(void) /* 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(void) +{ + + h = 0L; v = 0L; /* initialize coordinates */ + x = 0L; w = 0L; y = 0L; z = 0L; /* initialize amounts */ + sptr = 0; /* initialize stack */ + currentline = texlive_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(void) +{ + + 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(void) /* 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(void) /* '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(register long pagenr) /* ret true if in list of pages */ +{ + + 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(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(void) /* skips by no-op commands */ +{ + register int opcode; + + while ((opcode = (int) num(1)) == NOP); + return opcode; + +} /* skipnops */ + +/*----------------------------------------------------------------------------*/ + +linetype *texlive_getline(void) /* 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; + +} /* texlive_getline */ + +/*----------------------------------------------------------------------------*/ + +linetype *findline(void) /* 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 = texlive_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 = texlive_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 = texlive_getline(); + currentline->next = temp->next; + currentline->prev = temp; + temp->next->prev = currentline; + temp->next = currentline; + currentline->vv = v; + return currentline; + +} /* findline */ + +/*----------------------------------------------------------------------------*/ + +unsigned long num(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(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(register long charnr) /* output character, don't change h */ +{ + register long saveh; + + saveh = h; + if ((charnr >= 0) && (charnr <= LASTCHAR)) + outchar((char) charnr); + else + setchar(charnr); + h = saveh; + +} /* putcharacter */ + +/*----------------------------------------------------------------------------*/ + +void setchar(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(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(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(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(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(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/dvi2tty-5.3.1/ligtest.tex b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/ligtest.tex new file mode 100644 index 00000000000..22bf91dafd9 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/ligtest.tex @@ -0,0 +1,35 @@ +\documentstyle{article} + +\begin{document} + +hello. + +dollar \$ +ampersand \& +procent \% +matje \# +leftbrace \{ +rightbrace \} +underscore \_ + +dagger \dag +ddagger \ddag +section \S +paragraph \P +copyright \copyright +pound \pounds + +\begin{itemize} +\item item 1 +\item \begin{itemize} + \item item 2.1 + \end{itemize} +\end{itemize} +bye. + +maths: \[ 1 + 2 = 5 / 3 * 1 - 1 \] + + + + +\end{document} diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.dvi b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.dvi new file mode 100644 index 00000000000..13769d62f4f Binary files /dev/null and b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.dvi differ diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.org.dvi b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.org.dvi new file mode 100644 index 00000000000..072ec09acf4 Binary files /dev/null and b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.org.dvi differ diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.tex b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.tex new file mode 100644 index 00000000000..d234606850a --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.1/test.tex @@ -0,0 +1,56 @@ + +\documentstyle{article} + +\begin{document} + +accents: \'{e} + +\LaTeX + +now inline: bla\'{e} test + +now inline: bla \'{e}test + +now inline: bla \'{e} test + +real spaces~~~xxx + +tildes accent \~o + +horizontal 2 - is -- + +horizontal 3 - is --- + +ligatures: ffl fi fl Yp + +what about vertikal bars | + +horizontal bar - + +and tildes ~ + +< funny carrots > + + +so far not in verbatim (tt font) + +\begin{verbatim} +now in verbatim (tt font) +accents: \'{e} +\LaTeX +now inline: bla\'{e} test +now inline: bla \'{e}test +now inline: bla \'{e} test +real spaces~~~xxx +tildes accent \~o +horizontal 2 - is -- +horizontal 3 - is --- +ligatures: ffl fi fl Yp +what about vertikal bars | +horizontal bar - +and tildes ~ +< funny carrots > +or other symbols: \\ { } [ ] _ ^ ? = ; / . , + * ( ) ' & % $ # " ! +\end{verbatim} + +\end{document} diff --git a/Build/source/texk/dvi2tty/dvi2tty.1 b/Build/source/texk/dvi2tty/dvi2tty.1 deleted file mode 100644 index 168a073373d..00000000000 --- a/Build/source/texk/dvi2tty/dvi2tty.1 +++ /dev/null @@ -1,131 +0,0 @@ -.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 deleted file mode 100644 index ede91b9e637..00000000000 --- a/Build/source/texk/dvi2tty/dvi2tty.c +++ /dev/null @@ -1,700 +0,0 @@ -/****************************************************************************** - * dvitty - get an ascii representation of a dvi-file, suitable for ttys - -This program was originally written in Pascal by -Svante Lindahl -and then converted to C by Marcel Mol . -Some changes have been made for TeX Live (see ./ChangeLog). - -It is released under the GNU GPL, version 2 or any later version. -(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=424018) - - * 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:DVITTY.PAS.140, 30-Mar-85 05:43:56, - * Edit: Svante Lindahl - * VERA::SS:DVITTY.PAS.136, 15-Jan-85 13:52:59, - * Edit: Svante Lindahl, final Twenex version !!!?? - * VERA::SS:DVITTY.PAS.121, 14-Jan-85 03:10:22, - * Edit: Svante Lindahl, cleaned up and fixed a lot of little things - * VERA::SS:DVITTY.PAS.25, 15-Dec-84 05:29:56, - * Edit: Svante Lindahl, COMND-interface, including command line scanning - * VERA::SS:DVITTY.PAS.23, 10-Dec-84 21:24:41, - * Edit: Svante Lindahl, added command line scanning with Rscan-JSYS - * VERA::DVITTY.PAS.48, 8-Oct-84 13:26:30, - * Edit: Svante Lindahl, fixed switch-parsing, destroyed by earlier patches - * VERA::DVITTY.PAS.45, 29-Sep-84 18:29:53, - * Edit: Svante Lindahl - * - */ - - -#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 */ - -#if 0 -char *dvi2tty = "@(#) dvi2tty.c 4.1 27/03/90 M.J.E. Mol (c) 1989, 1990"; -#endif - -/*---------------------------------------------------------------------------*/ - -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 */ -const char * path; /* name of the pager to run */ -#endif -char * progname; /* our name */ -int Argc; -char ** Argv; -char DVIfilename[MAXLEN]; -const char * OUTfilename; -char optch; /* for option handling */ - -/*---------------------------------------------------------------------------*/ - -#if defined(KPATHSEA) || defined(MSDOS) -int main (int, char **); -void setoption (const char *); -void getargs (void); -void getpages (int, const char *); -void plcnxt (int); -void getfname (const char *); -int getinteger (int *, int *, const 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 - -/****************************************************************************/ -/* */ -/* M A I N */ -/* */ -/****************************************************************************/ - -int main(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(const 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(void) -{ - const char *str; - char *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(int j, const 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(int pagnr) /* place page-nr next in list */ -{ - 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 - -static char * -readable_file(char *name) -{ - char *ret; - -#ifdef WIN32 - unsigned int fa; - - 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(const 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(int *dest, int *j, const 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(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(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 deleted file mode 100644 index 0dae38fce63..00000000000 --- a/Build/source/texk/dvi2tty/dvi2tty.h +++ /dev/null @@ -1,91 +0,0 @@ -#define Copyright "dvi2tty.c Copyright (C) 1984, 1985, 1986 Svante Lindahl.\n\ -Copyright (C) 1988 M.J.E. Mol 1989, 1990" - -#include -#include - -#include -#include - -#if defined(MSDOS) -#define DOSISH -#include -#include -#endif - -#if defined(KPATHSEA) -#define NO_DEBUG 1 -#include -#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 */ -void errorexit(int); - -/* dvistuff.c */ -void dvimain(void); diff --git a/Build/source/texk/dvi2tty/dvi2tty.patch b/Build/source/texk/dvi2tty/dvi2tty.patch deleted file mode 100644 index 392a419fc0b..00000000000 --- a/Build/source/texk/dvi2tty/dvi2tty.patch +++ /dev/null @@ -1,91 +0,0 @@ -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 deleted file mode 100644 index a7f2ef10a3b..00000000000 --- a/Build/source/texk/dvi2tty/dvistuff.c +++ /dev/null @@ -1,1141 +0,0 @@ - -#include "dvi2tty.h" -#include -#include -#if defined(VMS) -#include types.h -#include stat -#endif -#if defined(MSDOS) -#include -#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) (ab ? 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) - -#if 0 -char *dvistuff = "@(#) dvistuff.c 4.1 27/03/90 M.J.E. Mol (c) 1989, 1990"; -#endif - -/*---------------------------------------------------------------------------*/ - -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 */ - -/*---------------------------------------------------------------------------*/ - -#if defined(KPATHSEA) || 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 * texlive_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 * texlive_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 - -/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ - -/* - * 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(void) -{ - - 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(void) /* 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(void) /* 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(void) /* 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(void) -{ - - h = 0L; v = 0L; /* initialize coordinates */ - x = 0L; w = 0L; y = 0L; z = 0L; /* initialize amounts */ - sptr = 0; /* initialize stack */ - currentline = texlive_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(void) -{ - - 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(void) /* 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(void) /* '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(register long pagenr) /* ret true if in list of pages */ -{ - - 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(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(void) /* skips by no-op commands */ -{ - register int opcode; - - while ((opcode = (int) num(1)) == NOP); - return opcode; - -} /* skipnops */ - -/*----------------------------------------------------------------------------*/ - -linetype *texlive_getline(void) /* 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; - -} /* texlive_getline */ - -/*----------------------------------------------------------------------------*/ - -linetype *findline(void) /* 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 = texlive_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 = texlive_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 = texlive_getline(); - currentline->next = temp->next; - currentline->prev = temp; - temp->next->prev = currentline; - temp->next = currentline; - currentline->vv = v; - return currentline; - -} /* findline */ - -/*----------------------------------------------------------------------------*/ - -unsigned long num(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(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(register long charnr) /* output character, don't change h */ -{ - register long saveh; - - saveh = h; - if ((charnr >= 0) && (charnr <= LASTCHAR)) - outchar((char) charnr); - else - setchar(charnr); - h = saveh; - -} /* putcharacter */ - -/*----------------------------------------------------------------------------*/ - -void setchar(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(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(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(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(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(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/musixflx/ChangeLog b/Build/source/texk/musixflx/ChangeLog index 628dadcd5ee..26d2909378a 100644 --- a/Build/source/texk/musixflx/ChangeLog +++ b/Build/source/texk/musixflx/ChangeLog @@ -13,7 +13,7 @@ 2009-10-18 Peter Breitenlohner - Import musixflx-0.83 from CTAN (as of 28 Sep 2010).. + Import musixflx-0.83 from CTAN (as of 28 Sep 2010). * Makefile.am, configure.ac: Proxy build system for TeX Live, using the musixflx-0.83 distribution tree. -- cgit v1.2.3