diff --git a/development/Win32/packaging/clean_dvi.py b/development/Win32/packaging/clean_dvi.py index 18f7b1a3db..39fde890d2 100644 --- a/development/Win32/packaging/clean_dvi.py +++ b/development/Win32/packaging/clean_dvi.py @@ -45,16 +45,22 @@ def error(message): def manipulated_dtl(data): - psfile_re = re.compile(r'(.*PSfile=")(.*)(" llx=.*)') + psfile_re = re.compile(r'(special1 +)([0-9]+)( +\'PSfile=")(.*)(" llx=.*)') lines = data.split('\n') for i in range(len(lines)): line = lines[i] - match = psfile_re.search(line) + match = psfile_re.match(line) if match != None: - file = match.group(2).replace('"', '') - lines[i] = '%s%s%s' \ - % ( match.group(1), file, match.group(3) ) + file = match.group(4) + filelen = len(file) + file = file.replace('"', '') + # Don't forget to update the length of the string too... + strlen = int(match.group(2)) - (filelen - len(file)) + + lines[i] = '%s%d%s%s%s' \ + % ( match.group(1), strlen, match.group(3), + file, match.group(5) ) return '\n'.join(lines) diff --git a/development/Win32/packaging/dtl/Makefile b/development/Win32/packaging/dtl/Makefile index e0572600d7..e6b9fc199a 100644 --- a/development/Win32/packaging/dtl/Makefile +++ b/development/Win32/packaging/dtl/Makefile @@ -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,8 +24,9 @@ COL = col -b CP = /bin/cp DITROFF = ditroff DITROFF = groff -DT2DV = dt2dv.exe -DV2DT = dv2dt.exe +EXEEXT = .exe +DT2DV = dt2dv$(EXEEXT) +DV2DT = dv2dt$(EXEEXT) EXES = $(DT2DV) $(DV2DT) LDFLAGS = -s LDFLAGS = @@ -51,19 +60,19 @@ 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 $@ dv2dt.o +dv2dt: dv2dt.o dtl.h + $(CC) $(CFLAGS) $(LDFLAGS) -o $(DV2DT) dv2dt.o -$(DT2DV): dt2dv.o dtl.h - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ dt2dv.o +dt2dv: dt2dv.o dtl.h + $(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 ; \ @@ -72,11 +81,11 @@ hello: hello.dtl $(EXES) 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 ; \ @@ -85,11 +94,11 @@ example: example.dtl $(EXES) 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 ; \ @@ -98,15 +107,15 @@ tripvdu: tripvdu.dtl $(EXES) 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 --git a/development/Win32/packaging/dtl/dt2dv.c b/development/Win32/packaging/dtl/dt2dv.c index a4ab23a9c6..82acd7d5bb 100644 --- a/development/Win32/packaging/dtl/dt2dv.c +++ b/development/Win32/packaging/dtl/dt2dv.c @@ -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". @@ -2223,7 +2225,7 @@ xfer_len_string /* 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 @@ xfer_len_string 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;