home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 7
/
FreshFishVol7.bin
/
bbs
/
text
/
dvips-5.58.lha
/
DviPS
/
dvips
/
dvips.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-27
|
37KB
|
1,153 lines
/*
* This is the main routine.
*/
#ifndef DEFRES
#define DEFRES (300)
#endif
#include "dvips.h" /* The copyright notice there is included too! */
#ifdef AMIGA
#include "amigapaths.h"
#endif
#ifndef SYSV
extern char *strtok() ; /* some systems don't have this in strings.h */
#endif
#ifdef VMS
#define GLOBAL globaldef
#ifdef __GNUC__
#include "climsgdef.h" /* created by hand, extracted from STARLET.MLB */
/* and put in GNU_CC:[INCLUDE.LOCAL] */
#include "ctype.h"
#include "descrip.h"
#else
#include climsgdef
#include ctype
#include descrip
#endif
#endif
/*
* First we define some globals.
*/
#ifdef VMS
static char ofnme[252],infnme[252],pap[40],thh[20];
#endif
fontdesctype *fonthead ; /* list of all fonts mentioned so far */
fontdesctype *curfnt ; /* the currently selected font */
sectiontype *sections ; /* sections to process document in */
Boolean manualfeed ; /* manual feed? */
Boolean compressed ; /* compressed? */
Boolean downloadpspk ; /* use PK for downloaded PS fonts? */
Boolean safetyenclose ;
/* enclose in save/restore for stupid spoolers? */
Boolean removecomments = 1 ; /* remove comments from included PS? */
Boolean nosmallchars ; /* disable small char optimization for X4045? */
Boolean cropmarks ; /* add cropmarks? */
Boolean abspage = 0 ; /* are page numbers absolute? */
Boolean tryepsf = 0 ; /* should we try to make it espf? */
Boolean secure = 0 ; /* make safe for suid */
int collatedcopies = 1 ; /* how many collated copies? */
int sectioncopies = 1 ; /* how many times to repeat each section? */
integer pagecopies = 1 ; /* how many times to repeat each page? */
shalfword linepos = 0 ; /* where are we on the line being output? */
integer maxpages ; /* the maximum number of pages */
Boolean notfirst, notlast ; /* true if a first page was specified */
Boolean evenpages, oddpages ; /* true if doing only even/only odd pages */
Boolean pagelist ; /* true if using page ranges */
Boolean sendcontrolD ; /* should we send a control D at end? */
integer firstpage ; /* the number of the first page if specified */
integer lastpage ;
integer firstseq ;
integer lastseq ;
integer hpapersize, vpapersize ; /* horizontal and vertical paper size */
integer hoff, voff ; /* horizontal and vertical offsets */
integer maxsecsize ; /* the maximum size of a section */
integer firstboploc ; /* where the first bop is */
Boolean sepfiles ; /* each section in its own file? */
int numcopies ; /* number of copies of each page to print */
char *oname ; /* output file name */
char *iname ; /* dvi file name */
char *fulliname ; /* same, with current working directory */
char *strings ; /* strings for program */
char *nextstring, *maxstring ; /* string pointers */
FILE *dvifile, *bitfile ; /* dvi and output files */
quarterword *curpos ; /* current position in virtual character packet */
quarterword *curlim ; /* final byte in virtual character packet */
fontmaptype *ffont ; /* first font in current frame */
real conv ; /* conversion ratio, pixels per DVI unit */
real vconv ; /* conversion ratio, pixels per DVI unit */
real alpha ; /* conversion ratio, DVI unit per TFM unit */
#ifndef ATARIST
integer
#else
long
#endif
mag ; /* the magnification of this document */
integer num, den ; /* the numerator and denominator */
int overridemag ; /* substitute for mag value in DVI file? */
int actualdpi = DEFRES ; /* the actual resolution of the printer */
int vactualdpi = DEFRES ; /* the actual resolution of the printer */
int maxdrift ; /* max pixels away from true rounded position */
int vmaxdrift ; /* max pixels away from true rounded position */
char *paperfmt ; /* command-line paper format */
int landscape = 0 ; /* landscape mode */
integer fontmem ; /* memory remaining in printer */
integer pagecount ; /* page counter for the sections */
integer pagenum ; /* the page number we currently look at */
long bytesleft ; /* number of bytes left in raster */
quarterword *raster ; /* area for raster manipulations */
integer hh, vv ; /* horizontal and vertical pixel positions */
/*-----------------------------------------------------------------------*
* The PATH definitions cannot be defined on the command line because so many
* DEFINE's overflow the DCL buffer when using the GNU CC compiler.
*-----------------------------------------------------------------------*/
#if defined(VMS) && defined(__GNUC__)
#include "vms_gcc_paths.h"
#endif
#ifdef ATARIST
# define TFMPATH "."
# define PKPATH "."
# define VFPATH "."
# define FIGPATH "."
# define HEADERPATH "."
# define CONFIGPATH "."
#endif
char *tfmpath = TFMPATH ; /* pointer to directories for tfm files */
char *pkpath = PKPATH ; /* pointer to directories for pk files */
char *vfpath = VFPATH ; /* pointer to directories for vf files */
char *figpath = FIGPATH ; /* pointer to directories for figure files */
char *headerpath = HEADERPATH ; /* pointer to directories for header files */
char *configpath = CONFIGPATH ; /* where to find config files */
char *infont ; /* is the file we are downloading a font? */
#ifndef PICTPATH
#ifndef __THINK__
#define PICTPATH "."
#else
#define PICTPATH ":"
#endif
#endif
char *pictpath = PICTPATH ; /* where IFF/etc. pictures are found */
#ifdef SEARCH_SUBDIRECTORIES
char *fontsubdirpath = FONTSUBDIRPATH ;
#endif
#ifdef FONTLIB
char *flipath = FLIPATH ; /* pointer to directories for fli files */
char *fliname = FLINAME ; /* pointer to names of fli files */
#endif
integer swmem ; /* font memory in the PostScript printer */
int quiet ; /* should we only print errors to stderr? */
int filter ; /* act as filter default output to stdout,
default input to stdin? */
int prettycolumn ; /* the column we are at when running pretty */
int gargc ; /* global argument count */
char **gargv ; /* global argument vector */
int totalpages = 0 ; /* total number of pages */
Boolean reverse ; /* are we going reverse? */
Boolean usesPSfonts ; /* do we use local PostScript fonts? */
Boolean usesspecial ; /* do we use \special? */
Boolean headers_off ; /* do we send headers or not? */
Boolean usescolor ; /* IBM: color - do we use colors? */
char *headerfile ; /* default header file */
char *warningmsg ; /* a message to write, if set in config file */
Boolean multiplesects ; /* more than one section? */
Boolean disablecomments ; /* should we suppress any EPSF comments? */
char *printer ; /* what printer to send this to? */
char *mfmode ; /* default MF mode */
frametype frames[MAXFRAME] ; /* stack for virtual fonts */
fontdesctype *baseFonts[256] ; /* base fonts for dvi file */
integer pagecost; /* memory used on the page being prescanned */
int delchar; /* characters to delete from prescanned page */
integer fsizetol; /* max dvi units error for psfile font sizes */
Boolean includesfonts; /* are fonts used in included psfiles? */
fontdesctype *fonthd[MAXFONTHD];/* list headers for included fonts of 1 name */
int nextfonthd; /* next unused fonthd[] index */
char xdig[256]; /* table for reading hexadecimal digits */
char banner[] = BANNER ; /* our startup message */
Boolean noenv = 0 ; /* ignore PRINTER envir variable? */
Boolean dopprescan = 0 ; /* do we do a scan before the prescan? */
integer lastheadermem ; /* how much mem did th