diff -riwbBu -Xex dvipost-1.1/dvi.c dvipost-1.1-modified/dvi.c --- dvipost-1.1/dvi.c Wed Mar 22 14:59:58 2006 +++ dvipost-1.1-modified/dvi.c Wed May 31 11:27:44 2006 @@ -502,8 +502,12 @@ for (i = 0; i < pos_changed.dim; i++) { POS *p = pos_changed.tab + i; + if (!p->type) + dout_special(out, osstart); cmd_goto(out, p->end, cbcol); dout_putrule(out, p->end - p->beg, cbrule); + if (!p->type) + dout_special(out, osend); } dout_special(out, cbend); @@ -625,10 +629,9 @@ mv_right(w); text_cnt++; - if (!cbmode[page_stat]) return; - + if (!cbmode[page_stat] && !osmode[page_stat]) return; pos_add(&pos_changed, dvi_stat.v - text_height - cbexp, - dvi_stat.v + text_depth + cbexp); + dvi_stat.v + text_depth + cbexp, cbmode[page_stat]); if (cbframe) { diff -riwbBu -Xex dvipost-1.1/dvipost.h dvipost-1.1-modified/dvipost.h --- dvipost-1.1/dvipost.h Mon Nov 4 08:44:46 2002 +++ dvipost-1.1-modified/dvipost.h Wed May 31 18:23:34 2006 @@ -44,6 +44,7 @@ typedef struct { int beg; int end; + int type; } POS; typedef struct { @@ -53,7 +54,7 @@ } PosTab; void pos_init (PosTab *pos); -void pos_add (PosTab *pos, int beg, int end); +void pos_add (PosTab *pos, int beg, int end, int type); extern int process_dvi (const char *id, FILE *in, FILE *out); extern int dvipost (const char *iname, const char *oname); diff -riwbBu -Xex dvipost-1.1/main.c dvipost-1.1-modified/main.c --- dvipost-1.1/main.c Wed Nov 27 15:19:14 2002 +++ dvipost-1.1-modified/main.c Fri Jul 7 17:55:24 2006 @@ -24,7 +24,7 @@ #define TEX_ACCEPT_OPTIONS 1 #endif -static char *version = "dvipost version 1.0\n\ +static char *version = "dvipost version 1.1-modified\n\ Dvipost is copyright (C) 2002 Erich Fruehstueck.\n"; #include "dvipost.h" @@ -32,7 +32,9 @@ #include #include #include +#ifndef _WIN32 #include +#endif char **tex_argv = NULL; int tex_argc = 0; @@ -233,17 +235,26 @@ return stat; } -static char *get_dvi_name (const char *arg) +static char *get_dvi_name (char *arg) { char *p, *dvi; +#ifdef _WIN32 + int i; + + for (i=0; i < strlen(arg); ++i) { + if (arg[i] == '\\') + arg[i] = '/'; + } +#endif + p = strrchr(arg, '/'); if (p && p[1]) arg = p + 1; - dvi = strcpy(xalloc(strlen(arg) + 4), arg); - p = strchr(dvi, '.'); + dvi = strcpy(xalloc(strlen(arg) + 5), arg); + p = strrchr(dvi, '.'); if (p && strcmp(p, ".tex") == 0) *p = 0; @@ -267,14 +278,32 @@ char *dviname; int flag; int i, n; +#ifdef _WIN32 + char *cmd; + char *qch; + char *p; +#else int status; pid_t pid; +#endif time_t stamp; tex_argv = xalloc((1 + argc) * sizeof(char*)); tex_argv[0] = argv[0]; tex_argc = 1; +#ifdef _WIN32 + for (i=0; i < strlen(argv[0]); ++i) { + if (argv[0][i] == '\\') + argv[0][i] = '/'; + } + + p = strrchr(argv[0], '.'); + + if (p && strcmp(p, ".exe") == 0) + *p = 0; +#endif + pname = strrchr(argv[0], '/'); if (pname == NULL) pname = argv[0]; @@ -356,6 +385,34 @@ fflush(stdout); time(&stamp); +#ifdef _WIN32 + for (i=0, n=0; i < tex_argc; ++i) { + n += strlen(tex_argv[i]); + qch = tex_argv[i]; + while ((qch = strchr(qch, '"'))) { + ++qch; + ++n; + } + } + + cmd = xalloc(1 + n + 3*(tex_argc-1)); + strcpy(cmd, tex_argv[0]); + + for (i=1, n=strlen(cmd); i < tex_argc; ++i) + { + cmd[n++] = ' '; + cmd[n++] = '"'; + for (qch=tex_argv[i]; *qch; ++qch) { + if (*qch == '"') + cmd[n++] = '\\'; + cmd[n++] = *qch; + } + cmd[n++] = '"'; + } + cmd[n] = '\0'; + system(cmd); + xfree(cmd); +#else pid = fork(); if (pid == -1) @@ -368,6 +425,7 @@ execvp(tex_argv[0], tex_argv); waitpid(pid, &status, 0); +#endif if (dviname) return dvipost(dviname, dviname); diff -riwbBu -Xex dvipost-1.1/pos.c dvipost-1.1-modified/pos.c --- dvipost-1.1/pos.c Tue Oct 29 12:54:02 2002 +++ dvipost-1.1-modified/pos.c Wed May 31 11:27:44 2006 @@ -39,7 +39,7 @@ pos->dim = 0; } -void pos_add (PosTab *pos, int beg, int end) +void pos_add (PosTab *pos, int beg, int end, int type) { if (beg > end) { @@ -56,7 +56,7 @@ { if (last->end < end) last->end = end; if (last->beg > beg) last->beg = beg; - + if (last->type < type) last->type = type; return; } } @@ -64,5 +64,6 @@ pos_expand(pos); pos->tab[pos->dim].beg = beg; pos->tab[pos->dim].end = end; + pos->tab[pos->dim].type = type; pos->dim++; } diff -riwbBu -Xex dvipost-1.1/tfm.c dvipost-1.1-modified/tfm.c --- dvipost-1.1/tfm.c Sun Nov 3 09:52:04 2002 +++ dvipost-1.1-modified/tfm.c Wed May 31 11:27:44 2006 @@ -112,6 +112,8 @@ { if (tfm_buf[n] == '\n') { + if (n && tfm_buf[n-1] == '\r') + n--; tfm_buf[n] = 0; break; }