diff -riwBu -Xex dtl\dt2dv.c dtl-modified\dt2dv.c --- dtl\dt2dv.c Wed Mar 08 01:00:00 1995 +++ dtl-modified\dt2dv.c Mon Oct 02 13:28:35 2006 @@ -1,9 +1,11 @@ /* dt2dv - convert human-readable "DTL" file to DVI format - this is intended to invert dv2dt version 0.6.0 - - version 0.6.1 - 14:38 GMT +11 Thu 9 March 1995 + - version 0.6.2 - 27 July 2005 - Geoffrey Tobin G.Tobin@ee.latrobe.edu.au - fixes: Michal Tomczak-Jaegermann ntomczak@vm.ucs.ualberta.ca Nelson H. F. Beebe beebe@math.utah.edu + Angus Leeming leeming@lyx.org: Enable dt2dv to handle + .dvi files containing strings longer than 1024 chars. - Reference: "The DVI Driver Standard, Level 0", by The TUG DVI Driver Standards Committee. Appendix A, "Device-Independent File Format". @@ -34,7 +36,7 @@ size_t max; /* capacity of buf */ S4 wrote; /* number of characters written into buf */ size_t read; /* position in buf of next character to read from buf */ - char * buf; /* line buffer */ + unsigned char * buf; /* line buffer */ } Line; char linebuf[MAXLINE+1]; @@ -1089,7 +1091,7 @@ dinfo(); status = 0; } - else if ( ! isprint (c) && ! isspace (c)) + else if ( ! isprint (c & 0x7f) && ! isspace (c)) { PRINT_PROGNAME; fprintf (stderr, @@ -2223,7 +2225,7 @@ /* transfer (length and) quoted string from dtl to dvi file, */ /* return number of bytes written to dvi file. */ { - U4 k, k2; + U4 k, k2, lstr_maxsize; Lstring lstr; if (debug) @@ -2232,12 +2234,13 @@ fprintf (stderr, "(xfer_len_string) : entering xfer_len_string.\n"); } - init_Lstring (&lstr, LSIZE); - /* k[n] : length of special string */ k = get_unsigned (dtl); + lstr_maxsize = (k > LSIZE) ? k : LSIZE; + init_Lstring (&lstr, lstr_maxsize); + if (debug) { PRINT_PROGNAME; @@ -2567,7 +2570,7 @@ #ifdef HEX_CHECKSUM /* c[4] : (hexadecimal) checksum : I (gt) would prefer this */ xfer_hex (4, dtl, dvi); -#else /NOT HEX_CHECKSUM */ +#else /*NOT HEX_CHECKSUM */ /* c[4] : checksum (octal, for comparison with tftopl's .pl file) */ xfer_oct (4, dtl, dvi); #endif diff -riwBu -Xex dtl\Makefile dtl-modified\Makefile --- dtl\Makefile Tue Sep 19 23:59:17 2006 +++ dtl-modified\Makefile Wed Jul 05 17:54:20 2006 @@ -3,6 +3,14 @@ # Thu 9 March 1995 # Geoffrey Tobin # Nelson H. F. Beebe +# +# Changes 27 July 2005 by Angus Leeming to enable the Makefile to +# work out of the box on both *nix and Windows machines under +# the MinSYS environment. +# +# The Makefile can also be used unaltered to build a Windows executable +# from a Linux box if make is invoked as: +# $ make EXEEXT='.exe' CC='i386-mingw32-gcc' #======================================================================= BINDIR = /usr/local/bin @@ -16,10 +24,22 @@ CP = /bin/cp DITROFF = ditroff DITROFF = groff -EXES = dt2dv dv2dt + +# This is a GNU make extension. +# If you're flavour of make refuses to accept it, +# then simply hardcode EXEEXT. +ifeq ($(WINDIR),) + EXEEXT = +else + EXEEXT = .exe +endif + +DT2DV = dt2dv$(EXEEXT) +DV2DT = dv2dt$(EXEEXT) +EXES = $(DT2DV) $(DV2DT) LDFLAGS = -s LDFLAGS = -MAN2PS = ./man2ps +MAN2PS = sh ./man2ps MANDIR = /usr/local/man/man$(MANEXT) MANEXT = 1 OBJS = dt2dv.o dv2dt.o @@ -44,23 +64,24 @@ #======================================================================= -all: dtl check doc +#all: dtl check doc +all: dtl check doc: dt2dv.hlp dv2dt.hlp dt2dv.ps dv2dt.ps -dtl: $(EXES) +dtl: dv2dt dt2dv check tests: hello example tripvdu edited dv2dt: dv2dt.o dtl.h - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.o + $(CC) $(CFLAGS) $(LDFLAGS) -o $(DV2DT) dv2dt.o dt2dv: dt2dv.o dtl.h - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.o + $(CC) $(CFLAGS) $(LDFLAGS) -o $(DT2DV) dt2dv.o -hello: hello.dtl $(EXES) - dt2dv hello.dtl hello2.dvi - dv2dt hello2.dvi hello2.dtl +hello: hello.dtl dv2dt dt2dv + ./$(DT2DV) hello.dtl hello2.dvi + ./$(DV2DT) hello2.dvi hello2.dtl -@diff hello.dtl hello2.dtl > hello.dif @if [ -s hello.dif ] ; \ then echo ERROR: differences in hello.dif ; \ @@ -69,11 +90,11 @@ hello.dtl: hello.tex tex hello - dv2dt hello.dvi hello.dtl + ./$(DV2DT) hello.dvi hello.dtl -example: example.dtl $(EXES) - dt2dv example.dtl example2.dvi - dv2dt example2.dvi example2.dtl +example: example.dtl dv2dt dt2dv + ./$(DT2DV) example.dtl example2.dvi + ./$(DV2DT) example2.dvi example2.dtl -@diff example.dtl example2.dtl > example.dif @if [ -s example.dif ] ; \ then echo ERROR: differences in example.dif ; \ @@ -82,11 +103,11 @@ example.dtl: example.tex tex example - dv2dt example.dvi example.dtl + ./$(DV2DT) example.dvi example.dtl -tripvdu: tripvdu.dtl $(EXES) - dt2dv tripvdu.dtl tripvdu2.dvi - dv2dt tripvdu2.dvi tripvdu2.dtl +tripvdu: tripvdu.dtl dv2dt dt2dv + ./$(DT2DV) tripvdu.dtl tripvdu2.dvi + ./$(DV2DT) tripvdu2.dvi tripvdu2.dtl -@diff tripvdu.dtl tripvdu2.dtl > tripvdu.dif @if [ -s tripvdu.dif ] ; \ then echo ERROR: differences in tripvdu.dif ; \ @@ -95,15 +116,15 @@ tripvdu.dtl: tripvdu.tex tex tripvdu - dv2dt tripvdu.dvi tripvdu.dtl + ./$(DV2DT) tripvdu.dvi tripvdu.dtl # edited.txt is already a dtl file. -edited: edited.txt $(EXES) - dt2dv edited.txt edited.dvi - dv2dt edited.dvi edited2.dtl - dt2dv edited2.dtl edited2.dvi - dv2dt edited2.dvi edited3.dtl +edited: edited.txt dv2dt dt2dv + ./$(DT2DV) edited.txt edited.dvi + ./$(DV2DT) edited.dvi edited2.dtl + ./$(DT2DV) edited2.dtl edited2.dvi + ./$(DV2DT) edited2.dvi edited3.dtl @if [ -s edited.dif ] ; \ then echo ERROR : differences in edited.dif ; \ else $(RM) edited.dif ; \ diff -riwBu -Xex dtl\man2ps dtl-modified\man2ps --- dtl\man2ps Tue Sep 19 23:59:22 2006 +++ dtl-modified\man2ps Wed Sep 20 00:03:05 2006 @@ -20,16 +20,16 @@ esac # We can use either GNU groff or Sun Solaris troff + dpost -if [ -x /usr/local/bin/groff ] +if [ which groff > /dev/null ] then # GNU groff TROFF="groff $FORMAT" TROFF2PS="cat" -elif [ -x /usr/lib/lp/postscript/dpost ] ++elif [ which dpost > /dev/null ] then # Solaris 2.1 TROFF="troff $FORMAT" TROFF2PS="/usr/lib/lp/postscript/dpost" else - echo "Cannot find troff-to-PostScript filter" ++ echo "Cannot find troff-to-PostScript filter" >&2 exit 1 fi