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