1 diff -riwbBu -Xex dvipost-1.1/dvi.c dvipost-1.1-modified/dvi.c
\r
2 --- dvipost-1.1/dvi.c Wed Mar 22 14:59:58 2006
\r
3 +++ dvipost-1.1-modified/dvi.c Wed May 31 11:27:44 2006
\r
5 for (i = 0; i < pos_changed.dim; i++)
\r
7 POS *p = pos_changed.tab + i;
\r
9 + dout_special(out, osstart);
\r
10 cmd_goto(out, p->end, cbcol);
\r
11 dout_putrule(out, p->end - p->beg, cbrule);
\r
13 + dout_special(out, osend);
\r
16 dout_special(out, cbend);
\r
17 @@ -625,10 +629,9 @@
\r
21 - if (!cbmode[page_stat]) return;
\r
23 + if (!cbmode[page_stat] && !osmode[page_stat]) return;
\r
24 pos_add(&pos_changed, dvi_stat.v - text_height - cbexp,
\r
25 - dvi_stat.v + text_depth + cbexp);
\r
26 + dvi_stat.v + text_depth + cbexp, cbmode[page_stat]);
\r
30 diff -riwbBu -Xex dvipost-1.1/dvipost.c dvipost-1.1-modified/dvipost.c
\r
31 --- dvipost-1.1/dvipost.c Mon Nov 4 08:44:46 2002
\r
32 +++ dvipost-1.1-modified/dvipost.c Mon Sep 18 13:11:58 2006
\r
34 /* dvi file post processing
\r
36 $Copyright (C) 2002 Erich Fruehstueck
\r
37 +Modified version by LyX Team
\r
39 Dvipost is free software; you can redistribute it and/or
\r
40 modify it under the terms of the GNU General Public
\r
42 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
\r
46 #include "dvipost.h"
\r
48 +#if !defined(_MSC_VER)
\r
52 +#include "dirent.h"
\r
54 #include <sys/stat.h>
\r
57 +#include <windows.h>
\r
60 int dvipost (const char *iname, const char *oname)
\r
62 FILE *input, *tmp, *output;
\r
65 /* open temporary file
\r
70 + /* create temporary file in Windows temp directory */
\r
72 + char tmppath[MAX_PATH-14];
\r
73 + char tmpname[MAX_PATH];
\r
75 + GetTempPath(MAX_PATH-14, tmppath);
\r
76 + GetTempFileName(tmppath, "dvp", 0, tmpname);
\r
78 + tmp = fopen(tmpname, "r+b");
\r
93 /* check magic and process input
\r
96 /* copy file to output
\r
102 if (oname && strcmp(oname, "-") != 0)
\r
103 @@ -113,23 +137,20 @@
\r
104 oname = "<stdout>";
\r
109 message(NOTE, "$!: Copy data to %s\n", oname);
\r
111 - while ((c = getc(tmp)) != EOF)
\r
115 + while ((c = getc(tmp)) != EOF) putc(c, output);
\r
118 + /* Copy file directly */
\r
120 + CopyFile(tmpname, oname, FALSE);
\r
121 + DeleteFile(tmpname);
\r
124 - if (ferror(output))
\r
126 - fprintf(stderr, "%s: ", pname);
\r
128 - stat = EXIT_FAILURE;
\r
130 - else stat = EXIT_SUCCESS;
\r
135 diff -riwbBu -Xex dvipost-1.1/dvipost.h dvipost-1.1-modified/dvipost.h
\r
136 --- dvipost-1.1/dvipost.h Mon Nov 4 08:44:46 2002
\r
137 +++ dvipost-1.1-modified/dvipost.h Sun Sep 17 22:03:51 2006
\r
141 $Copyright (C) 2002 Erich Fruehstueck
\r
142 +Modified version by LyX Team
\r
144 Dvipost is free software; you can redistribute it and/or
\r
145 modify it under the terms of the GNU General Public
\r
157 void pos_init (PosTab *pos);
\r
158 -void pos_add (PosTab *pos, int beg, int end);
\r
159 +void pos_add (PosTab *pos, int beg, int end, int type);
\r
161 extern int process_dvi (const char *id, FILE *in, FILE *out);
\r
162 extern int dvipost (const char *iname, const char *oname);
\r
163 diff -riwbBu -Xex dvipost-1.1/main.c dvipost-1.1-modified/main.c
\r
164 --- dvipost-1.1/main.c Wed Nov 27 15:19:14 2002
\r
165 +++ dvipost-1.1-modified/main.c Sun Sep 17 21:56:42 2006
\r
166 @@ -24,15 +24,19 @@
\r
167 #define TEX_ACCEPT_OPTIONS 1
\r
170 -static char *version = "dvipost version 1.0\n\
\r
171 +static char *version = "dvipost version 1.1 with modifications by LyX Team (sep 2006)\n\
\r
172 Dvipost is copyright (C) 2002 Erich Fruehstueck.\n";
\r
174 #include "dvipost.h"
\r
176 +#if !defined(_MSC_VER)
\r
177 #include <unistd.h>
\r
179 #include <string.h>
\r
180 #include <sys/types.h>
\r
182 #include <sys/wait.h>
\r
185 char **tex_argv = NULL;
\r
187 @@ -233,17 +237,26 @@
\r
191 -static char *get_dvi_name (const char *arg)
\r
192 +static char *get_dvi_name (char *arg)
\r
199 + for (i=0; i < strlen(arg); ++i) {
\r
200 + if (arg[i] == '\\')
\r
205 p = strrchr(arg, '/');
\r
210 - dvi = strcpy(xalloc(strlen(arg) + 4), arg);
\r
211 - p = strchr(dvi, '.');
\r
212 + dvi = strcpy(xalloc(strlen(arg) + 5), arg);
\r
213 + p = strrchr(dvi, '.');
\r
215 if (p && strcmp(p, ".tex") == 0)
\r
217 @@ -267,14 +280,32 @@
\r
231 tex_argv = xalloc((1 + argc) * sizeof(char*));
\r
232 tex_argv[0] = argv[0];
\r
236 + for (i=0; i < strlen(argv[0]); ++i) {
\r
237 + if (argv[0][i] == '\\')
\r
238 + argv[0][i] = '/';
\r
241 + p = strrchr(argv[0], '.');
\r
243 + if (p && strcmp(p, ".exe") == 0)
\r
247 pname = strrchr(argv[0], '/');
\r
249 if (pname == NULL) pname = argv[0];
\r
250 @@ -356,6 +387,34 @@
\r
255 + for (i=0, n=0; i < tex_argc; ++i) {
\r
256 + n += strlen(tex_argv[i]);
\r
257 + qch = tex_argv[i];
\r
258 + while ((qch = strchr(qch, '"'))) {
\r
264 + cmd = xalloc(1 + n + 3*(tex_argc-1));
\r
265 + strcpy(cmd, tex_argv[0]);
\r
267 + for (i=1, n=strlen(cmd); i < tex_argc; ++i)
\r
271 + for (qch=tex_argv[i]; *qch; ++qch) {
\r
285 @@ -368,6 +427,7 @@
\r
286 execvp(tex_argv[0], tex_argv);
\r
288 waitpid(pid, &status, 0);
\r
292 return dvipost(dviname, dviname);
\r
293 diff -riwbBu -Xex dvipost-1.1/pos.c dvipost-1.1-modified/pos.c
\r
294 --- dvipost-1.1/pos.c Tue Oct 29 12:54:02 2002
\r
295 +++ dvipost-1.1-modified/pos.c Sun Sep 17 22:03:41 2006
\r
299 $Copyright (C) 2002 Erich Fruehstueck
\r
300 +Modified version by LyX Team
\r
302 Dvipost is free software; you can redistribute it and/or
\r
303 modify it under the terms of the GNU General Public
\r
308 -void pos_add (PosTab *pos, int beg, int end)
\r
309 +void pos_add (PosTab *pos, int beg, int end, int type)
\r
315 if (last->end < end) last->end = end;
\r
316 if (last->beg > beg) last->beg = beg;
\r
318 + if (last->type < type) last->type = type;
\r
324 pos->tab[pos->dim].beg = beg;
\r
325 pos->tab[pos->dim].end = end;
\r
326 + pos->tab[pos->dim].type = type;
\r
329 diff -riwbBu -Xex dvipost-1.1/tfm.c dvipost-1.1-modified/tfm.c
\r
330 --- dvipost-1.1/tfm.c Sun Nov 3 09:52:04 2002
\r
331 +++ dvipost-1.1-modified/tfm.c Sun Sep 17 22:03:44 2006
\r
335 $Copyright (C) 2002 Erich Fruehstueck
\r
336 +Modified version by LyX Team
\r
338 Dvipost is free software; you can redistribute it and/or
\r
339 modify it under the terms of the GNU General Public
\r
344 +#if defined(_MSC_VER)
\r
345 +#define popen _popen
\r
346 +#define pclose _pclose
\r
349 static char tfm_buf[1024];
\r
350 static int tfm_err = 0;
\r
351 static int tfm_pos = 0;
\r
352 @@ -112,6 +118,8 @@
\r
354 if (tfm_buf[n] == '\n')
\r
356 + if (n && tfm_buf[n-1] == '\r')
\r