Article View: comp.text.tex
Article #10171Re: "dvidvi" executable on PC?
From: r lang
Date: Sun, 09 Jun 1991 07:17
Date: Sun, 09 Jun 1991 07:17
164 lines
5130 bytes
5130 bytes
In article <.676108875@dutepp1>, luo@dutepp1.et.tudelft.nl (Jian Luo) writes:
> Hi, somebody here has got "dvidvi" run on an IBM-PC?
Here are is a patch to make it work.
To compile use:
tcc -DMSDOS dvidvi.c
*** dvidvi.c Tue Jan 3 07:23:05 1989
--- dvidvipc.c Sun Jun 9 17:10:21 1991
***************
*** 11,16
*/
#include "stdio.h"
#define MAXPPERP (32)
/*
* Some globals to keep everyone happy.
*/
--- 11,25 -----
*/
#include "stdio.h"
#define MAXPPERP (32)
+
+ #ifdef MSDOS
+ #define READBIN "rb"
+ #define WRITEBIN "wb"
+ #include <string.h>
+ #else
+ #define READBIN "r"
+ #define WRITEBIN "w"
+ #endif
/*
* Some globals to keep everyone happy.
*/
***************
*** 25,31
} pages[MAXPPERP] ; /* the organization of the pages on output */
int pagesperpage ; /* how many pages crammed onto each page? */
FILE *infile ; /* input dvi file (cannot be a stream) */
! char *temp[255] ; /* a temporary place to put things */
unsigned char *dvibuf ; /* our entire dvi file */
long inlength ; /* the length of the input dvi file */
long postloc ; /* location of the postamble */
--- 34,40 -----
} pages[MAXPPERP] ; /* the organization of the pages on output */
int pagesperpage ; /* how many pages crammed onto each page? */
FILE *infile ; /* input dvi file (cannot be a stream) */
! char temp[255] ; /* a temporary place to put things */
unsigned char *dvibuf ; /* our entire dvi file */
long inlength ; /* the length of the input dvi file */
long postloc ; /* location of the postamble */
***************
*** 311,317
*/
argc-- ;
argv++ ;
! if ((infile=fopen(argv[0],"r"))==NULL) {
strcpy(temp, argv[0]) ;
strcat(temp, ".dvi") ;
if ((infile=fopen(temp,"r"))==NULL)
--- 320,326 -----
*/
argc-- ;
argv++ ;
! if ((infile=fopen(argv[0],READBIN))==NULL) {
strcpy(temp, argv[0]) ;
strcat(temp, ".dvi") ;
if ((infile=fopen(temp,READBIN))==NULL)
***************
*** 314,320
if ((infile=fopen(argv[0],"r"))==NULL) {
strcpy(temp, argv[0]) ;
strcat(temp, ".dvi") ;
! if ((infile=fopen(temp,"r"))==NULL)
error("! can't open input file") ;
}
argc-- ;
--- 323,329 -----
if ((infile=fopen(argv[0],READBIN))==NULL) {
strcpy(temp, argv[0]) ;
strcat(temp, ".dvi") ;
! if ((infile=fopen(temp,READBIN))==NULL)
error("! can't open input file") ;
}
argc-- ;
***************
*** 328,334
if (q==NULL)
strcat(temp, ".dvi") ;
if (argc > 0) {
! if (freopen(temp, "w", stdout)==NULL)
error("! can't open output file") ;
}
}
--- 337,343 -----
if (q==NULL)
strcat(temp, ".dvi") ;
if (argc > 0) {
! if (freopen(temp, WRITEBIN, stdout)==NULL)
error("! can't open output file") ;
}
}
***************
*** 338,344
long u2(where)
long where ;
{
! return((dvibuf[where] << 8) + dvibuf[where + 1]) ;
}
/*
* Grabs a longword from the file.
--- 347,353 -----
long u2(where)
long where ;
{
! return(((long)dvibuf[where] << 8) + (long)dvibuf[where + 1]) ;
}
/*
* Grabs a longword from the file.
***************
*** 524,530
p = dviloc ;
dvibyte(248) ;
dviquad(prevpp) ;
! putbuf(postloc+5, 20) ;
dvi2(u2(postloc+25)+1L) ; /* increase stack depth by 1 */
dvi2(outputpages) ;
for (i=0; i<256; i++)
--- 533,539 -----
p = dviloc ;
dvibyte(248) ;
dviquad(prevpp) ;
! putbuf(postloc+5, 20L) ;
dvi2(u2(postloc+25)+1L) ; /* increase stack depth by 1 */
dvi2(outputpages) ;
for (i=0; i<256; i++)
***************
*** 566,572
p = pageloc(num) + 45 ;
while (dvibuf[p] != 140) {
! if (len=comlen[dvibuf[p]]) { /* most commands are simple */
putbuf(p, (long)len) ;
p += len ;
} else { /* but there are a few we need to treat specially */
--- 575,581 -----
p = pageloc(num) + 45 ;
while (dvibuf[p] != 140) {
! if ((len=comlen[dvibuf[p]]) != 0) { /* most commands are simple */
putbuf(p, (long)len) ;
p += len ;
} else { /* but there are a few we need to treat specially */
--
Russell Lang Email: rjl@monu1.cc.monash.edu.au Phone: (03) 565 3460
Department of Electrical and Computer Systems Engineering
Monash University, Australia
Technical Details
Message-ID:
<1991Jun9.071735.13863@monu1.cc.monash.edu.au>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!munnari.oz.au!bruce!monu0.cc.monash.edu.au!monu1.cc.monash.edu.au!rjlReferences:
<.676108875@dutepp1>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!munnari.oz.au!bruce!monu0.cc.monash.edu.au!monu1.cc.monash.edu.au!rjl From: rjl@monu1.cc.monash.edu.au ( r lang) Newsgroups: comp.text.tex Subject: Re: "dvidvi" executable on PC? Message-ID: <1991Jun9.071735.13863@monu1.cc.monash.edu.au> Date: 9 Jun 91 07:17:35 GMT References: <.676108875@dutepp1> Organization: Dept. Electrical & Computer Systems Engineering, Monash University Lines: 164