]> git.lyx.org Git - features.git/blob - development/Win32/patches/dtl.patch
set eol-style
[features.git] / development / Win32 / patches / dtl.patch
1 diff -riwBu -Xex dtl\dt2dv.c dtl-modified\dt2dv.c
2 --- dtl\dt2dv.c Wed Mar 08 01:00:00 1995
3 +++ dtl-modified\dt2dv.c        Mon Oct 02 13:28:35 2006
4 @@ -1,9 +1,11 @@
5  /* dt2dv - convert human-readable "DTL" file to DVI format
6           - this is intended to invert dv2dt version 0.6.0
7 -   - version 0.6.1 - 14:38 GMT +11  Thu 9 March 1995
8 +   - version 0.6.2 - 27 July 2005
9     - Geoffrey Tobin    G.Tobin@ee.latrobe.edu.au
10     - fixes:  Michal Tomczak-Jaegermann    ntomczak@vm.ucs.ualberta.ca
11               Nelson H. F. Beebe    beebe@math.utah.edu
12 +            Angus Leeming leeming@lyx.org: Enable dt2dv to handle
13 +            .dvi files containing strings longer than 1024 chars.
14     - Reference:  "The DVI Driver Standard, Level 0",
15                   by  The TUG DVI Driver Standards Committee.
16                   Appendix A, "Device-Independent File Format".
17 @@ -34,7 +36,7 @@
18    size_t max;   /* capacity of buf */
19    S4 wrote;     /* number of characters written into buf */
20    size_t read;  /* position in buf of next character to read from buf */
21 -  char * buf;   /* line buffer */
22 +  unsigned char * buf;   /* line buffer */
23  } Line;
24  
25  char linebuf[MAXLINE+1];
26 @@ -1089,7 +1091,7 @@
27        dinfo();
28        status = 0;
29      }
30 -    else if ( ! isprint (c) && ! isspace (c))
31 +    else if ( ! isprint (c & 0x7f) && ! isspace (c))
32      {
33        PRINT_PROGNAME;
34        fprintf (stderr,
35 @@ -2223,7 +2225,7 @@
36  /* transfer (length and) quoted string from dtl to dvi file, */
37  /* return number of bytes written to dvi file. */
38  {
39 -  U4 k, k2;
40 +  U4 k, k2, lstr_maxsize;
41    Lstring lstr;
42  
43    if (debug)
44 @@ -2232,12 +2234,13 @@
45      fprintf (stderr, "(xfer_len_string) : entering xfer_len_string.\n");
46    }
47  
48 -  init_Lstring (&lstr, LSIZE);
49 -
50    /* k[n] : length of special string */
51  
52    k = get_unsigned (dtl);
53  
54 +  lstr_maxsize = (k > LSIZE) ? k : LSIZE;
55 +  init_Lstring (&lstr, lstr_maxsize);
56 +
57    if (debug)
58    {
59      PRINT_PROGNAME;
60 @@ -2567,7 +2570,7 @@
61  #ifdef HEX_CHECKSUM
62    /* c[4] : (hexadecimal) checksum : I (gt) would prefer this */
63    xfer_hex (4, dtl, dvi);
64 -#else /NOT HEX_CHECKSUM */
65 +#else /*NOT HEX_CHECKSUM */
66    /* c[4] : checksum (octal, for comparison with tftopl's .pl file) */
67    xfer_oct (4, dtl, dvi);
68  #endif
69 diff -riwBu -Xex dtl\Makefile dtl-modified\Makefile
70 --- dtl\Makefile        Tue Sep 19 23:59:17 2006
71 +++ dtl-modified\Makefile       Wed Jul 05 17:54:20 2006
72 @@ -3,6 +3,14 @@
73  # Thu 9 March 1995
74  # Geoffrey Tobin
75  # Nelson H. F. Beebe
76 +#
77 +# Changes 27 July 2005 by Angus Leeming to enable the Makefile to
78 +# work out of the box on both *nix and Windows machines under
79 +# the MinSYS environment.
80 +#
81 +# The Makefile can also be used unaltered to build a Windows executable
82 +# from a Linux box if make is invoked as:
83 +# $ make EXEEXT='.exe' CC='i386-mingw32-gcc'
84  #=======================================================================
85  
86  BINDIR          = /usr/local/bin
87 @@ -16,10 +24,22 @@
88  CP              = /bin/cp
89  DITROFF                = ditroff
90  DITROFF                = groff
91 -EXES           = dt2dv dv2dt
92 +
93 +# This is a GNU make extension.
94 +# If you're flavour of make refuses to accept it,
95 +# then simply hardcode EXEEXT.
96 +ifeq ($(WINDIR),)
97 +  EXEEXT =
98 +else
99 +  EXEEXT = .exe
100 +endif
101 +
102 +DT2DV          = dt2dv$(EXEEXT)
103 +DV2DT          = dv2dt$(EXEEXT)
104 +EXES           = $(DT2DV) $(DV2DT)
105  LDFLAGS         = -s
106  LDFLAGS         =
107 -MAN2PS         = ./man2ps
108 +MAN2PS         = sh ./man2ps
109  MANDIR         = /usr/local/man/man$(MANEXT)
110  MANEXT         = 1
111  OBJS            = dt2dv.o dv2dt.o
112 @@ -44,23 +64,24 @@
113  
114  #=======================================================================
115  
116 -all:  dtl check doc
117 +#all:  dtl check doc
118 +all:  dtl check
119  
120  doc:  dt2dv.hlp dv2dt.hlp dt2dv.ps dv2dt.ps
121  
122 -dtl:  $(EXES)
123 +dtl:  dv2dt dt2dv
124  
125  check tests:  hello example tripvdu edited
126  
127  dv2dt: dv2dt.o dtl.h
128 -       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.o
129 +       $(CC) $(CFLAGS) $(LDFLAGS) -o $(DV2DT) dv2dt.o
130  
131  dt2dv: dt2dv.o dtl.h
132 -       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.o
133 +       $(CC) $(CFLAGS) $(LDFLAGS) -o $(DT2DV) dt2dv.o
134  
135 -hello:  hello.dtl $(EXES)
136 -       dt2dv hello.dtl hello2.dvi
137 -       dv2dt hello2.dvi hello2.dtl
138 +hello:  hello.dtl dv2dt dt2dv
139 +       ./$(DT2DV) hello.dtl hello2.dvi
140 +       ./$(DV2DT) hello2.dvi hello2.dtl
141         -@diff hello.dtl hello2.dtl > hello.dif
142         @if [ -s hello.dif ] ; \
143         then echo ERROR: differences in hello.dif ; \
144 @@ -69,11 +90,11 @@
145  
146  hello.dtl:  hello.tex
147         tex hello
148 -       dv2dt hello.dvi hello.dtl
149 +       ./$(DV2DT) hello.dvi hello.dtl
150  
151 -example:  example.dtl $(EXES)
152 -       dt2dv example.dtl example2.dvi
153 -       dv2dt example2.dvi example2.dtl
154 +example:  example.dtl dv2dt dt2dv
155 +       ./$(DT2DV) example.dtl example2.dvi
156 +       ./$(DV2DT) example2.dvi example2.dtl
157         -@diff example.dtl example2.dtl > example.dif
158         @if [ -s example.dif ] ; \
159         then echo ERROR: differences in example.dif ; \
160 @@ -82,11 +103,11 @@
161  
162  example.dtl:  example.tex
163         tex example
164 -       dv2dt example.dvi example.dtl
165 +       ./$(DV2DT) example.dvi example.dtl
166  
167 -tripvdu:  tripvdu.dtl $(EXES)
168 -       dt2dv tripvdu.dtl tripvdu2.dvi
169 -       dv2dt tripvdu2.dvi tripvdu2.dtl
170 +tripvdu:  tripvdu.dtl dv2dt dt2dv
171 +       ./$(DT2DV) tripvdu.dtl tripvdu2.dvi
172 +       ./$(DV2DT) tripvdu2.dvi tripvdu2.dtl
173         -@diff tripvdu.dtl tripvdu2.dtl > tripvdu.dif
174         @if [ -s tripvdu.dif ] ; \
175         then echo ERROR: differences in tripvdu.dif ; \
176 @@ -95,15 +116,15 @@
177  
178  tripvdu.dtl:  tripvdu.tex
179         tex tripvdu
180 -       dv2dt tripvdu.dvi tripvdu.dtl
181 +       ./$(DV2DT) tripvdu.dvi tripvdu.dtl
182  
183  # edited.txt is already a dtl file.
184  
185 -edited:  edited.txt $(EXES)
186 -       dt2dv edited.txt edited.dvi
187 -       dv2dt edited.dvi edited2.dtl
188 -       dt2dv edited2.dtl edited2.dvi
189 -       dv2dt edited2.dvi edited3.dtl
190 +edited:  edited.txt dv2dt dt2dv
191 +       ./$(DT2DV) edited.txt edited.dvi
192 +       ./$(DV2DT) edited.dvi edited2.dtl
193 +       ./$(DT2DV) edited2.dtl edited2.dvi
194 +       ./$(DV2DT) edited2.dvi edited3.dtl
195         @if [ -s edited.dif ] ; \
196         then echo ERROR : differences in edited.dif ; \
197         else $(RM) edited.dif ; \
198 diff -riwBu -Xex dtl\man2ps dtl-modified\man2ps
199 --- dtl\man2ps  Tue Sep 19 23:59:22 2006
200 +++ dtl-modified\man2ps Wed Sep 20 00:03:05 2006
201 @@ -20,16 +20,16 @@
202  esac
203  
204  # We can use either GNU groff or Sun Solaris troff + dpost
205 -if [ -x /usr/local/bin/groff ]
206 +if [ which groff > /dev/null ]
207  then   # GNU groff
208         TROFF="groff $FORMAT"
209         TROFF2PS="cat"
210 -elif [ -x /usr/lib/lp/postscript/dpost ]
211 ++elif [ which dpost > /dev/null ]
212  then   # Solaris 2.1
213         TROFF="troff $FORMAT"
214         TROFF2PS="/usr/lib/lp/postscript/dpost"
215  else
216 -       echo "Cannot find troff-to-PostScript filter"
217 ++      echo "Cannot find troff-to-PostScript filter" >&2
218         exit 1
219  fi
220