#include <setjmp.h>
#ifdef _WINDOWS
-// We must define MYLIBAPI as __declspec(dllexport) before including
-// dvipsone.h, then dvipsone.h will see that we have already
-// defined MYLIBAPI and will not (re)define it as __declspec(dllimport)
-#define MYLIBAPI __declspec(dllexport)
-// #include "dvipsone.h"
+ // We must define MYLIBAPI as __declspec(dllexport) before including
+ // dvipsone.h, then dvipsone.h will see that we have already
+ // defined MYLIBAPI and will not (re)define it as __declspec(dllimport)
+ #define MYLIBAPI __declspec(dllexport)
+ // #include "dvipsone.h"
#endif
#include "dvipsone.h"
#ifdef _WINDOWS
-#pragma warning(disable:4100) // unreferenced formal variable
+ #pragma warning(disable:4100) // unreferenced formal variable
#endif
#pragma warning(disable:4996)
#include <direct.h> /* for _getcwd(); */
#ifndef _WINDOWS
-#pragma warning(disable:4032) // different type when promoted
-#include <conio.h>
-#pragma warning(default:4032) // different type when promoted
+ #pragma warning(disable:4032) // different type when promoted
+ #include <conio.h>
+ #pragma warning(default:4032) // different type when promoted
#endif
#ifdef _WINDOWS
-#pragma message("DLL Version")
+ #pragma message("DLL Version")
#else
-#pragma message("EXE Version")
+ #pragma message("EXE Version")
#endif
#ifdef _WINDOWS
// int (* PScallback) (const char *) = NULL; // callback for PS strings
-int (* PScallback) (const char *, int) = NULL; // callback for PS strings
+ int (* PScallback) (const char *, int) = NULL; // callback for PS strings
#endif
#define NEEDATMINI
-#define ALLOWDEMO /* demo model - limited lifetime - DANGER ! */
-
#define CONTROLBREAK /* handle control break */
#define USELOGFILE /* allow writing of log file */
/* NOTE: the defaults for these must match those in changeflag calls ... */
-int verboseflag=0; /* -v non-zero => lots of output */
-int traceflag=0; /* -*t non-zero => even more verbose */
-int showfontflag=0; /* -V non-zero => show font tables */
-int showsubflag=0; /* -S non-zero => even more verbose */
-
-int detailflag=0; /* -? non-zero => show detail in usage */
-int reverseflag=0; /* -r non-zero => do pages in reverse order */
-int quietflag=0; /* -q non-zero => suppress \special complaints */
- /* -qqq also used to show hidden information */
-int logfileflag=0; /* -n write log file 99/Apr/20 */
-int copies=1; /* -c number of copies to print */
+int verboseflag = 0; /* -v non-zero => lots of output */
+int traceflag = 0; /* -*t non-zero => even more verbose */
+int showfontflag = 0; /* -V non-zero => show font tables */
+int showsubflag = 0; /* -S non-zero => even more verbose */
+int detailflag = 0; /* -? non-zero => show detail in usage */
+int reverseflag = 0; /* -r non-zero => do pages in reverse order */
+int quietflag = 0; /* -q non-zero => suppress \special complaints *//* -qqq also used to show hidden information */
+int logfileflag = 0; /* -n write log file 99/Apr/20 */
+int copies=1; /* -c number of copies to print */
int collated=0; /* -C non-zero => collated copies */
-int const statisticsflag=1; /* non-zero => output stack depth, fonts used */
-int const complainflag=0; /* non-zero implies complain sub table warnings */
-int const timingflag=1; /* non-zero => show timing information */
-
-int directprint=0; /* non-zero => output directly to printer */
-int stripcomment=0; /* non-zero => strip out comments */
+int const statisticsflag = 1; /* non-zero => output stack depth, fonts used */
+int const complainflag = 0; /* non-zero implies complain sub table warnings */
+int const timingflag = 1; /* non-zero => show timing information */
+int directprint = 0; /* non-zero => output directly to printer */
+int stripcomment = 0; /* non-zero => strip out comments */
int bUseCounters=0; /* -*4 non-zero counter[1]-counter[2] 96/Jan/28 */
int passcomments=1; /* default changed 94/Mar/7 for Adobe Illustrator EPS */
int bPassEPSF=1; /* non-zero => pass through EPSF files */
int bIgnoreSpecials=0; /* non-zero => ignore all \specials */
-int bOldDVIPSFlag=0; /* wrap ps: code --- unlike ps:: 96/Oct/8 */
- /* default change - increase DVIPS compatability */
-int bOldDVIPSFlip=0; /* flip coordinates in ps: code 96/Nov/7 */
- /* now handled instead via `neg rotate' */
+int bOldDVIPSFlag=0; /* wrap ps: code --- unlike ps:: 96/Oct/8 *//* default change - increase DVIPS compatability */
+int bOldDVIPSFlip=0; /* flip coordinates in ps: code 96/Nov/7 *//* now handled instead via `neg rotate' */
int bQuotePage=1; /* suppress showpage in \special{"..."} */
int bProtectStack=1; /* wrap PS in [ ... cleartomark 97/Nov/24 */
int bStoppedContext=1; /* add { ... } stopped included PS 97/Nov/24 */
int bAllowInclude=1; /* expand %%IncludeResource: font ... */
-int bAllowBadBox=1; /* allow single % comments before BoundingBox */
- /* now frozen at 1 1996/May/12 */
+int bAllowBadBox=1; /* allow single % comments before BoundingBox *//* now frozen at 1 1996/May/12 */
/* int sebastianflag=0; */ /* no gsave/grestore in postscript= */
int bWrapSpecial=1; /* prevent long lines in \special */
-int bTexFontsMap=1; /* non-zero => allowed to use `texfonts.map'*/
- /* use only in findopen - do not replace name */
-int bForceFontsMap=0; /* non-zero => replace aliases `texfonts.map'*/
- /* use up front - replace name - overrides above */
+int bTexFontsMap=1; /* non-zero => allowed to use `texfonts.map'*//* use only in findopen - do not replace name */
+int bForceFontsMap=0; /* non-zero => replace aliases `texfonts.map'*//* use up front - replace name - overrides above */
int bSciWord=0; /* non-zero => treat ps: filename case */
// int bMaxSub=0; /* non-zero => reduce subtitution table size */
// int bMaxFont=0; /* non-zero => reduce font table size */
int bBackGroundFlag=1; /* support \special{background ...} 98/Jun/30 */
int bBackUsed=0; /* non-zero of \special{background ...} used */
int BBxll, BByll, BBxur, BByur; /* crop box given in \special 96/May/4 */
-int outscaleflag=0; /* rescale scaled points on output 94/Sep/13 */
- /* used to work around Emerald RIP bugs */
+int outscaleflag=0; /* rescale scaled points on output 94/Sep/13 *//* used to work around Emerald RIP bugs */
int bMarkUnused=1; /* mark unused fonts early on 95/Mar/5 */
/* int bMMNewFlag=1; */ /* treat MM fonts like others 95/May/13 fixed */
-int bMMShortCut=0; /* simple way construct base file name 95/May/25 */
- /* remove this option ? */
+int bMMShortCut=0; /* simple way construct base file name 95/May/25 *//* remove this option ? */
int bDVICopyReduce=1; /* -2^31 => 0 sr from DVICOPY 1995/Sep/16 */
int bRandomPrefix=0; /* add random prefix to file names 95/Sep/30 */
int bAddBaseName=1; /* add BaseFontName for Distiller 97/Jan/30 */
-
int bFirstNull=1; /* non-zero => flush \special starts with null */
-
int bGhostHackFlag=0; /* make 1 byte adjustement for GhostScript */
-
int nMaxErrors=MAXERRORS; /* errors before giving up 95/Dec/28 */
-
int bSuppressBack=0; /* suppress background in imagemask 95/Dec/31 */
-
int bDuplex=0; /* ask for duplex printing new 96/May/6 */
-
int bTumble=0; /* ask printer to tumble in duplex 96/Dec/20 */
-
// int bLevel2=0; /* if allowed to use level 2 features 96/Dec/20 */
int bLevel2=1; /* if allowed to use level 2 features 00/Jun/17 */
-
-int bAllowCompression=1; /* allow use of compression of images from TIFF & BMP */
- /* Runlenght for bi-level and Packbits, LZW otherwise */
-
+int bAllowCompression=1; /* allow use of compression of images from TIFF & BMP *//* Runlenght for bi-level and Packbits, LZW otherwise */
int distillerlogflag=0; // output (%%[ ... ]%%) = flush - optional 2000 Aug 15
-
int nDefaultTIFFDPI=72; /* if resolution not specified in TIFF */
-
int bInsertImage=0; /* if \special{insertimage: ... } seen dvipslog */
-
long postposition; /* position of post op in DVI */
-
int badpathwarn=0; /* warned yet about bad path in search ? */
#ifdef _WINDOWS
/* Following initial guesses are set up at very beginning of main() */
/* May then be overridden by program path, command line, or by env vars */
-char *fontsubpath = "c:\\yandy\\dvipsone\\sub"; /* default font substitution file path */
-char *procsetpath = "c:\\yandy\\dvipsone\\pre"; /* default preamble file path */
-char *vecpath = "c:\\yandy\\fonts\\encoding"; /* default encoding vectors paths */
-char *tfmpath = "c:\\yandy\\fonts\\tfm"; /* default TFM files for metrics */
-char *texfonts = "c:\\yandy\\fonts\\tfm"; /* default place for texfonts.map */
-
-/* char *epspath = "c:\\ps;c:\\eps;c:\\tiff"; */ /* pretty random! */
-char *epspath = "c:\\ps;c:\\eps;c:\\tiff;c:\\wmf"; /* pretty random! */
-/* char *afmpath = "c:\\psfonts\\afm;c:\\afm\\tex"; */ /* pretty random! */
-/* char *afmpath = "c:\\psfonts\\afm;c:\\afm"; */ /* pretty random! */
-char *afmpath = "c:\\psfonts\\afm;c:\\yandy\\fonts\\afm"; /* pretty random! */
+char * fontsubpath = "c:\\yandy\\dvipsone\\sub"; /* default font substitution file path */
+char * procsetpath = "c:\\yandy\\dvipsone\\pre"; /* default preamble file path */
+char * vecpath = "c:\\yandy\\fonts\\encoding"; /* default encoding vectors paths */
+char * tfmpath = "c:\\yandy\\fonts\\tfm"; /* default TFM files for metrics */
+char * texfonts = "c:\\yandy\\fonts\\tfm"; /* default place for texfonts.map */
+char * epspath = "c:\\ps;c:\\eps;c:\\tiff;c:\\wmf"; /* pretty random! */
+char * afmpath = "c:\\psfonts\\afm;c:\\yandy\\fonts\\afm"; /* pretty random! */
-char *fontsubrest = "standard"; /* default font substitution file name */
+char * fontsubrest = "standard"; /* default font substitution file name */
char fontsubfile[FNAMELEN];
-char *procsetrest = "dvipream"; // default preamble file name
+char * procsetrest = "dvipream"; // default preamble file name
char procsetfile[FNAMELEN]; // complete file name for preamble
-char *tpicrest = "dvitpics";
-
-char *textencoding = "ansinew"; /* default encoding to use text fonts */
- /* may differ from ansinew 94/Dec/17 */
-char *textenconame = "ansinew"; /* just vector name itself, no path */
+char * tpicrest = "dvitpics";
+char * textencoding = "ansinew"; /* default encoding to use text fonts *//* may differ from ansinew 94/Dec/17 */
+char * textenconame = "ansinew"; /* just vector name itself, no path */
unsigned long nCheckSum=0; /* checksum for ENCODING= *//* 95/Feb/3 */
/* may be given on command line, env var, or use PFB_Dir in ATM.INI */
/* char *deffontpath = "c:\\psfonts;c:\\dvipsone\\pfb"; */ /* 1993/Nov/15 */
-char *deffontpath = "c:\\yandy\\psfonts"; /* 1993/Nov/15 */
-char *fontpath=NULL; /* 1994/May/23 */
+char *deffontpath = "c:\\yandy\\psfonts"; /* 1993/Nov/15 */
+char *fontpath = NULL; /* 1994/May/23 */
/* may be given on command line, env var, or use PFM_Dir in ATM.INI */
char *defpfmpath = "c:\\yandy\\psfonts\\pfm";
/* multiply all quantities in DVI file by this to get 10^{-7} meters */
/* in TeX, this is normally set to 25400000/473628672 */
-unsigned long num, den, mag;
+unsigned long num, den, mag;
// unsigned long mag; /* Tex \mag => 1000 times desired magnification */
/************************************************************************/
-// int perrormod (char *s)
void perrormod (char *s)
{
sprintf(logline, "`%s': %s\n", s, strerror(errno));
s = grabenv("DEBUGPAUSE");
- if (s != NULL) sscanf(s, "%d", &debugpause);
+ if (s != NULL)
+ sscanf(s, "%d", &debugpause);
// printf("DEBUGPAUSE=%d flag %d\n", debugpause, flag); // debugging only
- if (flag < 0) return;
- if (debugpause) {
-// if ((debugpause > 1) || flag) {
- if (debugpause || flag > 0) {
+
+ if (flag < 0)
+ return;
+
+ if (debugpause)
+ {
+ if (debugpause || flag > 0)
+ {
showline("\n", 0);
#ifndef _WINDOWS
showline("Press any key to continue . . .\n", 0);
}
}
-void checkenter (int argc, char *argv[]) { /* 95/Oct/28 */
+void checkenter (int argc, char *argv[]) /* 95/Oct/28 */
+{
int m;
char current[FILENAME_MAX];
- if (grabenv ("DEBUGPAUSE") != NULL)
+
+ if (grabenv("DEBUGPAUSE") != NULL)
{
(void) _getcwd(current, sizeof(current)); /* FILENAME_MAX */
sprintf(logline, "Current directory: `%s'\n", current);
showline(logline, 0);
for (m = 0; m < argc; m++)
{
-// sprintf(logline, "%2d:\t`%s'\n", m, argv[m]);
sprintf(logline, "%2d: `%s'\n", m, argv[m]);
showline(logline, 0);
}
-// checkpause(0);
checkpause(-1);
}
}
// exit(1); // pretty serious !
#endif
uexit(1);
-// return new; // keep compiler happy
}
/*****************************************************************************/
// when run as console application we read INI file directly
-// split off filename generation 98/Jan/9 so can reuse for ATMREG.ATM also
+// split off filename generation 98/Jan/9 so can reuse for ATMREG.ATM also
void setupinifilesub (char *ininame, char *fullfilename)
{
*fullfilename = '\0';
/* Easy to find Windows directory if Windows runs */
/* Or if user kindly set WINDIR environment variable */
-/* Or if running in Windows NT */
- if ((windir = getenv("windir")) != NULL || /* 1994/Jan/22 */
- (windir = getenv("WINDIR")) != NULL ||
+/* Or if running in Windows NT */
+ if ((windir = getenv("windir")) != NULL || /* 1994/Jan/22 */
+ (windir = getenv("WINDIR")) != NULL ||
(windir = getenv("winbootdir")) != NULL || /* 1995/Aug/14 */
(windir = getenv("SystemRoot")) != NULL || /* 1995/Jun/23 */
- (windir = getenv("SYSTEMROOT")) != NULL) { /* 1995/Jun/23 */
+ (windir = getenv("SYSTEMROOT")) != NULL) /* 1995/Jun/23 */
+ {
strcpy(fullfilename, windir);
strcat(fullfilename, "\\");
strcat(fullfilename, ininame);
/* printf("Using SEARCHENV %s\n", fullfilename); *//* 1992/Jan/22 */
}
- if (*fullfilename == '\0') { /* ugh, then try standard place */
+ if (*fullfilename == '\0') /* ugh, then try standard place */
+ {
strcpy(fullfilename, "c:\\winnt");
strcat(fullfilename, "\\");
strcat(fullfilename, ininame);
/* check whether ini file actually has required section */
input = fopen(fullfilename, "r");
+
if (input != NULL)
{
m = strlen(section);
fclose(input);
return zstrdup(fullfilename);
}
- }
+ }
fclose(input);
}
-// return ""; // failed, for one reason or another
return NULL; // failed, for one reason or another
}
int setupdviwindo (void)
{
- if (! usedviwindo) return 0; /* already tried and failed */
- if (dviwindo != NULL && *dviwindo != '\0') return 1;/* already tried and succeeded */
-/* dviwindo = setupinifile("dviwindo.ini", "[Environment]"); */
+ if (! usedviwindo)
+ return 0; /* already tried and failed */
+
+ if (dviwindo != NULL && *dviwindo != '\0')
+ return 1; /* already tried and succeeded */
+
dviwindo = setupinifile("dviwindo.ini", envsection);
+
if (dviwindo != NULL && *dviwindo != '\0')
return (*dviwindo != '\0');
- else {
+ else
+ {
usedviwindo = 0; /* failed, don't try this again */
return 0;
}
#ifndef _WINDOWS
int setupatmini (void)
{
- if (! useatmini) return 0; /* already tried and failed */
- if (atmini != NULL && *atmini != '\0') return 1;/* already tried and succeeded */
+ if (! useatmini)
+ return 0; /* already tried and failed */
+
+ if (atmini != NULL && *atmini != '\0')
+ return 1; /* already tried and succeeded */
+
atmini = setupinifile("atm.ini", atmsection);
+
if (atmini != NULL && *atmini != '\0')
return (*atmini != '\0');
- else {
+ else
+ {
useatmini = 0; /* failed, don't try this again */
return 0;
}
char *grabenvvar (char *varname, char *inifile, char *section, int useini)
{
(void) GetPrivateProfileString(section, varname, "", line, sizeof(line), inifile);
- if (traceflag) {
+
+ if (traceflag)
+ {
sprintf(logline, "%s=%s\n", varname, line);
showline(logline, 0);
}
- if (*line != '\0') return zstrdup(line);
- else return getenv(varname);
+
+ if (*line != '\0')
+ return zstrdup(line);
+ else
+ return getenv(varname);
}
#else
char *grabenvvar (char *varname, char *inifile, char *section, int useini)
int m, n;
/* char *linedup; */
- if (useini == 0 || *inifile == '\0') {
- return getenv(varname); /* give up, get from environment */
- /* not strdup if non-NULL ? */
+ if (useini == 0 || *inifile == '\0')
+ {
+ return getenv(varname); /* give up, get from environment *//* not strdup if non-NULL ? */
}
+
input = fopen(inifile, "r");
- if (input != NULL) {
+
+ if (input != NULL)
+ {
m = strlen(section);
-/* search for [...] section */ /* should be case insensitive */
+ /* search for [...] section */ /* should be case insensitive */
while (fgets (line, sizeof(line), input) != NULL) {
- if (*line == ';') continue;
- if (*line == '\n') continue;
- if (_strnicmp(line, section, m) == 0) { /* 95/June/23 */
-/* search for varname=... */ /* should be case sensitive ? */
+ if (*line == ';')
+ continue;
+
+ if (*line == '\n')
+ continue;
+
+ if (_strnicmp(line, section, m) == 0) /* 95/June/23 */
+ {
+ /* search for varname=... */ /* should be case sensitive ? */
n = strlen(varname);
+
while (fgets (line, sizeof(line), input) != NULL) {
- if (*line == ';') continue;
- if (*line == '[') break;
-/* if (*line == '\n') break; */ /* ??? */
- if (*line <= ' ') continue; /* 95/June/23 */
-/* if (strncmp(line, varname, n) == 0 && */
+ if (*line == ';')
+ continue;
+
+ if (*line == '[')
+ break;
+
+ if (*line <= ' ')
+ continue; /* 95/June/23 */
+
if (_strnicmp(line, varname, n) == 0 &&
- *(line+n) == '=') { /* found it ? */
+ *(line+n) == '=') /* found it ? */
+ {
fclose (input);
-/* flush trailing white space */
+ /* flush trailing white space */
s = line + strlen(line) - 1;
- while (*s <= ' ' && s > line) *s-- = '\0';
- s = line+n+1;
- if (traceflag) {
+
+ while (*s <= ' ' && s > line)
+ *s-- = '\0';
+
+ s = line + n + 1;
+
+ if (traceflag)
+ {
sprintf(logline, "%s=%s\n", varname, s);
showline(logline, 0);
}
return zstrdup(s);
- } /* end of matching varname */
- } /* end of while fgets */
-/* break; */ /* ? not found in designated section */
+ } /* end of matching varname */
+ } /* end of while fgets */
} /* end of search for [Environment] section */
}
fclose (input);
- } /* end of if fopen */
+ } /* end of if fopen */
/* useini = 0; */ /* so won't try this again ! need & then */
return getenv(varname); /* failed, so try and get from environment */
/* no tusing strdup when non-NULL ? */
/* get from [Environment] in dviwindo.ini */
char *grabenv (char *varname)
{
- (void) GetPrivateProfileString("Environment", varname, "",
- line, sizeof(line), "dviwindo.ini");
- if (traceflag) {
+ (void) GetPrivateProfileString("Environment", varname, "", line, sizeof(line), "dviwindo.ini");
+
+ if (traceflag)
+ {
sprintf(logline, "%s=%s\n", varname, line);
showline(logline, 0);
}
- if (*line != '\0') return zstrdup(line);
- else return getenv(varname);
+
+ if (*line != '\0')
+ return zstrdup(line);
+ else
+ return getenv(varname);
}
#else
/* get from [Environment] in dviwindo.ini */
char *grabenv (char *varname)
{
- if (usedviwindo && ! dviwindoinisetup) setupdviwindo(); /* 99/June/16 */
+ if (usedviwindo && ! dviwindoinisetup)
+ setupdviwindo(); /* 99/June/16 */
+
return grabenvvar (varname, dviwindo, "[Environment]", usedviwindo);
}
#endif
/* get line from normal ASCII file */
int getline (FILE *input, char *buff)
{
- int c, k=0, n=0;
- char *s=buff;
+ int c, k = 0, n = 0;
+ char *s = buff;
c = getc(input);
n++; /* 1994/Feb/23 */
- if (c == EOF) {
+ if (c == EOF) {
*s = '\0';
return 0;
}
/* go until line terminator or EOF */ /* 0 added for EPSF file safety ...*/
/* while ((c != '\n' && c != '\r' && c != EOF)) { */
while ((c != '\n' && c != '\r' && c != EOF && c != 0)) {
- if (c < ' ' && c != '\t') {
+ if (c < ' ' && c != '\t')
+ {
/* ignore control characters other than \t (and \n, \r) */
/* c = getc(input); */ /* ignore control chars */
/* n++; */ /* 1994/Feb/23 */
}
- else {
+ else
+ {
*s++ = (char) c; /* normal char - assemble */
k++;
/* c = getc(input); */
n++; /* 1994/Feb/23 */
}
/* now either have line terminator or EOF */ /* is it \r followed by \n ? */
- if (c == '\r' && flushcr != 0) {
+ if (c == '\r' && flushcr != 0)
+ {
c = getc(input); /* look ahead */
- if (c != '\n') {
+ if (c != '\n')
+ {
(void) ungetc(c, input); /* forget it again */
c = '\r'; /* put back the return at least 92/Oct/30 */
}
- else n++; /* use the \n */
+ else
+ n++; /* use the \n */
}
/* else if (c == EOF) { */
- else if (c == EOF || c == 0) { /* 1994/Feb/23 */
- if (k > 0) c = '\n'; /* stick in a newline */
- else {
+ else if (c == EOF || c == 0) /* 1994/Feb/23 */
+ {
+ if (k > 0)
+ c = '\n'; /* stick in a newline */
+ else
+ {
*s = '\0'; /* forget it - nothing there */
return 0; /* blank line at EOF */
}
int getrealline (FILE *input, char *buff)
{
int k;
+
k = getline(input, buff);
+
while ((*buff == '%' || *buff == '\n') && k > 0)
k = getline(input, buff);
+
return k;
}
void extension (char *fname, char *ext)
{
char *s, *t;
- if ((s = strrchr(fname, '.')) == NULL ||
- ((t = strrchr(fname, '\\')) != NULL && s < t))
- {
- strcat(fname, ".");
- strcat(fname, ext);
+ if ((s = strrchr(fname, '.')) == NULL ||
+ ((t = strrchr(fname, '\\')) != NULL && s < t))
+ {
+ strcat(fname, ".");
+ strcat(fname, ext);
}
}
strcat(fname, ".");
strcat(fname, ext);
}
- else strcpy(s+1, ext); /* give it default extension */
+ else
+ strcpy(s+1, ext); /* give it default extension */
}
/* remove extension if present */
char *s, *t;
if ((s = strrchr(fname, '.')) != NULL)
{
- if ((t = strrchr(fname, '\\')) == NULL || s > t) *s = '\0';
+ if ((t = strrchr(fname, '\\')) == NULL || s > t)
+ *s = '\0';
}
-}
+}
/* return pointer to file name - minus path - returns pointer to filename */
{
char *s;
- if ((s=strrchr(pathname, '\\')) != NULL) s++;
- else if ((s=strrchr(pathname, '/')) != NULL) s++;
- else if ((s=strrchr(pathname, ':')) != NULL) s++;
- else s = pathname;
+ if ((s=strrchr(pathname, '\\')) != NULL)
+ s++;
+ else
+ {
+ if ((s=strrchr(pathname, '/')) != NULL)
+ s++;
+ else
+ {
+ if ((s=strrchr(pathname, ':')) != NULL)
+ s++;
+ else
+ s = pathname;
+ }
+ }
return s;
}
char *s=logline;
// abortflag++;
- sprintf(s, "%s [-{vrgh}] [-b=<begin>] [-e=<end>]\n\
-[-m=<mag>] [-o=<orient>] [-x=<xoff>] [-y=<yoff>] [-c=<num>]\n\
-[-f=<fontpath>] [-i=<epspath>] [-s=<sub>] [-l=<paper>]\n\
-[-d=<destination>] <dvi-file-1> ... \n",
- program);
+ sprintf(s, "%s [-{vrgh}] [-b=<begin>] [-e=<end>]\n"
+ "[-m=<mag>] [-o=<orient>] [-x=<xoff>] [-y=<yoff>] [-c=<num>]\n"
+ "[-f=<fontpath>] [-i=<epspath>] [-s=<sub>] [-l=<paper>]\n"
+ "[-d=<destination>] <dvi-file-1> ... \n",
+ program);
showline(logline, 0);
+
if (! detailflag)
{
-// uexit(1);
return; // 2000 June 18
}
// s += strlen(s);
- sprintf(s, "\
- -? show this usage summary\n\
- v: verbose mode\n\
- r: reverse order pages\n\
- g: print only odd pages\n\
- h: print only even pages (in reverse order)\n\
- b: begin at given page\n\
- e: end at given page\n");
-// showline(logline, 0);
+ sprintf(s, ""
+ " -? show this usage summary\n"
+ " v: verbose mode\n"
+ " r: reverse order pages\n"
+ " g: print only odd pages\n"
+ " h: print only even pages (in reverse order)\n"
+ " b: begin at given page\n"
+ " e: end at given page\n");
s += strlen(s);
+
sprintf(s, " m: magnify by given factor (default ");
-// showline(logline, 0);
s += strlen(s);
- if (xmagnification != ymagnification) {
- sprintf(s, "%lg x %lg)\n",
- xmagnification, ymagnification);
-// showline(logline, 0);
+ if (xmagnification != ymagnification)
+ {
+ sprintf(s, "%lg x %lg)\n", xmagnification, ymagnification);
}
- else {
+ else
+ {
sprintf(s, "%lg)\n", xmagnification);
-// showline(logline, 0);
}
s += strlen(s);
- sprintf(s, "\
- o: re-orient by given angle (default %lg degrees)\n\
- x: horizontal offset (right positive - default %lg pts)\n\
- y: vertical offset (down positive - default %lg pts)\n\
- c: number of copies (default %d)\n",
+
+ sprintf(s, ""
+ " o: re-orient by given angle (default %lg degrees)\n"
+ " x: horizontal offset (right positive - default %lg pts)\n"
+ " y: vertical offset (down positive - default %lg pts)\n"
+ " c: number of copies (default %d)\n",
rotation, xoffset, yoffset, copies);
-// showline(logline, 0);
s += strlen(s);
- sprintf(s, "\
- f: font file path (default `%s')\n",
+
+ sprintf(s, " f: font file path (default `%s')\n",
(fontpath != NULL) ? fontpath : "");
-// showline(logline, 0);
s += strlen(s);
- sprintf(s, "\
- i: illustration file path (default `%s')\n",
+
+ sprintf(s, " i: illustration file path (default `%s')\n",
(epspath != NULL) ? epspath : "");
-// showline(logline, 0);
s += strlen(s);
+
sprintf(s, " s: substitution file name (default `");
s += strlen(s);
- if (subfontfileindex > 0) { /* did user specify subs ? */
- for (k = 0; k < subfontfileindex; k++) {
+
+ if (subfontfileindex > 0) /* did user specify subs ? */
+ {
+ for (k = 0; k < subfontfileindex; k++)
+ {
sprintf(s, "%s", subfontfile[k]);
-// showline(logline, 0);
s += strlen(s);
- if (k < subfontfileindex-1) {
+ if (k < subfontfileindex-1)
+ {
sprintf(s, ", ", errout);
-// showline(logline, 0);
s += strlen(s);
}
}
}
- else {
+ else
+ {
sprintf(s, "%s", fontsubrest);
-// showline(logline, 0);
s += strlen(s);
}
sprintf(s, "')\n");
showline(s, 0);
sprintf(s, " l: paper size type (default `%s')\n",
(papertype != NULL) ? papertype : "");
-// showline(logline, 0);
s += strlen(s);
sprintf(s, " d: destination ");
-// showline(logline, 0);
s += strlen(s);
- if (outputfile == NULL) {
+ if (outputfile == NULL)
+ {
sprintf(s, "(PRN, LPT1 ... , AUX, COM1 ... , NUL or file)\n\
(default is file with same name, but extension `ps')\n");
-// showline(logline, 0);
s += strlen(s);
}
- else {
+ else
+ {
sprintf(s, "(default `%s')\n", outputfile);
-// showline(logline, 0);
s += strlen(s);
}
- showline(logline, 1);
+ showline(logline, 1);
#ifndef _WINDOWS
uexit(1); // has this been set up yet ???
#endif
}
-
/* not used yet: ? and numbers 2 - 9, still available */
/* ready for recycling: n u R o ? */
/* void changeflag (int *flag, int toggle) { */
void changeflag (int *flag, int toggle, int dflt)
{
- if (toggle == 0) *flag = (1 - *flag); /* toggle it */
- else if (toggle < 0) *flag = dflt; /* reset it (back to default) */
- else *flag = !dflt; /* set it (not default setting) */
+ if (toggle == 0)
+ *flag = (1 - *flag); /* toggle it */
+ else
+ {
+ if (toggle < 0)
+ *flag = dflt; /* reset it (back to default) */
+ else
+ *flag = !dflt; /* set it (not default setting) */
+ }
}
// returns 0 for flag (no args needed)
place = ftell(input);
if (place > 0)
fprintf(outfile, " at byte %ld in DVI file\n", place-1); */
- if (input != NULL) {
+ if (input != NULL)
+ {
place = ftell(input);
- if (place > 0) {
+
+ if (place > 0)
+ {
sprintf(s, " at byte %ld in DVI file", place-1);
s += strlen(s);
}
}
strcat(logline, "\n");
showline(logline, errflag);
- if (errflag > 0) errcount(0);
+
+ if (errflag > 0)
+ errcount(0);
}
/* graceful exit with meaningful error message */
void waitasec (int delay)
{
clock_t starttime;
+
starttime = clock();
- for(;;) {
-/* if (clock() > starttime + (delay * CLK_TCK) / 1000) break; */
+ for(;;)
+ {
if (clock() > starttime + (delay * CLOCKS_PER_SEC) / 1000) break;
}
}
void cleanup (void)
{
-/* nothing much to do unless output file open */
+/* nothing much to do unless output file open */
if (output != NULL)
{
if (directprint)
#endif
/* if (wantcontrold != 0) { */ /* changed 1993/Mar/5 */
- if (wantcontrold != 0 || stripcomment != 0) {
+ if (wantcontrold != 0 || stripcomment != 0)
+ {
/* putc(3, output); */ /* send control-C */
// putc(4, output); /* send control-D */
PSputc(4, output); /* send control-D */
/* fcloseall(); */
}
-int abortjob (void)
+void abortjob (void)
{
#ifdef _WINDOWS
showline("ABORTJOB", 1); // debugging only - can't happen
#endif
cleanup();
checkexit(3);
- return -1;
+// return -1;
}
/* called each time `survivable' error encountered */
void errcount (int flag)
{
- if (flag) errlevel++;
-/* if (errlevel > MAXERRORS) { */
+ if (flag)
+ errlevel++;
+
if (errlevel > nMaxErrors && nMaxErrors > 0) /* 95/Dec/28 */
{
showline("\n", 0);
for (k = 0; k < fnext; k++)
{
property = fontproper[k];
- if ((property & C_RESIDENT) != 0) resident++;
- else if ((property & C_MISSING) != 0) missing++;
- else if ((property & C_DEPENDENT) != 0) dependent++;/* 92/Sep/2 */
- else if ((property & C_INSTANCE) != 0) instance++; /* 97/June/1 */
- else if ((property & C_UNUSED) != 0) unused++; /* 95/Mar/5 */
- else wanted++;
+ if ((property & C_RESIDENT) != 0)
+ resident++;
+ else
+ {
+ if ((property & C_MISSING) != 0)
+ missing++;
+ else
+ {
+ if ((property & C_DEPENDENT) != 0)
+ dependent++; /* 92/Sep/2 */
+ else
+ {
+ if ((property & C_INSTANCE) != 0)
+ instance++; /* 97/June/1 */
+ else
+ {
+ if ((property & C_UNUSED) != 0)
+ unused++; /* 95/Mar/5 */
+ else
+ wanted++;
+ }
+ }
+ }
+ }
}
/* printf("WANT %d K %d FNEXT %d ", want, k, fnext); */
/* no output if all fonts are resident (or missing) */
if (wanted == 0)
{
-// putc('\n', outfile);
PSputc('\n', outfile);
-/* return (resident + missing + dependent); */
return (resident + missing); /* 1992/Oct/12 */
}
-// fputs("font ", outfile);
PSputs("font ", outfile);
column += 5;
for (k = 0; k < fnext; k++)
/* if (strcmp(fontname[k], subfontname[k]) != 0 || */
if (fontname[k] == NULL || subfontname[k] == NULL ||
strcmp(fontname[k], subfontname[k]) != 0 ||
-// if (strcmp(fontname + k * MAXTEXNAME, subfontname + k * MAXFONTNAME) != 0 ||
- (property & C_MISSING) != 0) {
+ (property & C_MISSING) != 0)
+ {
/* don't mention resident remapped fonts ??? */
/* if ((property & C_REMAPIT) != 0 &&
(property & C_RESIDENT) != 0) ;
else */
- if (flag == 0 ||
- ((property & C_MISSING) == 0 &&
- (property & C_RESIDENT) == 0)) {
- if ((property & C_UNUSED) == 0) {
- if ((property & C_RESIDENT) == 0) want=1;
- else if (flag == 0) want=-1;
+ if (flag == 0 ||
+ ((property & C_MISSING) == 0 && (property & C_RESIDENT) == 0))
+ {
+ if ((property & C_UNUSED) == 0)
+ {
+ if ((property & C_RESIDENT) == 0)
+ want = 1;
+ else
+ if (flag == 0)
+ want=-1;
if (fontsubflag[k] >= 0) /* 1992/May/03 */
- want = 0; /* ignore if remapped to base font */
-/* fprintf(outfile, "%s ", fontname[k]); n++; */
+ want = 0;
}
}
-/* if (flag == 0 && (property & C_RESIDENT) != 0) want=-1; */
}
- if ((fontname[k] != NULL && subfontname[k] != NULL &&
- strcmp(fontname[k], subfontname[k])) == 0 &&
-// if (strcmp(fontname + k * MAXTEXNAME, subfontname + k * MAXFONTNAME) == 0 &&
- (property & C_REMAPIT) != 0 &&
- (property & C_DEPENDENT) == 0) {
+ if ((fontname[k] != NULL && subfontname[k] != NULL && strcmp(fontname[k], subfontname[k])) == 0 &&
+ (property & C_REMAPIT) != 0 &&
+ (property & C_DEPENDENT) == 0)
+ {
want = 1;
} /* experiment 1993/July/15 */
- if (property & C_INSTANCE) want = 0; /* 97/June/1 */
+ if (property & C_INSTANCE)
+ want = 0; /* 97/June/1 */
/* if (want > 0) fprintf(outfile, "%s ", fontname[k]);
else if (want < 0) fprintf(outfile, "%s ", subfontname[k]); */ /* ? */
- if (want != 0) {
-/* if (n % 8 == 0) fprintf(outfile, "\n%%%%+ font "); */
-/* s = fontname[k];
- if ((column += strlen(s) + 1) > 76) {
- fprintf(outfile, "\n%%%%+ font ");
- column = 9 + strlen(s) + 1;
- }
- fprintf(outfile, "%s ", s); */
- if ((property & C_MULTIPLE)) { /* 97/June/1 */
-// strcpy (ftemp, subfontname + k * MAXFONTNAME);
- if (subfontname[k] != NULL) strcpy (ftemp, subfontname[k]);
- else *ftemp = '\0';
+ if (want != 0)
+ {
+ if ((property & C_MULTIPLE)) /* 97/June/1 */
+ {
+ if (subfontname[k] != NULL)
+ strcpy (ftemp, subfontname[k]);
+ else
+ *ftemp = '\0';
}
-// else strcpy (ftemp, fontname + k * MAXTEXNAME);
- else {
- if (fontname[k] != NULL) strcpy (ftemp, fontname[k]);
- else *ftemp = '\0';
+ else
+ {
+ if (fontname[k] != NULL)
+ strcpy (ftemp, fontname[k]);
+ else
+ *ftemp = '\0';
}
- if ((column += strlen(ftemp) + 1) > 76) {
-// fputs("\n%%+ font ", outfile);
- PSputs("\n%%+ font ", outfile);
+ if ((column += strlen(ftemp) + 1) > 76)
+ {
+ PSputs("\n%%+ font ", outfile);
column = 9 + strlen(ftemp) + 1;
}
-// fputs(ftemp, outfile);
PSputs(ftemp, outfile);
-// putc(' ', outfile);
PSputc(' ', outfile);
-/* n++; */
}
}
-// putc('\n', outfile);
PSputc('\n', outfile);
-/* return wanted; */
-/* return (resident + missing + dependent); */
return (resident + missing); /* 1992/Oct/12 */
}
// char ftemp[MAXTEXNAME];
char ftemp[FNAMELEN];
int property;
-
-// fprintf(outfile, "font ");
+
PSputs("font ", outfile);
- column += 5;
+ column += 5;
- for (k = 0; k < fnext; k++) {
+ for (k = 0; k < fnext; k++)
+ {
property = fontproper[k];
-/* if (traceflag)
- printf("k %d proper %d fontsubflag %d fontname %s subfontname %s\n",
- k, property, fontsubflag[k], fontname[k],subfontname[k]); */
+
if ((property & C_MISSING) != 0 ||
- (property & C_RESIDENT) != 0) {
- if ((property & C_UNUSED) != 0) continue; /* 95/Mar/5 */
+ (property & C_RESIDENT) != 0)
+ {
+ if ((property & C_UNUSED) != 0)
+ continue; /* 95/Mar/5 */
/* don't list MM instances, since we'll include stubs after all */
/* too early, we don't know yet that this is a PSS stub ??? */
- if ((property & C_INSTANCE) != 0) continue; /* 95/Sep/16 */
-/* if (fontsubflag[k] >= 0) continue; */ /* only if unremap Jul/4 */
-/* if (strcmp(subfontname[k], "") == 0) s = fontname[k];
- else s = subfontname[k];
- if ((column += strlen(s) + 1) > 76) {
- fprintf(outfile, "\n%%%%+ font ");
- column = 9 + strlen(s) + 1;
- }
- fprintf(outfile, "%s ", s); */
-// if (*(subfontname + k * MAXFONTNAME) == '\0')
- if (subfontname[k] == NULL) {
-// strcpy(ftemp, fontname + k * MAXTEXNAME);
- if (fontname[k] != NULL) strcpy(ftemp, fontname[k]);
- else *ftemp = '\0';
+ if ((property & C_INSTANCE) != 0)
+ continue; /* 95/Sep/16 */
+
+ if (subfontname[k] == NULL)
+ {
+ if (fontname[k] != NULL)
+ strcpy(ftemp, fontname[k]);
+ else
+ *ftemp = '\0';
}
-// else strcpy(ftemp, subfontname + k * MAXFONTNAME);
- else {
+ else
+ {
strcpy(ftemp, subfontname[k]);
}
- if ((column += strlen(ftemp) + 1) > 76) {
-// fputs("\n%%+ font ", outfile);
- PSputs("\n%%+ font ", outfile);
+
+ if ((column += strlen(ftemp) + 1) > 76)
+ {
+ PSputs("\n%%+ font ", outfile);
column = 9 + strlen(ftemp) + 1;
}
-// fputs(ftemp, outfile);
+
PSputs(ftemp, outfile);
-// putc(' ', outfile);
PSputc(' ', outfile);
}
}
-// putc('\n', outfile);
PSputc('\n', outfile);
return;
}
if (papersize == NULL || *papersize == '\0')
return -1;
-/* printf("papersize=%s\n", papersize); */ /* DEBUGGING ONLY */
+
if(sscanf(s, "%lg%n", &width, &n) > 0)
{
s += n;
- units[0] = *s++; units[1] = *s++; units[2] = '\0';
+ units[0] = *s++;
+ units[1] = *s++;
+ units[2] = '\0';
multiple = decodeunits(units);
width = width * multiple;
}
showline(logline, 1);
return -1;
}
- while (*s != ',' && *s != '*' && *s != '\0') s++;
- if (*s != '\0') s++;
- if(sscanf(s, "%lg%n", &height, &n) > 0) {
+
+ while (*s != ',' && *s != '*' && *s != '\0')
+ s++;
+
+ if (*s != '\0')
+ s++;
+
+ if(sscanf(s, "%lg%n", &height, &n) > 0)
+ {
s += n;
- units[0] = *s++; units[1] = *s++; units[2] = '\0';
+ units[0] = *s++;
+ units[1] = *s++;
+ units[2] = '\0';
multiple = decodeunits(units);
height = height * multiple;
}
showline(logline, 1);
return -1;
}
+
*pagewidth = width; /* in bp */
*pageheight = height; /* in bp */
+
if (traceflag)
{
sprintf(logline, "pagewidth %lg pageheight %lg\n", *pagewidth, *pageheight);
showline(logline, 0);
}
+
return 0;
}
{
int k;
-/* if (strcmp(papertype, "custom") == 0) return; */ /* already done */
-/* pageheight = 11*72; pagewidth = 8.5*72; */ /* default */
-/* *pageheight = 11*72; *pagewidth = 8.5*72; */ /* 98/june/28 */
-// if (strcmp(papertype, "") == 0) return;
- if (papertype == NULL) return 0;
-/* if (strcmp(papertype, "custom") == 0) return; */ /* already done */
-
- for (k= 0; k < 32; k++) { /* 94/May/6 */
- if (strcmp(papertypes[k], "") == 0) break;
- if (strcmp(papertypes[k], papertype) == 0) {
-/* pagewidth = pagewidths[k] * 72; */
+ if (papertype == NULL)
+ return 0;
+
+ for (k= 0; k < 32; k++) /* 94/May/6 */
+ {
+ if (strcmp(papertypes[k], "") == 0)
+ break;
+
+ if (strcmp(papertypes[k], papertype) == 0)
+ {
*pagewidth = pagewidths[k] * 72;
-/* pageheight = pageheights[k] * 72; */
*pageheight = pageheights[k] * 72;
return 0;
}
/* dvipsone.c(1132) : warning C4713: analpapertype: INTERNAL COMPILER ERROR; restarting
(compiler file '@(#)reg86.c:1.26', line 3667)
Contact Microsoft Product Support Services */
- for (k= 0; k < 32; k++) { /* 94/May/6 */
- if (strcmp(papertypes[k], "") == 0) break;
+ for (k= 0; k < 32; k++) /* 94/May/6 */
+ {
+ if (strcmp(papertypes[k], "") == 0)
+ break;
/* Try landscape versions ... (In which first letter upper case) 94/July/1 */
- if (_strcmpi(papertypes[k], papertype) == 0) {
-/* pageheight = pagewidths[k] * 72; */ /* switch height for width */
+ if (_strcmpi(papertypes[k], papertype) == 0)
+ {
*pageheight = pagewidths[k] * 72;
-/* pagewidth = pageheights[k] * 72; */ /* switch height for width */
*pagewidth = pageheights[k] * 72;
return 0;
}
/* new option to deal with large and peculiar sizes 1994/Dec/16 */
/* -l=<width>*<height> where width and height are in PostScript points */
/* if (sscanf(papertype, "%lg*%lg", &pagewidth, &pageheight) == 2) { *//*NO*/
- if (sscanf(papertype, "%lg*%lg", pagewidth, pageheight) == 2) {
-/* papertype="custom"; */ /* useless */
+ if (sscanf(papertype, "%lg*%lg", pagewidth, pageheight) == 2)
+ {
return 0;
}
+
// insert code to interpret 4in*5in e.g. ???
if (decodepapersize(papertype, pagewidth, pageheight) == 0)
return 0;
sprintf(logline, "Don't understand papertype: %s\n", papertype);
showline(logline, 1);
errcount(0);
+
return -1;
}
int k;
char year[6];
- if (date == NULL) return; /* sanity check */
+ if (date == NULL)
+ return; /* sanity check */
+
strcpy (year, date + 7);
- for (k = 5; k >= 0; k--) date[k+5] = date[k];
+
+ for (k = 5; k >= 0; k--)
+ date[k + 5] = date[k];
+
/* date[11] = '\0'; */
- for (k = 0; k < 4; k++) date[k] = year[k];
+ for (k = 0; k < 4; k++)
+ date[k] = year[k];
+
date[4] = ' ';
+
return;
}
int k;
char year[6];
- if (date == NULL) return; /* sanity check */
+ if (date == NULL)
+ return; /* sanity check */
+
strcpy (year, date + 20);
- for (k = 18; k >= 0; k--) date[k+1] = date[k];
+
+ for (k = 18; k >= 0; k--)
+ date[k + 1] = date[k];
+
/* date[20] = '\n'; */
/* date[21] = '\0'; */
- date[20] = '\0';
- for (k = 0; k < 4; k++) date[k] = year[k];
+ date[20] = '\0';
+
+ for (k = 0; k < 4; k++)
+ date[k] = year[k];
+
date[4] = ' ';
+
return;
}
// include date if dateflag set, include serial if serialflag set
-// void stampit(FILE *output, int dateflag, int serialflag)
-char *stampit (char *line, int dateflag, int serialflag)
+char *stampit (char *line, int dateflag)
{
char *s=line;
char date[11 + 1];
// following revised for Acrobat 4.0 so Creator shows URL
#ifdef _WINDOWS
-// fputs("DVIPSONE.DLL ", output);
-// strcpy(s, "DVIPSONE.DLL ");
strcpy(s, "DVIPSONE ");
#else
-// fputs("DVIPSONE (32) ", output);
-// strcpy(s, "DVIPSONE (32) ");
strcpy(s, "DVIPSONE ");
#endif
s += strlen(s);
-/* fprintf(output, "0.%d.%d ", version, revision); */
-// fprintf(output, "%d.%d", version, revision);
-/* if (subrevision != 0) */
-// fprintf(output, ".%d", subrevision);
+
sprintf(s, "%d.%d.%d ", version, revision, subrevision);
s += strlen(s);
+
if (dateflag)
-// fprintf(output, " %s %s", date, compiletime);
sprintf(s, " %s %s", date, compiletime);
s += strlen(s);
-// if (serialflag)
-// fprintf(output, " SN %ld", serialnumber/REEXEC);
-// sprintf(s, " SN %ld", serialnumber/REEXEC);
-// s += strlen(s);
+
if (! dateflag)
{
-// putc(' ', output);
strcat(s, " ");
strcat(s, URL);
}
s += strlen(s);
-/* putc('\n', output); */
+
return s;
}
char *s;
char filename[MAXLINE]; /* need to work on copy since modify */
- if (headerfile == NULL) return;
- if (strlen(headerfile) >= sizeof(filename)) return; // sanity check
+ if (headerfile == NULL)
+ return;
+
+ if (strlen(headerfile) >= sizeof(filename))
+ return; // sanity check
+
strcpy(filename, headerfile);
s = strtok(filename, ",;");
+
while (s != NULL) {
PSputs("%%+ procset ", outfile);
sprintf(logline, "%s %d %d\n", s, 1, 1);
PSputs(logline, outfile);
s = strtok(NULL, ",;");
- }
+ }
}
void copyDSCfile (FILE *output, char *name)
{
FILE *input;
int c, d=0;
+
input = findepsfile(name, "dsc", 1, 1);
if (input == NULL)
PSputc('\n', output);
return;
}
+
while ((c = getc(input)) != EOF) {
-// putc(c, output);
PSputc(c, output);
d = c;
}
+
if (d >= ' ')
{
-// putc('\n', output);
PSputc('\n', output);
}
+
fclose(input);
}
void showowner(char *, char *, int);
-void showownerout(char *, int, int);
+void showownerout(char *);
+
+void addescapes (char *sline, char *filename, int nlen) // puts result in line
+{
+ char *s = sline;
+ char *t = filename;
-void addescapes (char *sline, char *filename, int nlen) { // puts result in line
- char *s=sline;
- char *t=filename;
while (*t != '\0') {
if (*t == '\\' || *t == '(' || *t == ')')
*s++ = '\\';
+
*s++ = *t++;
-// if ((s - line) >= sizeof(line)) break;
- if ((s - sline) >= nlen) break; // 2000 July 12th
+
+ if ((s - sline) >= nlen)
+ break; // 2000 July 12th
}
+
*s = '\0';
}
void writestruct (FILE *outfile)
{
- time_t ltime; /* for time and date */
-/* int pages, missing; */
+ time_t ltime; /* for time and date */
long pages;
int missing;
char *s;
int xll, yll, xur, yur; /* 1995/Sep/16 */
char *u; /* 1995/July/15 */
-// fputs("%!PS-Adobe-3.0\n", outfile); /* 1992/July/18 */
PSputs("%!PS-Adobe-3.0\n", outfile); /* 1992/July/18 */
- if (stripcomment != 0) return; /* 1993/March/5 */
+
+ if (stripcomment != 0)
+ return; /* 1993/March/5 */
/* get current date and time */
(void) time(<ime); /* get seconds since 1970 */
- if (ltime < 0) { /* "impossible" error */
+ if (ltime < 0) /* "impossible" error */
+ {
sprintf(logline, "ERROR: Time not available (%0ld)!\n", ltime);
showline(logline, 1);
-/* ltime = 0; *//* 901621283 1998 July 28 06:21:00 */
}
+
s = ctime(<ime);
- if (s == NULL) { /* "impossible" error */
+ if (s == NULL) /* "impossible" error */
+ {
sprintf(logline, "ERROR: Cannot convert time (%0ld)!\n", ltime); /* 96/Jan/4 */
showline(logline, 1);
s = "Thu Jan 18 22:14:00 2038";
-/* exit(1); */
}
-/* else lcivilize(s); */ /* ??? */
- lcivilize(s); // date, used below
+
+ lcivilize(s); // date, used below
+
PSputs("%%Title: ", outfile);
+
if (filenamex != NULL)
{
addescapes(line, filenamex, sizeof(line)); /* MAXLINE */
PSputs(line, outfile);
}
PSputc('\n', outfile);
+
PSputs("%%Creator: ", outfile); /* 1992/July/18 */
-// stampit(outfile, 0, 0); /* 98/Apr/20 */
- stampit(line, 0, 0);
+ stampit(line, 0);
PSputs(line, outfile);
PSputc('\n', outfile);
-// if (serialnumber > 0) {
-// PSputs("%%For: ", outfile);
-// showownerout(line, 1);
-// PSputs(line, output);
-// PSputc('\n', outfile);
-// }
-// else showline("SERIALNUMBER == 0", 1); // debugging only
+
PSputs("%%For: ", outfile);
- showownerout(line, 1, sizeof(line)); /* MAXLINE */
+ showownerout(line); /* MAXLINE */
strcat(line, "\n");
PSputs(line, output);
- if (s != NULL) {
-// fputs("%%CreationDate: ", outfile);
+
+ if (s != NULL)
+ {
PSputs("%%CreationDate: ", outfile);
sprintf(logline, "%s\n", s);
PSputs(logline, output);
}
-// fputs("%%BoundingBox: ", outfile);
+
PSputs("%%BoundingBox: ", outfile);
-/* if (usetexbounds != 0) */
-/* Puts out a floating point bounding box ... some software may not like */
- if (BBxll != 0 || BByll != 0 || BBxur != 0 || BByur != 0) { /* 96/May/4 */
-/* should really convert from TeX coordinates to PS coordinates */
+ if (BBxll != 0 || BByll != 0 || BBxur != 0 || BByur != 0) /* 96/May/4 */
+ {
+ /* should really convert from TeX coordinates to PS coordinates */
xll = BBxll; yll = BByll;
xur = BBxur; yur = BByur;
}
-// else if (strcmp(boundingtype, "") == 0)
- else if (boundingtype == NULL) { /* 94/May/6 */
- xll = 72;
- yll = (int) ((double) pageheight - 72 - (unsigned long) (dvi_l / 65781));
- xur = (int) ((double) 72 + (unsigned long) (dvi_u / 65781));
- yur = (int) ((double) pageheight - 72);
-/* fprintf(outfile, "%lg %lg %lg %lg\n", (double) 72,
- (double) pageheight - 72 - (unsigned long) (dvi_l / 65781),
- (double) 72 + (unsigned long) (dvi_u / 65781),
- (double) pageheight - 72); */
- }
-/* else fprintf(outfile, "0 0 %lg %lg\n", pagewidth, pageheight); */
- else {
- boundheight = 11*72; boundwidth = 8.5*72; /* default */
- if (boundingtype != NULL)
- analpapertype(boundingtype, &boundwidth, &boundheight);
- xll = 0;
- yll = 0;
- xur = (int) boundwidth;
- yur = (int) boundheight;
-/* fprintf(outfile, "0 0 %d %d\n", (int) boundwidth, (int) boundheight);*/
- }
- sprintf(logline, "%d %d %d %d\n", xll, yll, xur, yur); /* 95/Sep/16 */
- PSputs(logline, output);
-/* if (collated == 0) pages = pagenumber; */
-/* else pages = pagenumber * copies; */
-/* if (collated == 0) pages = numpages; */ /* 94/Oct/12 */
-/* else pages = numpages * copies; */ /* 94/Oct/12 */
- pages = numpages;
- if (collated) pages = pages * copies; /* 94/Oct/12 */
- if (nRepeatCount > 1) pages = pages * nRepeatCount; /* 95/Aug/27 */
-/* if (reverseflag != 0) pageorder = -1; else pageorder = +1; */
-// fputs("%%Pages: ", outfile);
- PSputs("%%Pages: ", outfile);
- sprintf(logline, "%ld\n", pages);
+ else
+ {
+ if (boundingtype == NULL) /* 94/May/6 */
+ {
+ xll = 72;
+ yll = (int) ((double) pageheight - 72 - (unsigned long) (dvi_l / 65781));
+ xur = (int) ((double) 72 + (unsigned long) (dvi_u / 65781));
+ yur = (int) ((double) pageheight - 72);
+ }
+ else
+ {
+ boundheight = 11*72; boundwidth = 8.5*72; /* default */
+
+ if (boundingtype != NULL)
+ analpapertype(boundingtype, &boundwidth, &boundheight);
+
+ xll = 0;
+ yll = 0;
+ xur = (int) boundwidth;
+ yur = (int) boundheight;
+ }
+ }
+ sprintf(logline, "%d %d %d %d\n", xll, yll, xur, yur); /* 95/Sep/16 */
+ PSputs(logline, output);
+
+ pages = numpages;
+ if (collated)
+ pages = pages * copies; /* 94/Oct/12 */
+
+ if (nRepeatCount > 1)
+ pages = pages * nRepeatCount; /* 95/Aug/27 */
+
+ PSputs("%%Pages: ", outfile);
+ sprintf(logline, "%ld\n", pages);
PSputs(logline, output);
+
/* %%PageOrder is highly optional ... */
- if (bOptionalDSC) {
-// fputs("%%PageOrder: ", outfile);
+ if (bOptionalDSC)
+ {
PSputs("%%PageOrder: ", outfile);
sprintf(logline, "%s\n",
- reverseflag ? "Descend" : "Ascend");
+ reverseflag ? "Descend" : "Ascend");
PSputs(logline, output);
}
-// fputs("%%DocumentSuppliedResources: ", outfile);
PSputs("%%DocumentSuppliedResources: ", outfile);
missing = writefontlist(outfile, 1, 29);
-// fputs("%%+ procset ", outfile);
+
PSputs("%%+ procset ", outfile);
sprintf(logline, "%s %d %d\n",
procsetrest, version, revision); /* no subrevision number */
PSputs(logline, output);
- if (needtpic != 0) {
-// fputs("%%+ procset ", outfile);
+
+ if (needtpic != 0)
+ {
PSputs("%%+ procset ", outfile);
sprintf(logline, "%s %d %d\n",
tpicrest, version, revision); /* no subrevision number */
PSputs(logline, output);
}
-/* if (strcmp(prologfile, "") != 0)
- prologcomments(prologfile, outfile); */ /* 1993/Nov/15 */
- for (k = 0; k < prologfileindex; k++) { /* 1993/Dec/21 */
-/* if (strcmp(prologfile[k], "") == 0) break; */
+ for (k = 0; k < prologfileindex; k++) /* 1993/Dec/21 */
+ {
prologcomments (prologfile[k], outfile);
}
/* should have version and revision? */
-// if (strcmp(headerfile, "") != 0)
if (headerfile != NULL)
prologcomments(headerfile, outfile); /* 1993/Nov/15 */
- if (missing != 0) { /* not reliable - may be non-zero yet nothing? */
-// fputs("%%DocumentNeededResources: ", outfile);
+ if (missing != 0) /* not reliable - may be non-zero yet nothing? */
+ {
PSputs("%%DocumentNeededResources: ", outfile);
writemissing(outfile, 27);
}
/* If first character is not %, then convert all matching chars to space */
/* If --- after that --- first char is not %, insert %% before it */
// if (strcmp(dscextra, "") != 0) { /* 1994/May/6 */
- if (dscextra != NULL) {
- c = *dscextra; /* look at first character */
- if (c != '%') {
+ if (dscextra != NULL)
+ {
+ c = *dscextra; /* look at first character */
+
+ if (c != '%')
+ {
s = dscextra;
+
while (*(s+1) != '\0') {
- if (*(s+1) == c) *s = ' '; /* replace magic with space */
- else *s = *(s+1); /* shift left one character */
+ if (*(s+1) == c)
+ *s = ' '; /* replace magic with space */
+ else
+ *s = *(s+1); /* shift left one character */
+
s++;
}
+
*s = '\0'; /* terminate */
c = *dscextra;
}
- if (c != '%') {
-// putc('%', output);
-// putc('%', output);
+
+ if (c != '%')
+ {
PSputs("%%", output);
}
-// fputs(dscextra, output);
PSputs(dscextra, output);
-// putc('\n', output);
PSputc('\n', output);
}
+
/* Extra DSC code supplied in \special{DSCtext=...} */
/* We are not checking whether lines start with %% and so on */
- if (dsccustom != NULL) { /* 1995/July/15 */
+ if (dsccustom != NULL) /* 1995/July/15 */
+ {
u = dsccustom;
+
while ((c = *u++) != '\0') {
-// putc(c, output);
PSputc(c, output);
}
+
free(dsccustom);
dsccustom = NULL;
dsccustomlen = 0;
}
+
/* Extra DSC code supplied in \special{DSChead=...} 1995/July/15 */
- if (dscfile != NULL) copyDSCfile(output, dscfile);
-// fputs("%%Copyright:", output); /* 1994/Mar/4 */
-// PSputs("%%Copyright:", output); /* 1994/Mar/4 */
-// fputs(copyright + 9, output); /* step over "Copyright" */
-// PSputs(copyright + 9, output); /* step over "Copyright" */
+ if (dscfile != NULL)
+ copyDSCfile(output, dscfile);
+
PSputs("%%Copyright: (C) 1990--2000, Y&Y, Inc.\n", output);
PSputs("%%Copyright: (C) 2007, TeX Users Group.\n", output);
PSputs("%%Copyright: (C) 2014, Clerk Ma.", output);
-// putc('\n', output);
PSputc('\n', output);
-// fputs("%%EndComments", outfile); /* may omit if next line ... */
+
+
PSputs("%%EndComments", outfile); /* may omit if next line ... */
-// putc('\n', outfile);
PSputc('\n', outfile);
}
void dvidictbegin(FILE *outfile) /* 1993/Dec/29 */
{
-// fputs("dvidict begin\n", outfile);
PSputs("dvidict begin\n", outfile);
}
void dvidictend(FILE *outfile) /* 1993/Dec/29 */
{
-/* putc('\n', outfile); */
-/* fprintf(outfile, "end"); */
-// fputs("end", outfile);
PSputs("end", outfile);
if (stripcomment == 0)
{
-// fputs(" % dvidict", outfile);
PSputs(" % dvidict\n", outfile);
}
else
{
-// putc('\n', outfile);
PSputc('\n', outfile);
}
}
{
if (stripcomment == 0)
{
-// fputs("% Doc Setup\n", outfile);
PSputs("% Doc Setup\n", outfile);
-// fputs("% Transform\n", outfile);
PSputs("% Transform\n", outfile);
}
-/* fprintf(outfile, "dvidict begin\n"); */
-/* fputs("dvidict begin\n", outfile); */ /* 1992/July/18 */
+
dvidictbegin(outfile);
sprintf(logline, "/num %lu def ", num); /* must use ! */
PSputs(logline, output);
+
#ifdef ALLOWSCALE
if (outscaleflag)
{
PSputs(logline, output);
}
#endif
+
if (verboseflag)
{
if (num != 25400000 || den != 473628672)
}
sprintf(logline, "/mag %lu def\n", mag); /* TeX magnification * 1000 */
PSputs(logline, output);
+
/* now for user specified transformations: */
if (evenoddoff == 0) /* only if the same on even and odd pages */
sprintf(logline, "/xoffset %lg def /yoffset %lg def\n", xoffset, yoffset);
PSputs(logline, output);
-/* fprintf(output, "/magnification %lg def /rotation %lg def\n",
- magnification, rotation); */
+
sprintf(logline, "/xmagnif %lg def /ymagnif %lg def /rotation %lg def\n",
xmagnification, ymagnification, rotation);
PSputs(logline, output);
-/* if (flipflag != 0) fprintf(outfile, "/flip true def\n");
- else fprintf(outfile, "/flip false def\n"); */
+
sprintf(logline, "/PageHeight %lg def /PageWidth %lg def\n",
pageheight, pagewidth);
PSputs(logline, output);
-/* if (bCheckVersion & 1)
- fprintf(output, "(%d.%d.%d) checkversion\n",
- version, revision, subrevision); */ /* 1993/Nov/3 */
+
if (bBindFlag)
{
PSputs("/bindflag true def\n", output);
}
+
if (bCheckFonts != 0)
{
PSputs("/checkfonts true def\n", output);
}
-/* following is redundant - since it is already set to false in preamble .. */
- else
+ else /* following is redundant - since it is already set to false in preamble .. */
{
PSputs("/checkfonts false def\n", output);
}
+
if (bLandScape != 0)
{
PSputs("/landscape true def\n", output); /* fixed 95/Aug/12 */
}
+
if (copies != 1 && collated == 0)
{
sprintf(logline, "/#copies %d def\n", copies); /* inside Setup */
PSputs(logline, output);
}
-/* if (bCheckVersion) */
+
if (bCheckVersion & 1)
{
-/* fprintf(output, "(%d.%d.%d) checkversion\n", */
sprintf(logline, "%d %d %d checkversion\n",
version, revision, subrevision); /* 1993/Nov/3 */
PSputs(logline, output);
}
+
/* Does user want to explicitly set screen frequency ? 94/March/18 */
if (frequency >= 0)
{
- if (frequency > 0) { /* did user specified frequency & angle ? */
- if (freqrelation != 0) { /* specified limiting frequency ? */
-/* fputs("currentscreen pop exch", output); */
-// fputs("currentscreen pop pop", output);
+ if (frequency > 0) /* did user specified frequency & angle ? */
+ {
+ if (freqrelation != 0) /* specified limiting frequency ? */
+ {
PSputs("currentscreen pop pop", output);
-/* fprintf(output, " %d 2 copy %s{exch}if pop exch", */
sprintf(logline, " %d 2 copy %s{exch}if pop %d",
frequency, (freqrelation > 0) ? "lt" : "gt", angle);
}
- else {
+ else
+ {
sprintf(logline, "%d %d", frequency, angle);
}
PSputs(logline, output);
}
-/* else if (frequency == 0) */ /* use new spot function - no frequency */
else
{
-// fputs("currentscreen pop", output); /* frequency == 0 */
PSputs("currentscreen pop", output); /* frequency == 0 */
}
-// fputs(" dviscreen\n", output);
PSputs(" dviscreen\n", output);
}
dvidictend (outfile);
int copypreamble (FILE *output, FILE *input, char *procsetfile, int checkflag)
{
int c, d, column;
- int goodflag=0; /* 93/Mar/31 */
+ int goodflag = 0; /* 93/Mar/31 */
unsigned int k, length;
- int preversion=1, prerevision=2, presubrevision=0;
+ int preversion = 1, prerevision = 2, presubrevision = 0;
char *s;
if ((bCheckVersion & 2) && checkflag) /* 1995/May/30 */
while ((c = getc(input)) != EOF && c < ' ') ; /* skip to next line */
s = line;
*s++ = (char) c;
+
while ((c = getc(input)) != EOF && c >= ' ' && s < line + sizeof(line))
*s++ = (char) c; /* read the line */
+
*s++ = '\n'; *s = '\0';
+
if ((s = strstr(line, "version")) != NULL)
{
- if (sscanf (s+7, "%d.%d.%d", &preversion, &prerevision, &presubrevision) == 3)
+ if (sscanf (s + 7, "%d.%d.%d", &preversion, &prerevision, &presubrevision) == 3)
{
if (preversion == version && prerevision == revision && presubrevision == subrevision)
{
goodflag = 1; /* 95/Mar/31 */
+
if (traceflag) /* debug only */
{
sprintf(logline, "VERSION OK (%s)\n", procsetfile);
showline(logline, 0);
}
+
if (distillerlogflag) // made optional 2000 Aug 15
{
strcpy(logline, "(%%[ Preamble Version: ");
}
}
}
+
if (goodflag == 0)
{
sprintf(logline, "ERROR: Incorrect preamble version (%s) need %s:\n",
showline(logline, 1);
showline(line, 1); /* line read from file */
checkexit(1);
- return -1; // failed
+ //return -1; // failed
}
rewind (input);
}
{
if (*line != '%')
{
-// fputs(line, output); /* flush copyright */
PSputs(line, output); /* flush copyright */
}
+
while (fgets(line, MAXLINE, input) != NULL) {
- if ((s = strchr(line, '\r')) != NULL) {
- if (*(s+1) == '\n') strcpy(s, s+1);
- } /* 95/May/8 fix since opened in "rb" mode */
- if (stripcomment == 0 || *line != '%') {
-// fputs(line, output);
+ if ((s = strchr(line, '\r')) != NULL)
+ {
+ if (*(s+1) == '\n')
+ strcpy(s, s+1);
+ }
+
+ if (stripcomment == 0 || *line != '%')
+ {
PSputs(line, output);
}
- if (bAbort) abortjob(); /* 92/Nov/24 */
- if (abortflag) return -1;
+
+ if (bAbort)
+ abortjob(); /* 92/Nov/24 */
+
+ if (abortflag)
+ return -1;
}
- if (strchr(line, '\n') == NULL) {
-// putc('\n', output);
- PSputc('\n', output);
+ if (strchr(line, '\n') == NULL)
+ {
+ PSputc('\n', output);
}
}
return 0;
}
while ((c = getc(input)) == 128) { /* PFB style format */
- c = getc(input); /* get section code */
-/* assumes ASCII and binary sections no longer than 65535 bytes */
- if (c == 3) return 0; /* end of data */
+ c = getc(input); /* get section code */
+ /* assumes ASCII and binary sections no longer than 65535 bytes */
+ if (c == 3)
+ return 0; /* end of data */
+
length = (unsigned int) readlength(input);
- if (c == 1) { /* ASCII */
- for (k = 0; k < length; k++) {
+
+ if (c == 1) /* ASCII */
+ {
+ for (k = 0; k < length; k++)
+ {
c = getc(input);
- if (c == '\r') c = '\n'; /* ??? */
-// putc(c, output);
+ if (c == '\r')
+ c = '\n'; /* ??? */
PSputc(c, output);
}
}
- else if (c == 2) { /* binary */
- column = 0;
- for (k = 0; k < length; k++) {
- if (column >= 39) { /* 78 columns */
-// putc('\n', output);
- PSputc('\n', output);
- column = 0;
+ else
+ {
+ if (c == 2) /* binary */
+ {
+ column = 0;
+
+ for (k = 0; k < length; k++)
+ {
+ if (column >= 39) /* 78 columns */
+ {
+ PSputc('\n', output);
+ column = 0;
+ }
+
+ c = getc(input);
+ d = c & 15;
+ c = c >> 4;
+
+ if (c > 9)
+ c = c + 'A' - 10;
+ else
+ c = c + '0';
+ PSputc(c, output);
+
+ if (d > 9)
+ d = d + 'A' - 10;
+ else
+ d = d + '0';
+ PSputc(d, output);
+ column++;
}
- c = getc(input);
- d = c & 15;
- c = c >> 4;
- if (c > 9) c = c + 'A' - 10;
- else c = c + '0';
-// putc(c, output);
- PSputc(c, output);
- if (d > 9) d = d + 'A' - 10;
- else d = d + '0';
-// putc(d, output);
- PSputc(d, output);
- column++;
+ PSputc('\n', output);
}
-// putc('\n', output);
- PSputc('\n', output);
+ else
+ break; /* invalid code */
}
-/* else if (c == 3) return; */ /* end of data */
- else break; /* invalid code */
- if (bAbort) abortjob(); /* 1992/Nov/24 */
- if (abortflag) return -1;
+ if (bAbort)
+ abortjob(); /* 1992/Nov/24 */
+
+ if (abortflag)
+ return -1;
}
sprintf(logline, "ERROR: Corrupted Preamble %s\n", procsetfile); /* ??? */
showline(logline, 1);
int writepreamble (FILE *outfile, char *procsetfile, char *procsetrest, int checkflag)
{
FILE *infile;
- int ret=0;
+ int ret = 0;
+
+ if (traceflag)
+ printf("Processing %s (%s)\n", procsetfile, procsetrest);
+
+ if (stripcomment == 0)
+ PSputs("%%BeginResource: ", outfile);
- if (traceflag) printf("Processing %s (%s)\n", procsetfile, procsetrest);
- if (stripcomment == 0) PSputs("%%BeginResource: ", outfile);
if (stripcomment == 0)
{
sprintf(logline, "procset %s %d %d\n", procsetrest, version, revision); /* no subrevision number */
/* if ((infile = fopen(procsetfile, "r")) == NULL) { */
infile = fopen(procsetfile, "rb");
+
if (input == NULL) /* 93/Oct/3 */
{
sprintf(logline, "ERROR: Can't find preamble file `%s'\n", procsetfile);
fclose(infile);
if (abortflag) ret = -1;
}
- if (stripcomment == 0) PSputs("%%EndResource\n", outfile);
+ if (stripcomment == 0)
+ PSputs("%%EndResource\n", outfile);
+
return ret;
}
-
+
/* void copyprologfile(char *filename, FILE *outfile) { */
void copyprologfilesub (char *filename, FILE *outfile)
{
{
showline("[Header", 0);
}
-/* if ((infile = findepsfile(filename)) == NULL) { */
-/* if ((infile = findepsfile(filename, 1)) == NULL) {*/
-/* if ((infile = findepsfile(filename, 1, "ps")) == NULL) { */
+
if ((infile = findepsfile(filename, "ps", 1, 0)) == NULL)
{
-/* fprintf(errout, "Can't find prolog file ");
- perrormod(filename);
- errcount(0); */
}
- else { /* if (infile != NULL) { */
- if (stripcomment == 0) {
-// fputs("%%BeginResource: ", outfile);
+ else
+ {
+ if (stripcomment == 0)
+ {
PSputs("%%BeginResource: ", outfile);
- sprintf(logline, "procset %s\n",
- filename); /* should have version and revision? */
+ sprintf(logline, "procset %s\n", filename); /* should have version and revision? */
PSputs(logline, output);
}
-/* fprintf(outfile, "dvidict begin\n"); */
dvidictbegin(outfile);
copyepssimple(outfile, infile); /* 1993/Jan/24 */
-/* while ((c = getc(infile)) != EOF) putc(c, outfile); */
fclose(infile);
-/* fprintf(outfile, "\nend %% dvidict\n"); */
-// putc('\n', outfile);
PSputc('\n', outfile);
dvidictend (outfile);
- if (stripcomment == 0)
-/* fprintf(outfile, "%%%%EndProcSet\n"); */
-/* fprintf(outfile, "%%%%EndResource\n"); */
-// fputs("%%EndResource\n", outfile);
- PSputs("%%EndResource\n", outfile);
+
+ if (stripcomment == 0)
+ PSputs("%%EndResource\n", outfile);
}
- if (verboseflag) showline("] ", 0);
+
+ if (verboseflag)
+ showline("] ", 0);
}
/* Can handle comma separated list of prolog file names */
{
char *s;
- if (filenames == NULL) return;
+ if (filenames == NULL)
+ return;
s = strtok(filenames, ",;");
while (s != NULL) {
{
FILE *infile;
-// strcat(procsetfile, procsetrest);
strcat(procsetfile, restofname);
extension(procsetfile, "enc");
sprintf(logline, "Trying: %s\n", procsetfile);
showline(logline, 0);
}
+
infile = fopen(procsetfile, "r");
if (infile != NULL)
fclose(infile);
return 0;
}
+
forceexten(procsetfile, "ps");
if (traceflag)
sprintf(logline, "Trying: %s\n", procsetfile);
showline(logline, 0);
}
+
infile = fopen(procsetfile, "r");
if (infile != NULL)
}
// First check whether path specified - if so use directly
-// - then look for header file in dvi file directory
-// - then look in default header file directory
+// - then look for header file in dvi file directory
+// - then look in default header file directory
// - then look in PREPATH directory
-// - then look in dvipsone directory
-// within each directory, look for "foo.enc", then "foo.ps"
+// - then look in dvipsone directory
+// within each directory, look for "foo.enc", then "foo.ps"
// leaves successful file name in procsetfile
// returns non-zero if it fails
if (strpbrk(procsetrest, "\\/:") != NULL)
{
strcpy(procsetfile, procsetrest);
+
infile = fopen(procsetfile, "r");
+
if (infile != NULL)
{
fclose(infile);
strcat(procsetfile, "\\");
}
- if (tryencandps(procsetrest) == 0) return 0;
+ if (tryencandps(procsetrest) == 0)
+ return 0;
strcpy(procsetfile, procsetpath); /* now try default path */
strcat(procsetfile, "\\");
- if (tryencandps(procsetrest) == 0) return 0;
+
+ if (tryencandps(procsetrest) == 0)
+ return 0;
if (programpath != NULL)
{
strcpy(procsetfile, programpath); /* now try default path */
strcat(procsetfile, "\\");
- if (tryencandps(procsetrest) == 0) return 0;
+ if (tryencandps(procsetrest) == 0)
+ return 0;
}
-
}
return -1; // failed
}
int nesting = 0; /* 1999/Feb/28 */
int escape = 0; /* 1999/Feb/28 */
-/* if (wantchksum != 0) fprintf(outfile, "%% CheckSum %s\n", hexmagic); */
-/* if (stripcomment == 0)
- fprintf(outfile, "%% %s\n", comment); */ /* bPassed from Tex */
-/* if (wantcpyrght != 0) */
-/* fprintf(outfile, "%% %s\n", copyright); */
-
-/* textextwritten = 0; */ /* 1992/Nov/19 */
-/* ansiwritten = 0; */ /* 1993/Sep/30 */
-
-/* NOTE: Nothing but ProcSets allowed in Prolog */
-/* if (stripcomment == 0) fputs("%%BeginProlog\n", outfile); */
-
-/* copy DVIPSONE preamble file */
-/* create own dictionary in case userdict is nearly full */
-/* do we know how many fonts yet ? */ /* reduce DVIDICT default size */
-/* fprintf(outfile, "/dvidict %d dict def\n", dvidictsize); */
-/* printf("dvidictsize %d fnext %d\n", dvidictsize, fnext); *//* debugging */
sprintf(logline, "/dvidict %d dict def\n", dvidictsize + fnext);
PSputs(logline, output);
+
if (setupprocset(procsetrest) != 0)
{
sprintf(logline, "ERROR: Problem with %s\n", procsetrest);
showline(logline, 1);
return -1;
}
+
#ifdef _WINDOWS
(void) WritePrivateProfileString(achDiag, "ProcSetFile", procsetfile, achFile);
#endif
+
if (writepreamble(outfile, procsetfile, procsetrest, 1) != 0)
{
sprintf(logline, "ERROR: Problem with %s\n", procsetfile);
showline(logline, 1);
return -1;
}
- if (abortflag) return -1;
+
+ if (abortflag)
+ return -1;
/* copy TPIC preamble file */
if (needtpic != 0)
showline(logline, 1);
return -1;
}
+
if (writepreamble(output, procsetfile, tpicrest, 0) != 0)
{
sprintf(logline, "ERROR: Problem with %s\n", procsetfile);
showline(logline, 1);
return -1;
}
- if (abortflag) return -1;
+
+ if (abortflag)
+ return -1;
}
/* copy user specified prolog file */
/* first do the ones stipulated on the command line */
for (k = 0; k < prologfileindex; k++) /* 1993/Dec/21 */
{
-/* if (strcmp(prologfile[k], "") == 0) break; */
copyprologfiles(prologfile[k], output);
- if (abortflag) return -1;
+ if (abortflag)
+ return -1;
}
+
/* then do the ones specified in \specials */
-// if (strcmp(headerfile, "") != 0)
if (headerfile != NULL)
{
copyprologfiles(headerfile, output);
- if (abortflag) return -1;
+ if (abortflag)
+ return -1;
}
- if (headertext != NULL) { /* verbatim headers 1993/Dec/29 */
-/* fprintf(outfile, "dvidict begin\n"); */
+
+ if (headertext != NULL) /* verbatim headers 1993/Dec/29 */
+ {
dvidictbegin(outfile);
- if (bWrapSpecial == 0) { // just copy it across
-/* fputs(headertext, output); */
+ if (bWrapSpecial == 0) // just copy it across
+ {
PSputs(headertext, output);
}
- else {
+ else
+ {
column = 0;
u = headertext;
c = *u++; /* do something different if this is " ? */
/* The following wraps lines to avoid problems in PS output from \special */
/* But it does run the danger of putting a line break in a string ... */
while (c != '\0') { /* 1994/June/27 */
-// putc(c, output);
PSputc(c, output);
- c = *u++;
+ c = *u++;
/* crude effort to prevent exessively long lines - wrap line at space */
- if (c == '\n') column = 0;
- else column++;
- if (escape == 0) {
- if (c == '(') nesting++;
- else if (c == ')') nesting--;
- else if (c == '\\') escape++;
+ if (c == '\n')
+ column = 0;
+ else
+ column++;
+
+ if (escape == 0)
+ {
+ if (c == '(')
+ nesting++;
+ else
+ {
+ if (c == ')')
+ nesting--;
+ else
+ {
+ if (c == '\\')
+ escape++;
+ }
+ }
}
- else escape = 0;
-/* if (bWrapSpecial && column > WRAPCOLUMN && c == ' ') */
- if (nesting == 0 && column > WRAPCOLUMN && c == ' ') {
+ else
+ escape = 0;
+
+ if (nesting == 0 && column > WRAPCOLUMN && c == ' ')
+ {
c = '\n';
column = 0;
}
}
}
-/* fprintf(outfile, "\nend %% dvidict\n"); */
+
dvidictend(outfile);
-/* free(headertext); */ /* get rid of it again */
free(headertext);
headertext = NULL;
headertextlen = 0;
}
-/* if (stripcomment == 0) fputs("%%EndProlog\n", outfile); *//* 1992/July/18 */
+
return 0;
}
/* int k; */
/* NOTE: following wrapped in begin/end on `dvidict' */
/* dvidictbegin(outfile); */
- if (busedviencode != 0) writedviencode(outfile); /* NOT in dvipream */
- else if (bAllowTexText != 0) writetextext(outfile);
-/* if (bWindowsFlag != 0) writeansicode(outfile); */ /* 93/Sep/30 */
- if (bWindowsFlag != 0) {
-/* if (strcmp(textencoding, "ansinew") == 0) writeansicode(outfile);
- else writetextencode(outfile, textencoding); */
- if (strcmp(textencoding, "ansinew") != 0) {
+ if (busedviencode != 0)
+ writedviencode(outfile); /* NOT in dvipream */
+ else
+ {
+ if (bAllowTexText != 0)
+ writetextext(outfile);
+ }
+
+ if (bWindowsFlag != 0)
+ {
+ if (strcmp(textencoding, "ansinew") != 0)
+ {
readtextencode(textencoding); /* user selected ENCODING 94/Dec/17*/
}
-/* if (bAllowANSI) writeansicode(outfile, textencoding); */
-/* figure out expected TFM checksum ahead of time for speed */
+
textenconame = removepath(textencoding); /* 95/Feb/3 */
nCheckSum = codefourty(textenconame); /* 95/Feb/3 */
- if (bAllowANSI) writeansicode(outfile, textenconame); /* 95/Feb/3 */
+
+ if (bAllowANSI)
+ writeansicode(outfile, textenconame); /* 95/Feb/3 */
}
/* maybe make conditional on bAllowANSI ? */
/* dvidictend(outfile); */
void writetrailer (FILE *outfile)
{
-/* do trailer of sorts here ? */
-/* putc('\n', outfile); */ /* omission slightly risky ? */
if (stripcomment == 0)
{
-/* fprintf(outfile, "%%%%Trailer\n"); */
-// fputs("%%Trailer\n", outfile);
- PSputs("%%Trailer\n", outfile);
-/* fprintf(outfile, "%%%%EOF\n"); */
-// fputs("%%EOF\n", outfile);
+ PSputs("%%Trailer\n", outfile);
PSputs("%%EOF\n", outfile);
}
-/* if (wantcontrold != 0 || directprint != 0) putc(4, outfile); */ /* C-D */
+
if (wantcontrold || (directprint && stripcomment)) /* 1993/Mar/5 */
-// putc(4, outfile); /* C-D */
PSputc(4, outfile); /* C-D */
}
// The decrypted owner string may contain \xyz to indicate char <xyz>
// Or it may contain DOS 850 accented characters
-void showownerout (char *oline, int pdfflag, int nlen)
+void showownerout (char *oline)
{
char *s = oline;
*s = '\0';
strcpy(s, getenv("TEXAUTH"));
-// if (serialnumber > 0) {
-// showowner(s, hexmagic, nlen);
-// while ((s = strchr(s+1, '@')) != NULL) *s = ' ';
-// s = oline + strlen(oline) - 1;
-// if (*s < ' ') *s = '\0'; /* flush trailing newline */
-// if (pdfflag) map850topdf(oline, sizeof(line));
-// if (pdfflag) map850topdf(oline, nlen);
-// fprintf(output, "%s", line);
-// }
-// else strcpy(s, "UNKNOWN");
-// else showline("SERIALNUMBER == 0", 1); // debugging only
-}
-
-void showowner (char *buff, char *sour, int nlen)
-{
- unsigned short cryptma = REEXEC; /* int */
- unsigned char e;
- int i;
- char *s = sour, *t = buff;
-
- if (serialnumber == 0) { /* not customized ... */
- *buff = '\0';
- return;
- }
- for (i = 0; i < 4; i++) /* prime the pump - discard key */
- e = decryptbyte((unsigned char) *s++, &cryptma);
- for (i = 4; i < nlen; i++) {
- e = decryptbyte((unsigned char) *s++, &cryptma);
- *t++ = (char) e; /* unsigned char => char ? */
- if (e == 0) break; /* null byte termination */
- }
- *t = '\0'; /* terminate it */
-
-/* This eventually won't be used anymore \xyz */
- t = buff; /* postprocess for accented characters */
- i = 0;
- while ((e = *t) != '\0') {
- if (e == '\\') { /* look for \xyz string */
-/* winerror(t); */
- i = 0; s = t; t++;
- while ((e = *t) >= '0' && e <= '9') {
- i = (i * 10) + (e - '0');
- t++;
- }
- if (i != 0) *s++ = (char) i;
- strcpy(s, t);
- t = s;
- if (e == 0) break;
- continue; /* 1992/Jan/3 */
- }
- t++;
- }
-}
-
-/* if (pdfflag && e < ' ') break; */ /* 1996/Feb/25 */
-
-/* check whether encrypted owner has been tampered with */
-/* also check whether DEMO version */
-/* decrypted format is "Berthold K.P. Horn@100@1998 May 23 07:43:48\n" */
-
-int checkowner(char *hex, char *buffer, int nlen)
-{
- unsigned short cryptma = REEXEC; /* int */
- unsigned char e=0;
- int i, k;
- char *s=hex;
- char *t=buffer; /* should be enough space there */
-
-/* check first whether it is pre-customized version of executable */
-
-// i = 0; /* first check on pre-release version */
-// for (k = 4; k < 32; k++) { /* assumes pattern wavelength 4 */
-// if (*(s+k) != *(s+k-4)) {
-// i = 1;
-// break;
-// }
-// }
-// if (i == 0) { /* uncustomized */
-// showline("SORRY: NOT CUSTOMIZED!\n", 1);
-// if (getenv("CARLISLE") == NULL &&
-// getenv("CONCORD") == NULL &&
-// getenv("CAMBRIDGE") == NULL &&
-// getenv("CONWAY") == NULL) return -1;
-// return 0;
-// }
-//
-/* modified 97/May/23 to allow DOS 850 accented characters, */
-/* but also now disallows control characters, and checks signature */
-// for (i = 0; i < 4; i++) {
-// e = decryptbyte((unsigned char) *s++, &cryptma);
-/* if (e < 32 || e > 126) { */
-// if (e < 'a' || e > 'z') { /* should be all lower case */
-// return -1; /* tampered with signature */
-// }
-// }
-// for (i = 4; i < nlen; i++) {
-// e = decryptbyte((unsigned char) *s++, &cryptma);
-// *t++ = e; /* assemble line */
-// if (e == 0) break;
-// if (e < 32) {
-// if (e != 10 && e != 13 && e != 9) break; /* tampered with ! */
-// }
-// else if (e > 127) {
-// if (e == 156 || e == 158 || e == 159) break;
-// if (e > 165 && e < 181) break;
-// if (e > 183 && e < 198) break;
-// if (e > 199 && e < 208) break;
-// if (e > 216 && e < 222) break;
-// if (e == 223 || e == 230) break;
-// if (e > 237) break;
-/* could instead reject if dos850topdf[c-128] == 0 */
-// }
-// }
-// if (e != 0) *t++ = '\0';
-// if (e != 0) return -1;
-// if (strchr(buffer, '@') == NULL) return -1;
-#ifdef ALLOWDEMO
-/* if (strstr(line, "DEMO") != NULL) bDemoFlag = 1; */
-/* else bDemoFlag = 0; */
-#endif
-// if ((s = strstr(buffer, "DEMO")) != NULL) { /* 98/May/20 */
-// if (sscanf(s+4, "%d", &bDemoFlag) == 0)
-// bDemoFlag = 1;
-// }
-
- return 0; /* seems ok ! */
-}
-
-unsigned long checkcopyright (char *s)
-{
- int c;
- unsigned long hashed=0;
-
- while ((c = *s++) != '\0')
- hashed = (hashed * 53 + c) & 16777215; /* 2^24 - 1 */
- if (hashed == COPYHASH) return 0; /* change if copyright changed */
- strcpy(logline, "EXE FILE CORRUPTED ");
- if (traceflag) {
- char *s=logline + strlen(logline);
- sprintf(s, "%d\n", hashed);
- }
- strcat(logline, "\n");
- showline(logline, 1);
- return hashed;
}
double roundtime(long, long);
int oldmaxranges = maxranges;
int k;
- if (maxranges == 0) maxranges = MAXRANGES; // first time
- else maxranges = maxranges * 2; // expansion
+ if (maxranges == 0)
+ maxranges = MAXRANGES; // first time
+ else
+ maxranges = maxranges * 2; // expansion
+
beginpages = (long *) realloc(beginpages, maxranges * sizeof(long));
endpages = (long *) realloc(endpages, maxranges * sizeof(long));
pagerangeseq = (int *) realloc(pagerangeseq, maxranges * sizeof(long));
endpages[k] = LINFINITY;
pagerangeseq[k] = -1;
}
+
return 0;
}
/* so it works somewhat differently from changed.c */
/* adds to page ranges already established using -B= -E= etc */
-char *delimiters=",.;:+_|~^/#!*"; /* imported from changed.c */
+char *delimiters = ",.;:+_|~^/#!*"; /* imported from changed.c */
int newpageranges (char *pages) /* 1994/July/6 */
{
char *s;
int page, bpage, epage, temp;
-/* rangeindex = 0; */ /* don't reset ? */
-/* countzeroflag = 1; */ /* default, don't need to reset this ? */
beginorend = -1; /* matched begin / end pair */
s = strtok (pages, delimiters);
while (s != NULL) {
if (rangeindex >= maxranges)
{
- if (expandpageranges() < 0) break;
+ if (expandpageranges() < 0)
+ break;
}
+
if (rangeindex >= maxranges)
{
sprintf(logline, " ERROR: Too many page ranges (> %d): %s\n",
showline(logline, 1);
break;
}
+
if (sscanf(s, "%d-%d", &bpage, &epage) == 2)
{
if (bpage > epage)
epage = bpage;
bpage = temp;
}
+
beginpages[rangeindex] = (long) bpage;
endpages[rangeindex] = (long) epage;
pagerangeseq[rangeindex] = -1;
rangeindex++;
}
else
+ {
if (sscanf(s, "%d", &page) == 1)
{
beginpages[rangeindex] = (long) page;
sprintf(logline, " Error in page range: %s", s);
showline(logline, 1);
}
+ }
+
s = strtok (NULL, delimiters);
}
-/* if (traceflag) {
- int k;
- printf("There %s %d page range%s\n",
- (rangeindex == 1) ? "is" : "are", rangeindex,
- (rangeindex == 1) ? "" : "s");
- for (k = 0; k < rangeindex; k++)
- printf("%d - %d\n", (int) beginpages[k], (int) endpages[k]);
- } */
-/* selectpages = 1; */
+
return rangeindex;
}
void complaincommand (char *command, char *s)
{
sprintf(logline, "Don't understand: %s ", command);
+
if (s != NULL && strlen(s) < sizeof(logline) - strlen(logline))
strcat(logline, s);
showline(logline, 1);
-// if (s != NULL) showline(s, 1);
showline("\n", 0);
}
int decodearg (char *command, char *next, int firstarg)
{
char *s;
- char *sarg=command;
+ char *sarg = command;
int c, n, flag;
int instance;
int toggle;
int temp;
- if (*sarg == '-' || *sarg == '/') sarg++; /* step over `-' or `/' */
- if (*sarg == '\0') return firstarg+1; // 2000/April/4
+ if (*sarg == '-' || *sarg == '/')
+ sarg++; /* step over `-' or `/' */
+
+ if (*sarg == '\0')
+ return firstarg+1; // 2000/April/4
+
while ((c = *sarg++) != '\0') { /* until end of string */
toggle = 0; /* toggle state */
- if (c == '0') {
+
+ if (c == '0')
+ {
c = *sarg++; toggle = -1; /* force off */
}
- else if (c == '1') {
- c = *sarg++; toggle = +1; /* force on */
+ else
+ {
+ if (c == '1')
+ {
+ c = *sarg++;
+ toggle = +1; /* force on */
+ }
}
- if (c == '*') c = *sarg++ + 128; /* escape 94/Mar/4 */
- else if (c == '$') { /* new escape 96/Apr/4 */
- c = *sarg++;
- if (c >= 96 && c < 128) c = c + 128 - 96; /* use 128 -- 159 */
- else if (c >= 64 && c < 96) c = c + 0 - 64; /* use 0 -- 31 */
- else {
- complaincommand(command, NULL);
- return firstarg;
+
+ if (c == '*')
+ c = *sarg++ + 128; /* escape 94/Mar/4 */
+ else
+ {
+ if (c == '$') /* new escape 96/Apr/4 */
+ {
+ c = *sarg++;
+
+ if (c >= 96 && c < 128)
+ c = c + 128 - 96; /* use 128 -- 159 */
+ else
+ {
+ if (c >= 64 && c < 96)
+ c = c + 0 - 64; /* use 0 -- 31 */
+ else
+ {
+ complaincommand(command, NULL);
+ return firstarg;
+ }
+ }
}
- };
-// printf("DECODE %d ", c); // debugging only
-/* if (decodeflag(c) != 0) { */ /* flag requires argument ? */
+ }
+
flag = decodeflag(c, toggle);
- if (flag < 0) return -1;
- if (flag > 0) { /* flag requires argument ? */
-/* if ((s = strchr(sarg, '=')) == NULL) { */
-/* if (*sarg != '=' && *sarg != ':') { */ /* arg in same string ? */
- if (*sarg != '=' && *sarg != ':' && *sarg != '#') { /* 93/Sep/8 */
- if (next != NULL) {
+
+ if (flag < 0)
+ return -1;
+
+ if (flag > 0) /* flag requires argument ? */
+ {
+ if (*sarg != '=' && *sarg != ':' && *sarg != '#') /* 93/Sep/8 */
+ {
+ if (next != NULL)
+ {
firstarg++; s = next; /* when `=' or `:' is NOT used */
}
- else {
+ else
+ {
complaincommand(command, NULL);
return firstarg;
}
}
-/* else s++; */ /* when `=' IS used */
- else s = sarg+1; /* when `=' or `:' or `#' IS used */
+ else
+ s = sarg+1; /* when `=' or `:' or `#' IS used */
/* now analyze the various flags that could have gotten set */
- if (beginflag != 0) {
+ if (beginflag != 0)
+ {
instance=-1; /* 1994/Jan/16 */
-/* if (sscanf(s, "%ld", &beginpage) < 1) */
- if (sscanf(s, "%ld:%d", &beginpage, &instance) < 1)
-/* fprintf(errout, "Don't understand begin: %s\n", s); */
+
+ if (sscanf(s, "%ld:%d", &beginpage, &instance) < 1)
complaincommand(command, s);
- else if (beginorend > 0) {
- showline(" WARNING: begin follows begin\n", 1);
- }
- else {
-/* printf("BEGIN %d ", beginpage); */
- beginorend = 1;
- if (countzeroflag == 0) instance = -1;
- if (rangeindex >= maxranges) {
- if (expandpageranges() < 0) break;
- }
-// if (rangeindex == maxranges)
- if (rangeindex >= maxranges) {
-/* fprintf(errout, " WARNING: too many begins\n"); */
- showline(" WARNING: too many begins\n", 1);
+ else
+ {
+ if (beginorend > 0)
+ {
+ showline(" WARNING: begin follows begin\n", 1);
}
- else if (rangeindex < maxranges) {
- pagerangeseq[rangeindex] = instance;
- beginpages[rangeindex] = (long) beginpage;
+ else
+ {
+ beginorend = 1;
+
+ if (countzeroflag == 0)
+ instance = -1;
+
+ if (rangeindex >= maxranges)
+ {
+ if (expandpageranges() < 0) break;
+ }
+
+ if (rangeindex >= maxranges)
+ {
+ showline(" WARNING: too many begins\n", 1);
+ }
+ else
+ {
+ if (rangeindex < maxranges)
+ {
+ pagerangeseq[rangeindex] = instance;
+ beginpages[rangeindex] = (long) beginpage;
+ }
+ }
}
}
beginflag = 0;
}
- else if (endflag != 0) {
- instance=-1; /* 1994/Jan/16 */
-/* if (sscanf(s, "%ld", &endpage) < 1) */
+ else if (endflag != 0)
+ {
+ instance=-1;
+
if (sscanf(s, "%ld:%d", &endpage, &instance) < 1)
-/* fprintf(errout, "Don't understand end: %s\n", s); */
complaincommand(command, s);
- else if (beginorend < 0) {
+ else if (beginorend < 0)
+ {
showline(" WARNING: end follows end\n", 1);
}
- else {
-/* printf("END %d ", endpage); */
+ else
+ {
beginorend = -1;
- if (countzeroflag == 0) instance = -1;
- if (rangeindex >= maxranges) {
- if (expandpageranges() < 0) break;
+
+ if (countzeroflag == 0)
+ instance = -1;
+
+ if (rangeindex >= maxranges)
+ {
+ if (expandpageranges() < 0)
+ break;
}
-// if (rangeindex == maxranges)
- if (rangeindex >= maxranges) {
+
+ if (rangeindex >= maxranges)
+ {
showline(" WARNING: too many ends\n", 1);
}
- else if (rangeindex < maxranges) {
- if (instance >= 0) pagerangeseq[rangeindex] = instance;
+ else if (rangeindex < maxranges)
+ {
+ if (instance >= 0)
+ pagerangeseq[rangeindex] = instance;
+
endpages[rangeindex++] = (long) endpage;
}
}
endflag = 0;
}
- else if (copiesflag != 0) {
- if (sscanf(s, "%d", &copies) < 1) {
-/* fprintf(errout, "Don't understand copies: %s\n", s); */
+ else if (copiesflag != 0)
+ {
+ if (sscanf(s, "%d", &copies) < 1)
+ {
complaincommand(command, s);
}
copiesflag = 0;
}
- else if (magniflag != 0) {
- if(sscanf(s, "%lg", &magnification) < 1) {
-/* fprintf(errout, "Don't understand magnify: %s\n", s); */
+ else if (magniflag != 0)
+ {
+ if(sscanf(s, "%lg", &magnification) < 1)
+ {
complaincommand(command, s);
}
+
if (magnification > 33.33) /* 1992/July/16 */
magnification = magnification/1000.0;
- if (xmagnification == 0.0) xmagnification = magnification;
- else if (ymagnification == 0.0) ymagnification = magnification;
- else {
+
+ if (xmagnification == 0.0)
+ xmagnification = magnification;
+ else if (ymagnification == 0.0)
+ ymagnification = magnification;
+ else
+ {
showline("Use `m' no more than twice\n", 1);
complaincommand(command, s);
}
magniflag = 0;
}
- else if (rotateflag != 0) {
- if(sscanf(s, "%lg", &rotation) < 1) {
-/* fprintf(errout, "Don't understand rotate: %s\n", s); */
+ else if (rotateflag != 0)
+ {
+ if(sscanf(s, "%lg", &rotation) < 1)
+ {
complaincommand(command, s);
}
rotateflag = 0;
}
- else if (xoffsetflag != 0) {
- if(sscanf(s, "%lg", &xoffset) < 1) {
-/* fprintf(errout, "Don't understand x off: %s\n", s); */
+ else if (xoffsetflag != 0)
+ {
+ if(sscanf(s, "%lg", &xoffset) < 1)
+ {
complaincommand(command, s);
}
- if (xoffsete != UNKNOWNOFFSET) {
- if (xoffseto != UNKNOWNOFFSET) {
+
+ if (xoffsete != UNKNOWNOFFSET)
+ {
+ if (xoffseto != UNKNOWNOFFSET)
+ {
sprintf(logline, "Too many %s offsets\n", "x");
showline(logline, 1);
}
- else xoffseto= xoffset;
+ else
+ xoffseto= xoffset;
}
- else xoffsete= xoffset;
+ else
+ xoffsete= xoffset;
xoffsetflag = 0;
}
- else if (yoffsetflag != 0) {
- if(sscanf(s, "%lg", &yoffset) < 1) {
-/* fprintf(errout, "Don't understand y off: %s\n", s); */
+ else if (yoffsetflag != 0)
+ {
+ if(sscanf(s, "%lg", &yoffset) < 1)
+ {
complaincommand(command, s);
}
- if (yoffsete != UNKNOWNOFFSET) {
- if (yoffseto != UNKNOWNOFFSET) {
+
+ if (yoffsete != UNKNOWNOFFSET)
+ {
+ if (yoffseto != UNKNOWNOFFSET)
+ {
sprintf(logline, "Too many %s offsets\n", "y");
showline(logline, 1);
}
- else yoffseto= yoffset;
+ else
+ yoffseto= yoffset;
}
- else yoffsete= yoffset;
+ else
+ yoffsete= yoffset;
yoffsetflag = 0;
}
- else if (dvidictflag != 0) { /* 1992/Nov/17 */
+ else if (dvidictflag != 0)
+ {
if (sscanf(s, "%d", &dvidictsize) < 1)
complaincommand(command, s);
+
dvidictflag = 0;
}
- else if (versionflag != 0) { /* 1995/July/15 */
+ else if (versionflag != 0)
+ {
if (sscanf(s, "%d", &bCheckVersion) < 1)
complaincommand(command, s);
+
versionflag = 0;
}
- else if (repeatflag != 0) { /* 1995/Aug/27 */
+ else if (repeatflag != 0)
+ {
if (sscanf(s, "%d", &nRepeatCount) < 1)
complaincommand(command, s);
- if (nRepeatCount < 0) nRepeatCount = - nRepeatCount;
+
+ if (nRepeatCount < 0)
+ nRepeatCount = - nRepeatCount;
+
repeatflag = 0;
}
- else if (minruleflag != 0) { /* 1995/Oct/10 */
+ else if (minruleflag != 0)
+ {
if (sscanf(s, "%ld", &nMinRule) < 1)
complaincommand(command, s);
+
minruleflag = 0;
}
- else if (defdpiflag != 0) { /* 1996/Apr/4 */
+ else if (defdpiflag != 0)
+ {
if (sscanf(s, "%d", &nDefaultTIFFDPI) < 1)
complaincommand(command, s);
- defdpiflag = 0;
+
+ defdpiflag = 0;
}
- else if (emeraldflag != 0) {
- if (sscanf(s, "%lg", &outscale) < 1) {
-/* fprintf(errout, "Don't understand scale: %s\n", s); */
+ else if (emeraldflag != 0)
+ {
+ if (sscanf(s, "%lg", &outscale) < 1)
+ {
complaincommand(command, s);
}
- else outscaleflag=1;
+ else
+ outscaleflag=1;
+
emeraldflag = 0;
}
- else if (halftoneflag != 0) {
+ else if (halftoneflag != 0)
+ {
n = 0;
- if (sscanf(s, "%d%c%d", &frequency, &n, &angle) < 1) {
-/* fprintf(errout, "Don't understand frequency: %s\n", s); */
+ if (sscanf(s, "%d%c%d", &frequency, &n, &angle) < 1)
+ {
complaincommand(command, s);
}
- else {
- if (n == '+') freqrelation = +1; /* min frequency */
- else if (n == '-') freqrelation = -1; /* max frequency */
- else freqrelation = 0; /* force frequen */
+ else
+ {
+ if (n == '+')
+ freqrelation = +1; /* min frequency */
+ else if (n == '-')
+ freqrelation = -1; /* max frequency */
+ else
+ freqrelation = 0; /* force frequen */
}
halftoneflag = 0;
}
- else if (pathflag != 0) {
- fontpath = s; pathflag = 0;
+ else if (pathflag != 0)
+ {
+ fontpath = s;
+ pathflag = 0;
}
-/* else if (subfileflag != 0) {
- fontsubrest = s; subfileflag = 0;
- } */
- else if (subfileflag != 0) {
- if (subfontfileindex == MAXSUBFILES) {
- sprintf(logline, "Too many %s files\n", "substitution");
+ else if (subfileflag != 0)
+ {
+ if (subfontfileindex == MAXSUBFILES)
+ {
+ sprintf(logline, "Too many %s files\n", "substitution");
showline(logline, 1);
}
- else subfontfile[subfontfileindex++] = s;
+ else
+ subfontfile[subfontfileindex++] = s;
subfileflag = 0;
- }
- else if (paperflag != 0) {
- papertype = s; paperflag = 0;
}
- else if (boundingflag != 0) { /* 1994/May/6 */
- boundingtype = s; boundingflag = 0;
+ else if (paperflag != 0)
+ {
+ papertype = s;
+ paperflag = 0;
}
- else if (dscextraflag != 0) { /* 1994/May/6 */
- dscextra = s; dscextraflag = 0;
+ else if (boundingflag != 0)
+ {
+ boundingtype = s;
+ boundingflag = 0;
}
- else if (afmflag != 0) {
- afmpath = s; afmflag = 0;
+ else if (dscextraflag != 0)
+ {
+ dscextra = s;
+ dscextraflag = 0;
}
- else if (tfmflag != 0) {
- tfmpath = s; tfmflag = 0;
+ else if (afmflag != 0)
+ {
+ afmpath = s;
+ afmflag = 0;
+ }
+ else if (tfmflag != 0)
+ {
+ tfmpath = s;
+ tfmflag = 0;
}
- else if (pfmflag != 0) {
- if (sscanf(s, "%d", &temp) == 1) newpageranges(s);
- else pfmpath = s;
+ else if (pfmflag != 0)
+ {
+ if (sscanf(s, "%d", &temp) == 1)
+ newpageranges(s);
+ else
+ pfmpath = s;
+
pfmflag = 0;
- }
- else if (vecpathflag != 0) {
- vecpath = s; vecpathflag = 0;
}
- else if (subpathflag != 0) {
- fontsubpath = s; subpathflag = 0;
+ else if (vecpathflag != 0)
+ {
+ vecpath = s;
+ vecpathflag = 0;
+ }
+ else if (subpathflag != 0)
+ {
+ fontsubpath = s;
+ subpathflag = 0;
}
- else if (prepathflag != 0) {
- procsetpath = s; prepathflag = 0;
+ else if (prepathflag != 0)
+ {
+ procsetpath = s;
+ prepathflag = 0;
}
- else if (encodeflag != 0) { /* experiment 1995/Aug/14 */
+ else if (encodeflag != 0)
+ {
textencoding = s;
- if ((s = strrchr(textencoding, '.')) != NULL) *s = '\0';
+
+ if ((s = strrchr(textencoding, '.')) != NULL)
+ *s = '\0';
+
bWindowsFlag = 1;
encodeflag = 0;
}
- else if (outputflag != 0) {
- outputfile = s; outputflag = 0;
+ else if (outputflag != 0)
+ {
+ outputfile = s;
+ outputflag = 0;
}
- else if (epsflag != 0) {
- epspath = s; epsflag = 0;
+ else if (epsflag != 0)
+ {
+ epspath = s;
+ epsflag = 0;
}
- else if (prologflag != 0) {
- if (prologfileindex == MAXPROLOGS) {
+ else if (prologflag != 0)
+ {
+ if (prologfileindex == MAXPROLOGS)
+ {
sprintf(logline, "Too many %s files\n", "header");
showline(logline, 1);
}
- else prologfile[prologfileindex++] = s;
+ else
+ prologfile[prologfileindex++] = s;
+
prologflag = 0;
- }
- else if (prefixflag != 0) {
- fontprefix = s; prefixflag = 0;
- }
+ }
+ else if (prefixflag != 0)
+ {
+ fontprefix = s;
+ prefixflag = 0;
+ }
break; /* default - no flag set */
}
}
int c, flag;
char *s;
-/* if (argc < 2) showusage(argv[0]); */
- if (argc < firstarg+1)
+ if (argc < firstarg + 1)
{
-// showusage(argv[0]); /* 1994/Oct/15 */
return -1; // 2000 June 21
}
+
c = argv[firstarg][0];
-/* while (c == '-' || c == '/') { */
+
while (c == '-' || c == '/' || c == '@') { /* 1993/Sep/7 */
- if (c == '@') { /* 1993/Sep/7 */
+ if (c == '@')
+ {
s = argv[firstarg]+1;
flag = readcommands(s);
- if (flag < 0) return -1;
- if (flag == 0) {
+
+ if (flag < 0)
+ return -1;
+
+ if (flag == 0)
+ {
sprintf(logline, " ERROR: Cannot find command file %s\n", s);
showline(logline, 1);
errcount(0);
}
+
firstarg++;
}
- else { /* - or / */
+ else
+ {
+ /* - or / */
firstarg = decodearg(argv[firstarg], argv[firstarg+1], firstarg+1);
- if (firstarg < 0) return -1;
+
+ if (firstarg < 0)
+ return -1;
}
- if (firstarg >= argc) break; /* safety valve */
+
+ if (firstarg >= argc)
+ break; /* safety valve */
+
c = argv[firstarg][0];
}
return firstarg;
else if ((s=strrchr(pathname, '/')) != NULL) ;
else if ((s=strrchr(pathname, ':')) != NULL) s++;
else s = pathname;
-/* if (s > pathname && *(s-1) == ':') *s++ = '\\'; */
+
*s = '\0';
}
void replaceletter (char *s, int old, int new)
{
int c;
+
while ((c = *s) != '\0') {
- if (c == old) *s = (char) new;
+ if (c == old)
+ *s = (char) new;
s++;
}
}
void lowercase (char *t, char *s)
{
int c;
+
while ((c = *s++) != '\0') {
- if (c >= 'A' && c <= 'Z') *t++ = (char) (c + ('a' - 'A'));
- else *t++ = (char) c;
+ if (c >= 'A' && c <= 'Z')
+ *t++ = (char) (c + ('a' - 'A'));
+ else
+ *t++ = (char) c;
}
*t = '\0';
}
void uppercase (char *t, char *s)
{
int c;
+
while ((c = *s++) != '\0') {
- if (c >= 'a' && c <= 'z') *t++ = (char) (c - ('a' - 'A'));
- else *t++ = (char) c;
+ if (c >= 'a' && c <= 'z')
+ *t++ = (char) (c - ('a' - 'A'));
+ else
+ *t++ = (char) c;
}
*t = '\0';
}
{
/* by the way: err should be SIGINT at this point --- err never used */
(void) signal(SIGINT, SIG_IGN); /* disallow control-C */
- if (bAbort++ >= 3) exit(3); /* emergency exit */
+
+ printf("\nSIG: %d.\n", err);
+
+ if (bAbort++ >= 3)
+ exit(3); /* emergency exit */
+
(void) signal(SIGINT, ctrlbreak); /* reenable */
}
#endif
int flag;
s = strtok(line, " \t\n\r"); /* first token */
+
while (s != NULL) {
sn = strtok(NULL, " \t\n\r"); /* go to next token */
-/* printf("s: %s sn: %s ", s, sn); */ /* debugging */
- if (*s == '-') { /* is it a command line argument or flag ? */
+
+ if (*s == '-')
+ {
+ /* is it a command line argument or flag ? */
flag = decodearg(s, sn, 0);
- if (flag < 0) return -1;
- if (flag > 0) {
+
+ if (flag < 0)
+ return -1;
+
+ if (flag > 0)
+ {
sn = strtok(NULL, " \t"); /* go to next token */
}
}
strcpy(commandfile, filename);
extension(commandfile, "cmd");
command = fopen(commandfile, "r");
- if (command == NULL) {
+
+ if (command == NULL)
+ {
/* If that fails, try in DVIPSONE program directory */
-/* strcpy(commandfile, programpath); */
if (programpath != NULL)
strncpy(commandfile, programpath, MAXPATHLEN);
- else strcpy(commandfile, "");
-/* don't need fancy footwork, since programpath non-empty */
+ else
+ strcpy(commandfile, "");
+
strcat(commandfile, "\\");
-/* strcat(commandfile, dvipsonecmd); */
strcat(commandfile, filename);
extension(commandfile, "cmd");
+
command = fopen(commandfile, "r");
+
if (command == NULL)
{
-/* perrormod(commandfile); */ /* debugging only */
strcpy(commandfile, ""); /* indicate failed - 94/Mar/4 */
return 0; /* no command line file DVIPSONE.CMD */
}
/* allow for multiple lines --- ignore args that don't start with `-' */
while (fgets(line, MAXLINE, command) != NULL) {
-/* printf("From %s:\t%s", commandfile, line); */
-/* skip over comment lines and blank lines */
- if (*line == '%' || *line == ';' || *line == '\n') continue;
+ if (*line == '%' || *line == ';' || *line == '\n')
+ continue;
+
if (strchr(line, '\n') == NULL) strcat(line, "\n");
-/* printf("From %s:\t%s", commandfile, line); */
+
linedup = zstrdup(line);
- if (linedup != NULL) {
+
+ if (linedup != NULL)
+ {
if (scancommands(linedup) < 0) return -1; // failure
}
}
return 1; // success
}
-#ifdef ALLOWDEMO
-int monthnumber(char *smonth)
-{
- int k;
- char *s = months;
- for (k = 0; k < 12; k++)
- {
- if (strncmp(smonth, s, 3) == 0) return k;
- s += 3;
- }
- return 0; /* Say what? */
-}
-
-void stripcolon(char *s)
-{
- while ((s = strchr(s+1, ':')) != NULL) *s = ' ';
-}
-
-/* Owner is of form "Berthold K.P. Horn@100@1998 May 23 07:43:48\n" */
-/* now returns seconds since customized */
-time_t checkdemo(char *owner)
-{
- time_t ltime, otime; /* for date and time */
- time_t dtime; /* seconds since customized */
- struct tm loctim;
- int year, month, day;
- int hour, min, sec;
- char buffer[64];
- char *s;
-
-/* first calculate compilation time */ /* not used anymore */
-/* sscanf(compiledate, "%s %d %d", buffer, &day, &year); */
- s = owner; /* use customization time instead */
- if (*s < ' ') return 0; /* uncustomized */
-/* check that there are two occurences of @ - and step to date part */
- if ((s = strchr(s+1, '@')) == NULL) return -1;
- if ((s = strchr(s+1, '@')) == NULL) return -1;
- stripcolon(s+1);
- if (sscanf(s+1, "%d %s %d %d %d %d",
- &year, buffer, &day, &hour, &min, &sec) < 6) {
- return -1;
- }
- if (year > 1900) year = year - 1900;
- month = monthnumber(buffer);
- loctim.tm_year = year;
- loctim.tm_mon = month;
- loctim.tm_mday = day;
-/* stripcolon(compiletime); */ /* extra fancy precision */
-/* sscanf(compiletime, "%d %d %d",
- &loctim.tm_hour, &loctim.tm_min, &loctim.tm_sec); */
- loctim.tm_hour = hour;
- loctim.tm_min = min;
- loctim.tm_sec = sec;
- loctim.tm_isdst = -1; /* daylight saving time flag - info not avail */
- otime = mktime(&loctim);
-/* Note: mktime returns -1 for invalid input data */
-/* This might be off by one hour (3600 sec) because of daylight savings */
-
- (void) time(<ime); /* get seconds since 1970 */
-/* Note: time() returns -1 if it can't get the time */
- dtime = ltime - otime; /* time difference in sec so far */
-/* debugging, remove later */
-/* printf("dtime %ld = ltime %ld - otime %ld (%lg months)\n",
- dtime, ltime, otime, (double) dtime / (double) onemonth); */
- if (dtime > onemonth * 12)
- for(;;); /* SERIOUSLY EXPIRED ! */
- if (dtime < - oneday)
- exit(7); /* bogus date ! */
-/* if (dtime > onemonth) { */
- if (dtime > onemonth * bDemoFlag)
- {
- showline("Please contact Y&Y, Inc. for non-DEMO version\n", 1);
- showline("http://www.YandY.com sales@YandY.com (978) 371 3286\n", 1);
- pause();
- }
-/* if (dtime > onemonth * 3) { */
- if (dtime > onemonth * (bDemoFlag+2))
- {
- showline("Sorry, but this DEMO version has expired\n", 1);
- pause();
- exit(7); /* EXPIRED ! */
- }
- return dtime;
-}
-#endif
-
/* new 1992/Dec/22 */
/* flag is zero for on-screen output, non-zero for PS file output */
{
int k;
FILE *command;
- int cmdflag=0;
+ int cmdflag = 0;
char *s;
/* Following added 94/Mar/4 - show dvipsone.cmd */
- if (strcmp(commandfile, "") != 0) { /* command file ? */
+ if (strcmp(commandfile, "") != 0) /* command file ? */
+ {
command = fopen(commandfile, "r");
- if (command != NULL) {
+
+ if (command != NULL)
+ {
while (fgets(line, MAXLINE, command) != NULL) {
- if (*line == '%' || *line == ';' || *line == '\n') continue;
+ if (*line == '%' || *line == ';' || *line == '\n')
+ continue;
+
if (strchr(line, '\n') == NULL) strcat(line, "\n");
- if (cmdflag++ == 0) { /* first time only */
- if (flag) strcpy(logline, "% ");
- else *logline = '\0';
-// sprintf(logline, "From %s:\n", commandfile);
+
+ if (cmdflag++ == 0) /* first time only */
+ {
+ if (flag)
+ strcpy(logline, "% ");
+ else
+ *logline = '\0';
+
strcat(logline, "From ");
strcat(logline, commandfile);
strcat(logline, "\n");
- if (flag) PSputs(logline, output);
- else showline(logline, 0);
+
+ if (flag)
+ PSputs(logline, output);
+ else
+ showline(logline, 0);
}
- if (flag) strcpy(logline, "% ");
- else *logline = '\0';
+
+ if (flag)
+ strcpy(logline, "% ");
+ else
+ *logline = '\0';
+
if (strlen(line) + 3 < sizeof(logline)) /* MAXLINE */
strcat(logline, line);
- if (flag) PSputs(logline, output);
- else showline(logline, 0);
+
+ if (flag)
+ PSputs(logline, output);
+ else
+ showline(logline, 0);
}
fclose(command);
}
- else {
+ else
+ {
sprintf(logline, "ERROR: Can't open commandfile %s\n", commandfile);
showline(logline, 1);
perrormod(commandfile);
}
/* Now for the command line itself */
- if (flag) strcpy(logline, "% ");
- else *logline = '\0';
+ if (flag)
+ strcpy(logline, "% ");
+ else
+ *logline = '\0';
strcat(logline, "Command:\n");
- if (flag) PSputs(logline, output); // PS output stream
- else showline(logline, 0); // on screen
- if (flag) strcpy(logline, "% ");
- else *logline = '\0';
+ if (flag)
+ PSputs(logline, output); // PS output stream
+ else
+ showline(logline, 0); // on screen
+
+ if (flag)
+ strcpy(logline, "% ");
+ else
+ *logline = '\0';
+
s = logline;
- for (k = 0; k < argc; k++) {
+
+ for (k = 0; k < argc; k++)
+ {
if (s - logline + strlen(argv[k] + 3) >= sizeof(logline)) /* MAXLINE */
break;
+
strcat(s, argv[k]);
strcat(s, " ");
s += strlen(s);
}
strcat(s, "\n");
- if (flag) PSputs(logline, output);
- else showline(logline, 0);
+ if (flag)
+ PSputs(logline, output);
+ else
+ showline(logline, 0);
+
+ if (commandspec != NULL)
+ {
+ if (flag)
+ strcpy(logline, "% ");
+ else
+ *logline = '\0';
- if (commandspec != NULL) { // 99/Sep/6
- if (flag) strcpy(logline, "% ");
- else *logline = '\0';
strcat(logline, "Special:\n");
- if (flag) PSputs(logline, output); // PS output stream
- else showline(logline, 0); // on screen
+
+ if (flag)
+ PSputs(logline, output); // PS output stream
+ else
+ showline(logline, 0); // on screen
// split into separate lines
s = strtok(commandspec, "\n\r"); // first line
- while (s != NULL) {
- if (flag) strcpy(logline, "% ");
- else *logline = '\0';
+ while (s != NULL) {
+ if (flag)
+ strcpy(logline, "% ");
+ else
+ *logline = '\0';
+
strcat(logline, s);
strcat(logline, "\n");
- if (flag) PSputs(logline, output); // PS output stream
- else showline(logline, 0); // on screen
+
+ if (flag)
+ PSputs(logline, output); // PS output stream
+ else
+ showline(logline, 0); // on screen
+
s = strtok(NULL, "\n\r"); // go to next line
}
}
{
int k;
char *s;
- while ((s = strchr(date, ' ')) != NULL) strcpy(s, s+1);
- while ((s = strchr(date, ':')) != NULL) strcpy(s, s+1);
+
+ while ((s = strchr(date, ' ')) != NULL)
+ strcpy(s, s+1);
+
+ while ((s = strchr(date, ':')) != NULL)
+ strcpy(s, s+1);
/* Now have 1990Sep27062635 */
for (k = 0; k < 12; k++)
- if (strncmp(months+k*3, date+4, 3) == 0) break;
- sprintf(date+4, "%02d", k+1);
- strcpy(date+6, date+7);
+ if (strncmp(months+k*3, date+4, 3) == 0)
+ break;
+
+ sprintf(date + 4, "%02d", k + 1);
+ strcpy(date + 6, date + 7);
}
void writedocinfo (FILE *output) /* write DOCINFO & PAGES pdfmarks */
char *s = "";
int xll, yll, xur, yur;
- if (makeepsf) return; /* don't do this for EPS file */
- if (directprint) return; /* don't do this when direct */
+ if (makeepsf)
+ return; /* don't do this for EPS file */
+
+ if (directprint)
+ return; /* don't do this when direct */
+
if (titlestring == NULL)
{
if (filenamex != NULL)
addescapes(line, filenamex, sizeof(line)); /* MAXLINE */
- else *line = '\0';
+ else
+ *line = '\0';
}
else
{
if (creatorstring == NULL) // 99/Dec/18
{
- stampit(line, 0, 0);
+ stampit(line, 0);
}
else
{
free(subjectstring);
subjectstring = NULL;
}
+
if (*line != '\0')
{
sprintf(logline, " /Subject (%s)\n", line); /* optional */
sprintf(logline, " /Keywords (%s)\n", line);
PSputs(logline, output);
}
+
/* Might want to cut short showowner output before date ... */
if (authorstring == NULL)
{
-// if (serialnumber != 0) {
-// PSputs(" /Author (", output);
-// showownerout(line, 1);
-// strcat(line, ")\n");
-// PSputs(line, output);
-// }
-// else showline("SERIALNUMBER == 0", 1); // debugging only
PSputs(" /Author (", output);
- showownerout(line, 1, sizeof(line)); /* MAXLINE */
+ showownerout(line); /* MAXLINE */
strcat(line, ")\n");
PSputs(line, output);
}
}
PSputs("/DOCINFO pdfmark\n", output); /* required */
-/* now add /CropBox /Page pdfmark */
+
if (BBxll != 0 || BByll != 0 || BBxur != 0 || BByur != 0) /* 96/May/4 */
{
-/* should really convert from TeX coordinates to PS coordinates */
+ /* should really convert from TeX coordinates to PS coordinates */
xll = BBxll; yll = BByll;
xur = BBxur; yur = BByur;
}
}
sprintf(logline, "[ /CropBox [ %d %d %d %d]\n", xll, yll, xur, yur);
PSputs(logline, output);
-// fputs("/PAGES pdfmark\n", output);
PSputs("/PAGES pdfmark\n", output);
/* Above should go between %%BeginSetup and %%EndSetup */
}
void writedocview (FILE *output) /* write DOCVIEW pdfmark */
{
- if (makeepsf) return; /* don't do this for EPS file */
- if (directprint) return; /* don't do this when direct */
- if (basestring == NULL && pagemode == NULL) return;
- /* only if PageMode or Base URL specified */
+ if (makeepsf)
+ return; /* don't do this for EPS file */
+
+ if (directprint)
+ return; /* don't do this when direct */
+
+ if (basestring == NULL && pagemode == NULL)
+ return;
+
+ /* only if PageMode or Base URL specified */
PSputs("[", output);
if (pagemode != NULL)
{
int c; /* for first letter of papertype */
char *s;
-/* if (stripcomment == 0) fputs("%%BeginSetup\n", output);*/ /* 1992/July/18 */
-
/* Don't bother with following if writing direct to printer ? */
if (bPDFmarks)
{
/* ltime = 0; *//* 901621283 1998 July 28 06:21:00 */
}
s = ctime(<ime);
+
if (s == NULL)
{
sprintf(logline, "Cannot convert time (%0ld)!\n", ltime); /* 96/Jan/4 */
s = "Thu Jan 18 22:14:00 2038";
/* exit(1); */
}
+
lcivilize(s); /* ??? */
replaceletter(s, ':', '-'); /* to avoid colons in time */
-// fputs(s, output);
PSputs(s, output);
-// fputs(")\nput\n", output);
PSputs(")\nput\n", output);
-// if (strcmp(papertype, "") != 0 || strcmp(papersize, "") != 0)
+
if (papertype != NULL || papersize != NULL)
{
-// fputs("[{\n", output);
PSputs("[{\n", output);
if (stripcomment == 0)
{
-/* %%BeginFeature: *PageSize Letter ??? */
-// fputs("%%BeginFeature: ", output); /* 1992/July/18*/
- PSputs("%%BeginFeature: ", output); /* 1992/July/18*/
-// fputs("*PageSize", output); /* 1992/July/18*/
- PSputs("*PageSize", output); /* 1992/July/18*/
-// if (strcmp(papertype, "") != 0 &&
-// strchr(papertype, '*') == NULL)
- if (papertype != NULL &&
- strchr(papertype, '*') == NULL) { /* 1996/June/4 */
-// putc(' ', output);
+ PSputs("%%BeginFeature: ", output);
+ PSputs("*PageSize", output);
+
+ if (papertype != NULL && strchr(papertype, '*') == NULL)
+ {
PSputc(' ', output);
-/* change case first letter ? */
c = *papertype;
- if (c >= 'a' && c <= 'z') c = c + 'A' - 'a';
-// putc(c, output);
+
+ if (c >= 'a' && c <= 'z')
+ c = c + 'A' - 'a';
PSputc(c, output);
-/* fputs(papertype, output); */
-// fputs(papertype+1, output);
- PSputs(papertype+1, output);
+ PSputs(papertype + 1, output);
}
-// putc('\n', output);
PSputc('\n', output);
}
+
/* don't output page command if `custom size' -l=<width>*<height> 94/Dec/16 */
/* if (strcmp(papertype, "custom") != 0) */
/* statusdict /lettertray get exec ??? */
-// if (strcmp(papertype, "") != 0 && strchr(papertype, '*') == NULL)
if (papertype != NULL && strchr(papertype, '*') == NULL)
{
-/* fprintf(output, "{%s}stopped pop\n", papertype); */
-// fputs(papertype, output); /* since already stopped context */
PSputs(papertype, output); /* since already stopped context */
}
-/* new, make use of setpageparams 1996/Feb/10 */
-/* else fprintf(output, "%d %d 0 1 setpagesize\n", */ /* 96/May/6 */
- else { /* custom paper size */
- if (bLevel2) { /* for level 2 use setpagedevice 98/Apr/4 */
-// fputs("<<", output);
+ else
+ {
+ /* new, make use of setpageparams 1996/Feb/10 */
+ /* custom paper size */
+ if (bLevel2) /* for level 2 use setpagedevice 98/Apr/4 */
+ {
PSputs("<<", output);
sprintf(logline,
"/PageSize [%d %d] /Orientation 0 /ImagingBBox null",
(int) (pagewidth + 0.5), (int) (pageheight + 0.5));
PSputs(logline, output);
-/* "2 dict dup /PageSize [%d %d] put dup /ImagingBBox null put setpagedevice" */
-// fputs(">> setpagedevice", output);
PSputs(">> setpagedevice", output);
}
- else { /* for level 1 see if this works */
+ else
+ {
+ /* for level 1 see if this works */
sprintf(logline, "%d %d 0 1 setpagesize",
(int) (pagewidth + 0.5), (int) (pageheight + 0.5));
PSputs(logline, output);
-/* defined in prolog to be essentially `statusdict begin setpageparams end' */
+ /* defined in prolog to be essentially `statusdict begin setpageparams end' */
}
}
-// putc('\n', output);
PSputc('\n', output);
- if (stripcomment == 0) {
-// fputs("%%EndFeature\n", output);
+
+ if (stripcomment == 0)
+ {
PSputs("%%EndFeature\n", output);
}
-// fputs("} stopped cleartomark\n", output);
PSputs("} stopped cleartomark\n", output);
}
/* NOTE: following includes %%BeginFeature / %%EndFeature */
- if (bDuplex) { /* 1996/May/6 */
-// fputs("[{\n", output);
+ if (bDuplex)
+ {
PSputs("[{\n", output);
- if (stripcomment == 0) {
-// fputs("%%BeginFeature: ", output);
+
+ if (stripcomment == 0)
+ {
PSputs("%%BeginFeature: ", output);
-// fputs("*Duplex ", output);
PSputs("*Duplex ", output);
- if (bTumble) {
-// fputs("DuplexTumble\n", output);
+
+ if (bTumble)
+ {
PSputs("DuplexTumble\n", output);
}
- else {
-// fputs("DuplexNoTumble\n", output);
+ else
+ {
PSputs("DuplexNoTumble\n", output);
}
}
- if (bLevel2) { /* 98/Apr/4 */
-// fputs("<<", output);
+ if (bLevel2)
+ {
PSputs("<<", output);
PSputs("/Duplex true ", output);
- if (bTumble) {
+
+ if (bTumble)
+ {
PSputs("/Tumble true", output);
}
- else {
+ else
+ {
PSputs("/Tumble false", output);
}
-// fputs(">> setpagedevice", output);
PSputs(">> setpagedevice", output);
}
- else {
-// fputs("true ", output);
+ else
+ {
PSputs("true ", output);
-// fputs("statusdict /setduplexmode get exec\n", output);
PSputs("statusdict /setduplexmode get exec\n", output);
- if (bTumble) {
-// fputs("true ", output);
+
+ if (bTumble)
+ {
PSputs("true ", output);
}
- else {
-// fputs("false ", output);
+ else
+ {
PSputs("false ", output);
}
-// fputs("statusdict /settumble get exec\n", output);
PSputs("statusdict /settumble get exec\n", output);
}
- if (stripcomment == 0) {
-// fputs("%%EndFeature\n", output);
+ if (stripcomment == 0)
+ {
PSputs("%%EndFeature\n", output);
}
-// fputs("} stopped cleartomark\n", output);
PSputs("} stopped cleartomark\n", output);
} /* end if bDuplex != 0 */
- if (bsetoverprint) { // 99/Sep/6 a level 2 color separator feature
+ if (bsetoverprint) // 99/Sep/6 a level 2 color separator feature
+ {
PSputs("[{\n", output);
- if (stripcomment == 0) {
+
+ if (stripcomment == 0)
+ {
PSputs("%%BeginFeature: ", output);
PSputs("setoverprint\n", output);
}
PSputs("true ", output); // PS default is false ...
PSputs("setoverprint\n", output);
- if (stripcomment == 0) {
+
+ if (stripcomment == 0)
+ {
PSputs("%%EndFeature\n", output);
}
- PSputs("} stopped cleartomark\n", output);
+ PSputs("} stopped cleartomark\n", output);
}
/* Not clear this is a good place to test since we don't know if used? */
/* Yet, we don't want to print half the file before finding out! */
/* OK, now we check for TIFF image inclusion in dvipslog prescan */
-/* if (bLevel2) { */
-/* printf("bInsertImage %d\n", bInsertImage); */ /* debugging */
/* cause error message on printer if not PS level 2 */
if (bLevel2 && bInsertImage)
{
dvidictend(output);
}
} /* end if makeepsf == 0 */
-/* fputs("[{\n", output); */
-/* fputs(duplexcode, output); */
-/* fputs("} stopped cleartomark\n", output); */
}
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
{
int k;
#if MAXREMAP > 32
- for (k = 0; k < 10; k++) remaptable[k] = (unsigned char) (161 + k);
- for (k = 10; k < 32; k++) remaptable[k] = (unsigned char) (163 + k);
- for (k = 32; k < MAXREMAP; k++) remaptable[k] = (unsigned char) k;
+ for (k = 0; k < 10; k++)
+ remaptable[k] = (unsigned char) (161 + k);
+
+ for (k = 10; k < 32; k++)
+ remaptable[k] = (unsigned char) (163 + k);
+
+ for (k = 32; k < MAXREMAP; k++)
+ remaptable[k] = (unsigned char) k;
+
remaptable[32] = 195;
#if MAXREMAP > 127
remaptable[127] = 196;
#endif
#else /* MAXREMAP <= 32 */
- for (k = 0; k < 10; k++) remaptable[k] = 161 + k;
- for (k = 10; k < 32; k++) remaptable[k] = 163 + k;
+ for (k = 0; k < 10; k++)
+ remaptable[k] = 161 + k;
+
+ for (k = 10; k < 32; k++)
+ remaptable[k] = 163 + k;
#endif
}
// void showpedigree(FILE *output)
char *showpedigree (char *line, int nlen)
{
- char *s=line;
-// stampit(output, 1, 1);
- stampit(line, 1, 1);
-// putc('\n', output);
+ char *s = line;
+
+ stampit(line, 1);
strcat(line, "\n");
s += strlen(s);
-// showownerout(output, 0);
- showownerout(s, 0, nlen);
-// putc('\n', output);
+ showownerout(s);
strcat(s, "\n");
s += strlen(s);
-// fprintf(output, "%s\n", copyright);
sprintf(s, "%s\n", copyright);
s += strlen(s);
+
+ if (traceflag)
+ printf("\nSTR: %d\n", nlen);
+
return s;
}
char *s; /* 1996/July/30 */
int flag=1;
-/* if (bRemapControl) */ /* 1994/June/20 */
- setupremap (); /* may as well always do this 95/Oct/15 */
-// if (bMaxSub) maxsubstitute = MAXSUBSTITUTE / 2;
-// if (bMaxFont) maxfonts = MAXFONTS / 2;
- if (xmagnification == 0.0) xmagnification = 1.0;
- if (ymagnification == 0.0) ymagnification = xmagnification;
+ setupremap (); /* may as well always do this 95/Oct/15 */
+
+ if (xmagnification == 0.0)
+ xmagnification = 1.0;
- if (avoidreside != 0) forcereside = 0; /* makes no sense ! */
+ if (ymagnification == 0.0)
+ ymagnification = xmagnification;
- if (beginpages[rangeindex] != -LINFINITY) rangeindex++;
+ if (avoidreside != 0)
+ forcereside = 0; /* makes no sense ! */
-/* if (verboseflag) {
- for (k = 0; k < rangeindex; k++)
- printf("k %d begin %ld end %ld\n", k, beginpages[k], endpages[k]);
- } */ /* for debugging only */
+ if (beginpages[rangeindex] != -LINFINITY)
+ rangeindex++;
- if (xoffseto != UNKNOWNOFFSET || yoffseto != UNKNOWNOFFSET) evenoddoff = 1;
- else evenoddoff = 0;
- if (xoffsete == UNKNOWNOFFSET) xoffsete = 0.0;
- if (xoffseto == UNKNOWNOFFSET) xoffseto = xoffsete;
- if (yoffsete == UNKNOWNOFFSET) yoffsete = 0.0;
- if (yoffseto == UNKNOWNOFFSET) yoffseto = yoffsete;
+ if (xoffseto != UNKNOWNOFFSET || yoffseto != UNKNOWNOFFSET)
+ evenoddoff = 1;
+ else
+ evenoddoff = 0;
+
+ if (xoffsete == UNKNOWNOFFSET)
+ xoffsete = 0.0;
+
+ if (xoffseto == UNKNOWNOFFSET)
+ xoffseto = xoffsete;
+
+ if (yoffsete == UNKNOWNOFFSET)
+ yoffsete = 0.0;
+
+ if (yoffseto == UNKNOWNOFFSET)
+ yoffseto = yoffsete;
if (quietflag == 3) /* dvipsone -qqq */
{
-// showpedigree(stdout);
showpedigree(line, sizeof(line)); /* MAXLINE */
showline(line, 0);
checkexit(0); /* 96/Feb/25 */
// return 0;
}
+
quietflag = (quietflag & 1); /* only depend on even/odd */
/* font paths and such 1994/May/23 */
#endif
if (flag != 0)
{
-/* fontpath = grabenvvar ("PFB_Dir", atmini, "[Setup]", 1); */
s = grabenvvar("PFB_Dir", atmini, "[Setup]", 1);
- if (s != NULL) fontpath = s; /* 1996/July/30 */
+
+ if (s != NULL)
+ fontpath = s; /* 1996/July/30 */
if (traceflag && fontpath != NULL)
{
showline(logline, 0);
}
}
-// if (strcmp(fontpath, "") == 0) fontpath = deffontpath;
- if (fontpath == NULL) fontpath = deffontpath;
+
+ if (fontpath == NULL)
+ fontpath = deffontpath;
}
-// if (strcmp(pfmpath, "") == 0) {
+
if (pfmpath == NULL)
{
/* try and get it from atm.ini */
#endif
if (flag != 0)
{
-/* pfmpath = grabenvvar ("PFM_Dir", atmini, "[Setup]", 1); */
s = grabenvvar("PFM_Dir", atmini, "[Setup]", 1);
- if (s != NULL) pfmpath = s; /* 1996/July/30 */
+
+ if (s != NULL)
+ pfmpath = s; /* 1996/July/30 */
+
if (traceflag && (pfmpath != NULL))
{
sprintf(logline, "PFM_Dir %s\n", pfmpath);
showline(logline, 0);
}
}
-// if (strcmp(pfmpath, "") == 0) pfmpath = defpfmpath;
- if (pfmpath == NULL) pfmpath = defpfmpath;
+
+ if (pfmpath == NULL)
+ pfmpath = defpfmpath;
}
return 0;
}
void setupfontchar (int fnt)
{
fontchar[fnt] = (char *) malloc(MAXCHRS);
+
if (fontchar[fnt] == NULL)
{
showline(" Unable to allocate memory\n", 1);
checkexit(1);
return;
}
+
memset(fontchar[fnt], 0, MAXCHRS);
}
free(fontsubfrom[k]);
fontsubfrom[k] = NULL;
}
+
if (fontsubto[k] != NULL)
{
free(fontsubto[k]);
fontsubto[k] = NULL;
}
+
if (fontsubvec[k] != NULL)
{
free(fontsubvec[k]);
fontsubvec[k] = NULL;
}
}
+
for (k = 0; k < MAXFONTS; k++)
{
if (fontname[k] != NULL)
free(fontname[k]);
fontname[k] = NULL;
}
+
if (subfontname[k] != NULL)
{
free(subfontname[k]);
subfontname[k] = NULL;
}
+
if (fontvector[k] != NULL)
{
free(fontvector[k]);
fontvector[k] = NULL;
}
+
if (fontchar[k] != NULL)
{
free(fontchar[k]);
{
double x;
x = ((double) numer) / ((double) denom);
- return ((double) ((long) (x * 1000.0 + 0.5))) / 1000.0;
+ return ((double) ((long) (x * 1000.0 + 0.5))) / 1000.0;
}
/* top level control separated out for jumpout */
clock_t sclock, lclock, fclock, eclock;
char *mode;
unsigned long starttime; /* seconds since 1970 Jan 1 */
- int count=0;
+ int count = 0;
#ifdef USELOGFILE
if (logfileflag)
{
+
logfile = fopen(logfilename, "w");
+
if (logfile == NULL)
{
perrormod(logfilename);
logfileflag=0;
}
+
}
#endif
// fontsubfrom = fontsubto = fontsubvec = NULL;
// fontname = subfontname = fontvector = NULL;
- if (getenv("DVIDEBUG") != NULL) traceflag = 1; /* pre command line */
+ if (getenv("DVIDEBUG") != NULL)
+ traceflag = 1; /* pre command line */
if (sscanf(progversion, "%d.%d.%d", &version, &revision, &subrevision) < 3)
{
{
programpath = zstrdup(GetCommandLine()); // 99/Jun/25
stripname(programpath); // flush executable name
+
// this gets the path to DVIWindo ... not to DVIPSONE, so:
if ((s = strstr(programpath, "dviwindo")) != NULL)
strcpy(s, "dvipsone"); // replace "dviwindo\\dviwindo.exe" with "dvipsone"
stripname(programpath); // flush executable name
#endif
strcpy(programpath, getenv("DVIPSONE")); // CM 20140401
+
/* if programpath doesn't exist - try and guess - not really likely ! */
if (programpath == NULL || *programpath == '\0')
{
strcpy(programpath, "c:\\yandy\\dvipsone");
}
-/* extract serial number first from start of newmagic */
-// serialnumber = 0; /* assumed high order first */
-// for (k = 0; k < 4; k++) {
-// serialnumber = serialnumber << 8;
-// serialnumber = serialnumber | (newmagic[k+4] & 255);
-// printf("Serial: %ld\n", serialnumber);
-// }
-// if (serialnumber == 1651208296) serialnumber = 0; /* temporary */
-// printf("Serial number %ld %ld\n",
-// (serialnumber / REEXEC), (serialnumber % REEXEC));
-// printf("Serial number %d %d\n",
-// (int) (serialnumber / REEXEC), (int) (serialnumber % REEXEC));
-
task = "analyzing command line";
if ((s = getenv("USEDVIWINDOINI")) != NULL)
sscanf (s, "%d", &usedviwindo);
#ifndef _WINDOWS
- if (usedviwindo) setupdviwindo(); // set up access to dviwindo.ini
+ if (usedviwindo)
+ setupdviwindo(); // set up access to dviwindo.ini
#endif
checkenter(argc, argv);
if ((s = grabenv("YANDYPATH")) != NULL)
{
BasePath = zstrdup(s);
- if (programpath != NULL) strcpy(line, programpath);
- else *line = '\0';
+
+ if (programpath != NULL)
+ strcpy(line, programpath);
+ else
+ *line = '\0';
+
strcat(line, "\\sub");
fontsubpath = zstrdup(line); /* c:\\yandy\\dvipsone\\sub */
procsetpath = programpath; /* c:\\yandy\\dvipsone */
}
else /* release 1.2 (not NT) */
{
-/* if programpath exists, use as default for fontsub, procset, and vec */
+ /* if programpath exists, use as default for fontsub, procset, and vec */
fontsubpath = procsetpath = vecpath = programpath;
- if (programpath != NULL) strcpy(line, programpath);
- else *line = '\0';
- if ((s = strrchr(line, '\\')) != NULL) *s = '\0';
+
+ if (programpath != NULL)
+ strcpy(line, programpath);
+ else
+ *line = '\0';
+
+ if ((s = strrchr(line, '\\')) != NULL)
+ *s = '\0';
+
strcat(line, "\\yandytex\\tfm");
/* tfmpath = texfonts = "c:\\yandytex\\tfm"; */
tfmpath = texfonts = zstrdup(line);
/* Force all plain vanilla text fonts to use Windows ANSI encoding */
if ((s = grabenv("TEXANSI")) != NULL)
- bWindowsFlag = atoi(s); /* in stdlib.h */
+ bWindowsFlag = atoi(s);
+
/* New 1994/Dec/17 force all text fonts to use specified encoding */
if ((s = grabenv("ENCODING")) != NULL)
{
textencoding = s;
+
/* get rid of extension, if any, so can safely use name later 95/Feb/3 */
- if ((s = strrchr(textencoding, '.')) != NULL) *s = '\0';
+ if ((s = strrchr(textencoding, '.')) != NULL)
+ *s = '\0';
+
bWindowsFlag = 1;
+
/* environment specific TEXFONTS variables ? 97/May/10 */
if ((s = grabenv(textencoding)) != NULL)
{
texfonts = s; /* set tfmpath also ? */
}
} /* override 94/Dec/27 */
-
+
/* rangeindex = 0; */ /* no page ranges specified yet */
/* beginorend = 0; */ /* last not defined */
// set up page ranges and install defaults */
- if (expandpageranges() < 0) return -1;
+ if (expandpageranges() < 0)
+ return -1;
// for (k = 0; k < maxranges; k++) { /* install defaults */
// beginpages[k] = -LINFINITY;
firstarg = commandline(argc, argv, 1); /* then do command line */
// if (firstarg <= 0) return -1; // 2000 June 18
- if (abortflag) return -1;
+ if (abortflag)
+ return -1;
dodefaults(); /* 1994/May/23 */
- if (quietflag == 3) return 0;
+ if (quietflag == 3)
+ return 0;
if (firstarg < 0 || firstarg >= argc)
{
return -1;
}
-/* dtime = checkdemo(); */ /* was up here - now moved past checkowner */
-
-/* get path to executable file */ /* for file searched later */
-// if ((serialnumber % REEXEC) != 0 ||
-// checkowner(hexmagic, line, sizeof(line)) != 0 ||
-// checkcopyright(copyright) != 0) showusage(argv[0]);
-/* should crash machine ! */
-/* scivilize(compiledate); */
-
-/* printf("%s\n", line); */ /* debugging, remove later */
-
/* following must be *after* checkowner, and *before* stampit */
-// stampit(stdout, 1, 1);
- stampit(line, 1, 1);
+ stampit(line, 1);
strcat(line, "\n");
showline(line, 0);
// if (logfileflag) stampit(logfile, 1, 1);
showline(copyright, 0);
showline("\n", 0);
- if (verboseflag) showline("\n", 0);
+ if (verboseflag)
+ showline("\n", 0);
/* Code to make up random prefix to avoid Acrobat partial font problem */
if (bRandomPrefix)
{
starttime = (unsigned long) time(NULL);
s = szRandomPrefix+5;
+
while (s >= szRandomPrefix) {
*s-- = (char) ('A' + (int) (starttime % 26));
starttime = (starttime / 26);
}
+
if (verboseflag)
{
sprintf(logline, "Random Prefix %s\n", szRandomPrefix);
showline(logline, 0);
}
+
fontprefix = szRandomPrefix; /* make it point here */
}
if (showcommandflag)
{
showcommand(stdout, argc, argv, 0); /* show command line 94/Mar/8 */
+
if (logfileflag != 0)
showcommand(logfile, argc, argv, 0); /* show command line 94/Mar/8 */
}
{
strcpy(outputfile, outputfile+1); // get rid of first quote
s = outputfile + strlen(outputfile) - 1;
- if (*s == '\"') *s = '\0';
+
+ if (*s == '\"')
+ *s = '\0';
}
// debugging checks -- no longer significant
#endif
{
strcpy(fn_out, outputfile);
-/* lowercase(fn_out, outputfile); *//* dont' change case 97/June/15 */
+
directprint = 0;
m = strlen(fn_out); /* LPT1: COM1: */
- if (m == 5 && *(fn_out+m-1) == ':') { /* 1994/Dec/30 */
+
+ if (m == 5 && *(fn_out+m-1) == ':')
+ {
if (_strnicmp(fn_out, "com", 3) == 0 ||
- _strnicmp(fn_out, "lpt", 3) == 0)
- *(fn_out+m-1) = '\0'; /* strip the colon */
+ _strnicmp(fn_out, "lpt", 3) == 0)
+ *(fn_out+m - 1) = '\0'; /* strip the colon */
}
+
/* Maybe flush this sometime? How many CAS Intellifax boards left ? */
-/* if (_strcmpi(fn_out, "cas") == 0)
- fprintf(errout, " WARNING: Output to FaX board?\n"); */
/* Try and guess whether direct to printer */
+
if (_strcmpi(fn_out, "prn") == 0 ||
_strcmpi(fn_out, "aux") == 0 ||
_strcmpi(fn_out, "ept") == 0 ||
- ((strlen(fn_out) == 4) &&
- (_strnicmp(fn_out, "lpt", 3) == 0 ||
- _strnicmp(fn_out, "com", 3) == 0) &&
- *(fn_out+3) >= '0' && *(fn_out+3) <= '9')) /* 95/Dec/20*/
+ ((strlen(fn_out) == 4) && (_strnicmp(fn_out, "lpt", 3) == 0 || _strnicmp(fn_out, "com", 3) == 0) && *(fn_out+3) >= '0' && *(fn_out+3) <= '9'))
{
directprint = 1;
-/* if (dontstrip != 0) stripcomment = 0;
- else stripcomment = 1; */
}
/* Try and deal with Windows network printer, like: \\ast\hp4mplus */
/* Try and deal with Windows network printer, like: \\fasecon\3rdfloor */
/* Try and deal with Windows network printer, like: \\foo.lpr\bar\odd */
/* Heuristic: starts with two backslashes and has no file extension */
- if (strncmp(fn_out, "\\\\", 2) == 0) { /* possible network printer ?*/
+ if (strncmp(fn_out, "\\\\", 2) == 0) /* possible network printer ?*/
+ {
if ((s = strrchr(fn_out, '.')) == NULL ||
- ((t = strrchr(fn_out, '\\')) != NULL && s < t))
+ ((t = strrchr(fn_out, '\\')) != NULL && s < t))
directprint = 1;
}
+
/* Deal with network printers of form NE01: ... */
s = fn_out + strlen(fn_out) - 1; /* 1995/Dec/20 */
- if (*s == ':') {
- if (s > fn_out + 1) *s = '\0'; /* strip the colon ??? */
+
+ if (*s == ':')
+ {
+ if (s > fn_out + 1)
+ *s = '\0'; /* strip the colon ??? */
+
directprint = 1; /* 1995/Dec/20 */
}
- if (directprint) {
- if (dontstrip) stripcomment = 0;
- else stripcomment = 1; /* normally strip comments */
+ if (directprint)
+ {
+ if (dontstrip)
+ stripcomment = 0;
+ else
+ stripcomment = 1; /* normally strip comments */
}
- else { /* apparently not a printer */
-/* forceexten(fn_out, OUTPUTEXT); */ /* flushed 92/Sep/24 */
-/* extension(fn_out, OUTPUTEXT); */ /* flushed 95/Dec/20 */
-/* directprint = 0; */ /* redundant */
+ else /* apparently not a printer */
+ {
stripcomment = 0;
}
-/* printf("fn_out %s strlen %d *(fn_out+3) %c direct %d\n",
- fn_out, strlen(fn_out), *(fn_out+3), directprint); */
+
/* maybe open output in binary mode to avoid \r before \n ? */
- if (retplusnew == 0) mode = "wb"; else mode = "w";
-// if (strcmp(fn_out, "d:\\working\\simple.ps")) {
-// sprintf(logline, "`%s' <=> `%s'\n", fn_out, "d:\\working\\simple.ps");
-// showline(logline, 1);
-// }
+ if (retplusnew == 0)
+ mode = "wb";
+ else
+ mode = "w";
+
output = fopen(fn_out, mode);
- if (output == NULL) {
+
+ if (output == NULL)
+ {
sprintf(logline, "ERROR: Can't make output file `%s' (%s)\n",
fn_out, mode);
showline(logline, 1);
perrormod(fn_out);
giveup(3);
- return -1; // failure
+ //return -1; // failure
}
}
#ifdef _WINDOWS
- if (usecallbackflag) { // if we are going to use callback function
+ if (usecallbackflag) // if we are going to use callback function
+ {
directprint = 0;
stripcomment = 0;
output = NULL;
}
#endif
- if (bAbort) abortjob();
- if (abortflag) return -1;
+ if (bAbort)
+ abortjob();
- for (m = firstarg; m < argc; m++) { /* do each file in turn */
+ if (abortflag)
+ return -1;
+ for (m = firstarg; m < argc; m++) /* do each file in turn */
+ {
sclock = clock(); /* get starting time */
s = argv[m];
- if (*s == '\"') { // remove "..." wrapper 2000 June 5
+
+ if (*s == '\"') // remove "..." wrapper 2000 June 5
+ {
strcpy(s, s+1);
s = s + strlen(s) - 1;
- if (*s == '\"') *s = '\0';
+
+ if (*s == '\"')
+ *s = '\0';
}
+
filenamex = argv[m];
errlevel = 0; /* start counting errors anew */
colorindex = 0; /* right place ? */
{
if (currentdirect != 0) /* write in current directory ? */
strcpy(fn_out, filename);
- else strcpy(fn_out, fn_in); /* write in same place as input */
+ else
+ strcpy(fn_out, fn_in); /* write in same place as input */
+
forceexten(fn_out, OUTPUTEXT);
directprint = 0;
stripcomment = 0;
/* maybe open output in binary mode to avoid \r before \n ? */
- if (retplusnew == 0) mode = "wb"; else mode = "w";
+ if (retplusnew == 0)
+ mode = "wb";
+ else
+ mode = "w";
+
output = fopen(fn_out, mode);
+
if (output == NULL)
{
sprintf(logline, "ERROR: Can't make output file `%s' (%s)\n",
showline(logline, 1);
perrormod(fn_out);
giveup(3);
- return -1;
+ //return -1;
}
}
stripname(dvipath);
input = fopen(fn_in, "rb");
- if (input == NULL) { /* try name as is */
+ if (input == NULL) /* try name as is */
+ {
forceexten(fn_in, INPUTEXT);
input = fopen(fn_in, "rb");
- if (input == NULL) { /* try .dvi */
+
+ if (input == NULL) /* try .dvi */
+ {
forceexten(fn_in, "tex");
input = fopen(fn_in, "rb");
- if (input == NULL) { /* try .tex */
+
+ if (input == NULL) /* try .tex */
+ {
sprintf(logline, "Can't find input file `%s'\n", argv[m]);
showline(logline, 1);
perrormod(argv[m]);
-// if (strcmp(outputfile, "") == 0) /* output specified ? */
- if (outputfile == NULL) { /* output specified ? */
- if (output != NULL) {
+
+ if (outputfile == NULL) /* output specified ? */
+ {
+ if (output != NULL)
+ {
fclose(output); /* close output */
output = NULL;
}
/* input = fp_in; */
/* output = fp_out; */
-/* if (deepstack == 0) maxstack = 500/6 - 3;
- else if (deepstack == 1) maxstack = 500/4 - 3;
- else maxstack = 500/2 - 3; */
-
task = "pre-scanning DVI file"; /* for font usage */
/* sets up headerfile also */ /* and picks off verbatim headers */
// can this mess things up by changing settings assumed above ???
// can this mess things up for the next file by changing state ???
- if (commandspec != NULL) { // new 99/Sep/6
+ if (commandspec != NULL) // new 99/Sep/6
+ {
// need not split into separate lines
scancommands(s);
}
if (useatmreg)
{
- if (LoadATMREG() < 0) { // try and get info from ATMREG.ATM
+ if (LoadATMREG() < 0) // try and get info from ATMREG.ATM
+ {
if (verboseflag) showline("Warning: no ATMREG.ATM ", 0);
-// return -1;
+// return -1;
}
}
/* analpapertype(papertype); */
/* get PageHeight and PageWidth */ /* 94/May/6 */
pageheight = 11*72; pagewidth = 8.5*72; /* default */
-// if (strcmp(papersize, "") != 0)
- if (papersize != NULL)
+
+ if (papersize != NULL)
decodepapersize(papersize, &pagewidth, &pageheight);
-// if (strcmp(papertype, "") != 0)
+
if (papertype != NULL)
analpapertype(papertype, &pagewidth, &pageheight);
lclock = clock(); /* end of prescan - start of fonts */
- if (bMarkUnused) MarkUnusedFonts(); /* 95/Mar/5 */
+ if (bMarkUnused)
+ MarkUnusedFonts(); /* 95/Mar/5 */
task = "writing header"; /* write file header */
writestruct(output); /* do after number of pages known */
/* comments between %%EndComments and %%BeginProlog */
- if (stripcomment == 0)
+ if (stripcomment == 0)
showcommand(output, argc, argv, 1); /* 92/Dec/.. */
if (commandspec != NULL)
if (stripcomment == 0 && comment != NULL)
{
-// fputs("% ", output);
PSputs("% ", output);
-// fputs(comment, output);
PSputs(comment, output);
-// putc('\n', output);
PSputc('\n', output);
}
-/* if (strcmp(comment, "") != 0) {
- free(comment);
- comment = "";
- } */ /* free, not used later */
/* Note: %%BeginProlog is highly optional ... */
if (bOptionalDSC)
{
if (stripcomment == 0)
{
-// fputs("%%BeginProlog\n", output);
PSputs("%%BeginProlog\n", output);
}
}
+
if (writeheader(output) != 0)
{
showline("ERROR: Problem writing header files\n", 1);
ansiwritten = 0; /* 1993/Sep/30 */
/* textencwritten = 0; */ /* 1994/Dec/17 */
- if (dosetupearly) { /* 1994/Mar/4 */
+ if (dosetupearly) /* 1994/Mar/4 */
+ {
if (stripcomment == 0)
{
-// fputs("%%EndProlog\n", output);
PSputs("%%EndProlog\n", output);
}
}
break; // ???
}
- if (dosetupearly == 0) { /* 1994/Mar/4 new default */
- if (stripcomment == 0) {
-// fputs("%%EndProlog\n", output);
+ if (dosetupearly == 0) /* 1994/Mar/4 new default */
+ {
+ if (stripcomment == 0)
+ {
PSputs("%%EndProlog\n", output);
}
}
if (stripcomment == 0)
{
-// fputs("%%BeginSetup\n", output);
PSputs("%%BeginSetup\n", output);
}
- if (dosetupearly) { /* no longer the default 94/Mar/3 */
-/* if (stripcomment == 0) fputs("%%BeginSetup\n", output); */
+ if (dosetupearly) /* no longer the default 94/Mar/3 */
+ {
writesetup(output, filename);
- if (stripcomment == 0) {
-// fputs("%%EndSetup\n", output);
+
+ if (stripcomment == 0)
+ {
PSputs("%%EndSetup\n", output);
}
}
task = "decompressing font files"; /* put these fonts in the output */
/* extract(output); */ /* split up 1994/Mar/3 */
- extractfonts(output);
+ extractfonts(output);
if (abortflag)
{
break; // ???
}
- if (dosetupearly == 0) { /* new default */
-/* if (stripcomment == 0) fputs("%%BeginSetup\n", output); */
+ if (dosetupearly == 0) /* new default */
+ {
writesetup(output, filename);
}
+
fontsetup(output); /* do remapping, naming etc */
- if (dosetupearly == 0) { /* new default */
- if (stripcomment == 0) {
-// fputs("%%EndSetup\n", output);
+
+ if (dosetupearly == 0) /* new default */
+ {
+ if (stripcomment == 0)
+ {
PSputs("%%EndSetup\n", output);
}
}
// if (strcmp(comment, "") != 0) /* moved down here 96/Feb/25 */
- if (comment != NULL) { /* moved down here 96/Feb/25 */
+ if (comment != NULL) /* moved down here 96/Feb/25 */
+ {
free(comment);
-// comment = "";
comment = NULL;
} /* free, not used later */
{
scandvifile(output, input, 0);
rewind(input);
- if (abortflag) break;
+
+ if (abortflag)
+ break;
}
}
+
if (abortflag)
{
showline("PREMATURE ABORT!", 1); // debugging only
}
scandvifile(output, input, 1);
+
if (abortflag)
{
showline("PREMATURE ABORT!", 1); // debugging only
/* if output file was NOT specified close output for each input file */
// if (strcmp(outputfile, "") == 0) /* output file specified ? */
- if (outputfile == NULL) { /* output file specified ? */
-// if (ferror(output) != 0)
- if (output != NULL && ferror(output)) {
+ if (outputfile == NULL) /* output file specified ? */
+ {
+ if (output != NULL && ferror(output))
+ {
showline("\n", 0);
sprintf(logline, " ERROR in output file %s\n", fn_out);
showline(logline, 1);
perrormod(fn_out);
errcount(0);
}
- else {
- if (output != NULL) {
+ else
+ {
+ if (output != NULL)
+ {
fclose(output);
output = NULL;
}
eclock = clock(); /* get ending time */
- if (! verboseflag) showline("\n", 0);
+ if (! verboseflag)
+ showline("\n", 0);
+
/* Paul Anagnostopolous memorial statement: */
- if (verboseflag && numpages != dvi_t) {
-/* printf("Processed %d pages\n", numpages); */
+
+ if (verboseflag && numpages != dvi_t)
+ {
sprintf(logline, "Processed %ld page%s\n", numpages,
(numpages == 1) ? "" : "s"); /* 1994/Feb/1 */
showline(logline, 0);
sprintf(logline, "Time: %lg sec ",
roundtime(eclock - sclock, (long) CLOCKS_PER_SEC));
showline(logline, 0);
+
/* not so meaningful when directprint != 0 */
/* not so meaningful when page selection activated */
- if (collated != 0 && copies > 1) numpages = numpages * copies;
+ if (collated != 0 && copies > 1)
+ numpages = numpages * copies;
/* following rewritten 1993 Aug 28 */
if (nfonts > 0 || numpages > 0)
*logline = '\0';
strcat(logline, "(");
s = logline + strlen(logline);
- if (nfonts > 0) sprintf(s, "%lg sec per font file",
- roundtime(fclock - lclock,
- (long) CLOCKS_PER_SEC * (long) nfonts));
- if (nfonts > 0 && numpages > 0) strcat(logline, " + ");
+
+ if (nfonts > 0)
+ sprintf(s, "%lg sec per font file",
+ roundtime(fclock - lclock, (long) CLOCKS_PER_SEC * (long) nfonts));
+
+ if (nfonts > 0 && numpages > 0)
+ strcat(logline, " + ");
+
s = logline + strlen(logline);
- if (numpages > 0) sprintf(s, "%lg sec per page output",
- roundtime(eclock - fclock + lclock - sclock,
- (long) CLOCKS_PER_SEC * (long) numpages));
+ if (numpages > 0)
+ sprintf(s, "%lg sec per page output",
+ roundtime(eclock - fclock + lclock - sclock, (long) CLOCKS_PER_SEC * (long) numpages));
strcat(logline, ")");
showline(logline, 0);
}
showline("\n", 0);
} /* end of if timingflag != 0 */
- if (errlevel > maxerror) maxerror = errlevel;
-// if (bAbort > 0) abortjob();
- if (bBackGroundFlag && bBackUsed) freebackground(); /* 98/Jun/30 */
-// if (bAllowColor && bColorUsed) freecolorsave(); /* 98/Jul/18 */
- if (bCarryColor && bColorUsed) freecolorsave(); // 2000 May 27
-// if (strcmp(papersize, "") != 0)
+ if (errlevel > maxerror)
+ maxerror = errlevel;
+
+ if (bBackGroundFlag && bBackUsed)
+ freebackground(); /* 98/Jun/30 */
+
+ if (bCarryColor && bColorUsed)
+ freecolorsave(); // 2000 May 27
+
if (papersize != NULL)
{
free(papersize);
-// papersize = "";
papersize = NULL;
}
count++; /* 99/Mar/17 */
#endif
freememory(); // moved here to happen every file
- if (bAbort) abortjob();
- if (abortflag) break;
+
+ if (bAbort)
+ abortjob();
+
+ if (abortflag)
+ break;
} /* end of for loop over files */
// if (abortflag > 0) return -1;
// if (strcmp(outputfile, "") != 0) /* output file specified ? */
if (outputfile != NULL)
{
-// if (ferror(output) != 0)
if (output != NULL && ferror(output))
{
showline("\n", 0);
}
// does this work in _WINDOWS ???
- if ((m = _heapchk ()) != _HEAPOK) { /* 1995/Nov/10 */
+ if ((m = _heapchk ()) != _HEAPOK) /* 1995/Nov/10 */
+ {
sprintf(logline, " ERROR: heap corrupted (%d)\n", m);
showline(logline, 1);
exit(9); /* terminate with extreme prejudice */
if (maxerror > 0)
{
- if (maxerror == 1) sprintf(logline, "One error encountered\n");
- else if (maxerror > 1) sprintf(logline, "%d errors encountered\n", maxerror);
+ if (maxerror == 1)
+ sprintf(logline, "One error encountered\n");
+ else if (maxerror > 1)
+ sprintf(logline, "%d errors encountered\n", maxerror);
+
showline(logline, 1);
errlevel--; // undo errlevel increment by showline
/* can't do the above just by tacking `s' on the end of `error' */
exit(1);
}
jumpused++;
- longjmp(jumpbuffer, code+1); // 1999/Nov/7
+ longjmp(jumpbuffer, code + 1); // 1999/Nov/7
}
-int main (int argc, char *argv[]) { /* main program entry point */
- int flag=0, ret;
+int main (int argc, char *argv[]) /* main program entry point */
+{
+ int flag = 0, ret;
errout = stdout;
// now creates jump buffer for non-local goto's 99/Nov/7
jumpused = 0;
ret = setjmp(jumpbuffer);
- if (ret == 0) { // get here when setting up jumpbuffer
+ if (ret == 0) // get here when setting up jumpbuffer
+ {
flag = dvibody(argc, argv);
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, "EXITING at %s flag %d ret %d jumpused %d\n",
"MAIN", flag, ret, jumpused);
showline(logline, 0);
}
}
- else { // get here from non-local jump via jumpbuffer - if any
- if (traceflag) {
+ else // get here from non-local jump via jumpbuffer - if any
+ {
+ if (traceflag)
+ {
sprintf(logline, "EXITING at %s flag %d ret %d jumpused %d\n",
"JUMPOUT", flag, ret, jumpused);
showline(logline, 0);
}
#endif
- if (flag == 0) return 0;
+ if (flag == 0)
+ return 0;
+
#ifdef _WINDOWS
return flag;
#else
// if (psbufpos == 0) return;
// if (output == NULL) return;
psbuffer[psbufpos] = '\0'; // terminate - just in case
+
if (usecallbackflag)
{
-// if (PScallback(psbuffer) != 0)
- if (PScallback(psbuffer, psbufpos) != 0) {
+ if (PScallback(psbuffer, psbufpos) != 0)
+ {
sprintf(logline, "PScallback failed %s %d", psbuffer, psbufpos);
showline(logline, 1); // debugging only
-// abortflag++;
uexit(1);
}
}
-// else fputs(psbuffer, output);
- else if (output != NULL) { // printing to FILE from DLL
+ else if (output != NULL) // printing to FILE from DLL
+ {
if (strlen(psbuffer) == psbufpos)
fputs(psbuffer, output); // no embedded nulls
- else {
- for (k = 0; k < psbufpos; k++) putc(psbuffer[k], output);
+ else
+ {
+ for (k = 0; k < psbufpos; k++)
+ putc(psbuffer[k], output);
}
}
psbufpos = 0; // reset buffer
int nlen = strlen(str);
// if (PScallback == NULL) return; // sanity check
- if (*str == '\0') { // special case clean out buffer
+ if (*str == '\0') // special case clean out buffer
+ {
sendpsbuffer(output);
return;
}
// if new stuff won't fit in buffer, clear the buffer first
- if (psbufpos+nlen+2 >= PSBUFLEN) sendpsbuffer(output);
+ if (psbufpos+nlen+2 >= PSBUFLEN)
+ sendpsbuffer(output);
+
// if new stuff won't fit in buffer, send it directly
- if (nlen+2 >= PSBUFLEN) {
- if (usecallbackflag) {
- if (PScallback(str, nlen) != 0) {
+ if (nlen+2 >= PSBUFLEN)
+ {
+ if (usecallbackflag)
+ {
+ if (PScallback(str, nlen) != 0)
+ {
sprintf(logline, "PScallback failed %s %d", str, nlen);
showline(logline, 1); // debugging only
-// abortflag++;
uexit(1);
}
}
-// else fputs(str, output);
else if (output != NULL) // sanity check
fputs(str, output);
}
- else {
+ else
+ {
// else append it to the buffer --- and send if it ends in newline
strcpy(psbuffer+psbufpos, str);
psbufpos += nlen;
- if (psbuffer[psbufpos-1] == '\n') sendpsbuffer(output);
+ if (psbuffer[psbufpos-1] == '\n')
+ sendpsbuffer(output);
}
}
void winshow (char *line)
{
(void) MessageBox(NULL, line, "DVIPSONE",
- MB_ICONINFORMATION | MB_OK | MB_TASKMODAL);
+ MB_ICONINFORMATION | MB_OK | MB_TASKMODAL);
}
void winerror (char *line)
{
int ret;
ret = MessageBox(NULL, line, "DVIPSONE",
- MB_ICONSTOP | MB_OKCANCEL | MB_TASKMODAL);
+ MB_ICONSTOP | MB_OKCANCEL | MB_TASKMODAL);
if (ret == IDCANCEL && jumpused == 0) {
// abortflag++;
uexit(1);
Copyright 1990,1991,1992,1993,1994,1995,1996,1997,1998,1999 Y&Y, Inc.
Copyright 2007 TeX Users Group
+ Copyright 2014 Clerk Ma
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifdef _WINDOWS
-// MYLIBAPI is defined as __declspec(dllexport) in the
+// MYLIBAPI is defined as __declspec(dllexport) in the
// implementation file (dvipsone.c). Thus when this
-// header file is included by dvipsone.c, functions will
+// header file is included by dvipsone.c, functions will
// be exported instead of imported.
#ifndef MYLIBAPI
// last argument is a call-backup that can send PS strings back
-#define ICN_LISTBOX 525
-#define ICN_COPY 526
-#define ICN_RESET 527
-#define ICN_ADDTEXT 528
-#define ICN_SETTITLE 529
-#define ICN_DONE 530
-#define ICN_CLEAR 531
+#define ICN_LISTBOX 525
+#define ICN_COPY 526
+#define ICN_RESET 527
+#define ICN_ADDTEXT 528
+#define ICN_SETTITLE 529
+#define ICN_DONE 530
+#define ICN_CLEAR 531
// MYLIBAPI int reencodeflag;
#ifdef _WINDOWS
// #define PSputc(chr,output) psputc(str, output);
-#define PSputc(chr,output) \
- do{psbuffer[psbufpos++] = (char) chr; \
- if ((psbufpos+2 >= PSBUFLEN) || (chr == '\n')) sendpsbuffer(output);}while(0)
+#define PSputc(chr,output) \
+ do{ \
+ psbuffer[psbufpos++] = (char) chr; \
+ if ((psbufpos+2 >= PSBUFLEN) || \
+ (chr == '\n')) \
+ sendpsbuffer(output); \
+ } while(0)
#else
#define PSputc(chr,output) putc(chr,output)
#endif
#ifdef _WINDOWS
#define showline(str,flag) ShowLine(str,flag)
#else
-#define showline(str,flag) \
- do{fputs(str,stdout);if(logfileflag)fputs(str,logfile);}while(0)
+#define showline(str,flag) \
+ do{ \
+ fputs(str,stdout); \
+ if(logfileflag) \
+ fputs(str,logfile); \
+ } while(0)
#endif
#ifdef _WINDOWS
-// extern int (* PScallback) (const char *); // callback for PS strings
-extern int (* PScallback) (const char *, int); // callback for PS strings
+// extern int (* PScallback) (const char *); // callback for PS strings
+extern int (* PScallback) (const char *, int); // callback for PS strings
#endif
//////////////////////////////////////////////////////////
-#define ID_BYTE 2 /* for version of DVI files that we understand */
+#define ID_BYTE 2 /* for version of DVI files that we understand */
/* Introduce new convenient structure for color info 98/Jul/18 */
typedef struct tagCOLORSPEC {
- float A;
- float B;
- float C;
- float D;
+ float A;
+ float B;
+ float C;
+ float D;
}
COLORSPEC;
/* #define FILENAME_MAX 128 */ /* 16 bit compiler stdio.h */
/* #define FILENAME_MAX 260 */ /* 32 bit compiler stdio.h */
-#define MAXFILENAME FILENAME_MAX /* 128 DOS stdio.h */
- /* 260 NT stdio.h */
-#define FNAMELEN FILENAME_MAX /* max file name length */
-#define MAXPATHLEN FILENAME_MAX /* max path name length */
-/* #define MAX_PATH 260 */ /* in NT windef.h ? */
-/* #define FNAMELEN 80 */ /* max file name length in DOS ? */
-/* #define MAXPATHLEN 64 */ /* max path name length in DOS ? */
-
-#define MAXCOMMENT 256 /* max length of TeX comment in DVI file */
-/* #define MAXLINE 256 */ /* max length of input line (afm - tfm) */
-#define MAXLINE 512 /* max length of input line 1994/Feb/24 */
-
-/* #define MAXTEXNAME 33 */ /* (16?) max length of font name in TeX */
-/* #define MAXTEXNAME 32 */ /* (16?) max length of font name in TeX - align */
-// #define MAXTEXNAME 34 /* (16?) max length of font name in TeX - align */
+#define MAXFILENAME FILENAME_MAX /* 128 DOS stdio.h *//* 260 NT stdio.h */
+#define FNAMELEN FILENAME_MAX /* max file name length */
+#define MAXPATHLEN FILENAME_MAX /* max path name length */
+/* #define MAX_PATH 260 */ /* in NT windef.h ? */
+/* #define FNAMELEN 80 */ /* max file name length in DOS ? */
+/* #define MAXPATHLEN 64 */ /* max path name length in DOS ? */
+
+#define MAXCOMMENT 256 /* max length of TeX comment in DVI file */
+/* #define MAXLINE 256 */ /* max length of input line (afm - tfm) */
+#define MAXLINE 512 /* max length of input line 1994/Feb/24 */
+
+/* #define MAXTEXNAME 33 */ /* (16?) max length of font name in TeX */
+/* #define MAXTEXNAME 32 */ /* (16?) max length of font name in TeX - align */
+/* #define MAXTEXNAME 34 */ /* (16?) max length of font name in TeX - align */
/* #define MAXFONTNAME 33 */ /* max length of substitute fontname */
/* #define MAXFONTNAME 32 */ /* max length of substitute fontname - align */
-// #define MAXFONTNAME 34 /* max length of substitute fontname - align */
+/* #define MAXFONTNAME 34 */ /* max length of substitute fontname - align */
/* NOTE: MAXFONTNAME >= MAXTEXNAME since we copy sometimes from one to other */
-/* #define MAXVECNAME 9 */ /* max length of encoding vector name */
-/* #define MAXVECNAME 10 */ /* max length of encoding vector name - align */
-// #define MAXVECNAME 24 /* compromise - why would anyone want... */
+/* #define MAXVECNAME 9 */ /* max length of encoding vector name */
+/* #define MAXVECNAME 10 */ /* max length of encoding vector name - align */
+/* #define MAXVECNAME 24 */ /* compromise - why would anyone want... */
/* #define MAXCHARNAME 33 */ /* (25?) max length of character name */
-#define MAXCHARNAME 32 /* (25?) max length of character name - align */
+#define MAXCHARNAME 32 /* (25?) max length of character name - align */
/* MAXCHARNAME no longer limits length of char name just space allocation */
-#define MAXCHRS 256 /* max number of characters codes */
-#define TEXCHRS 128 /* max number of characters in a TeX font */
+#define MAXCHRS 256 /* max number of characters codes */
+#define TEXCHRS 128 /* max number of characters in a TeX font */
/* maximum number assigned to a font by TeX + 1 */
/* fixed allocation sizeof(int) * MAXFONTNUMBERS */
/* #define MAXFONTNUMBERS 512 *//* >= 256 max number assigned to a font + 1 */
-#define MAXFONTNUMBERS 1024 /* 1999/Feb/22 */
-/* #define MAXFONTNUMBERS 256 */ /* >= 256 max number assigned TeX 82 */
+#define MAXFONTNUMBERS 1024 /* 1999/Feb/22 */
+/* #define MAXFONTNUMBERS 256 */ /* >= 256 max number assigned TeX 82 */
/* maximum number of fonts allowed in any one DVI file */
/* careful MAXFONTS * MAXCHRS must fit in unsigned int in doallocation */
-#define MAXFONTS 512U /* 1999/Nov/3 for Larry Tseng */
-/* #define MAXFONTS 256U */ /* 72 >= 64 max number of fonts in DVI file */
-/* #define MAXFONTS 128U */ /* 72 >= 64 max number of fonts in DVI file */
+#define MAXFONTS 512U /* 1999/Nov/3 for Larry Tseng */
+/* #define MAXFONTS 256U */ /* 72 >= 64 max number of fonts in DVI file */
+/* #define MAXFONTS 128U */ /* 72 >= 64 max number of fonts in DVI file */
-#define MAXSUBSTITUTE 512 /* max fonts in substitution table */
-/* #define MAXSUBSTITUTE 256 */ /* 128 max fonts in substitution table */
+#define MAXSUBSTITUTE 512 /* max fonts in substitution table */
+/* #define MAXSUBSTITUTE 256 */ /* 128 max fonts in substitution table */
-#define WRAPCOLUMN 64 /* were to start thinking about wrapping special */
-#define MAXSHOWONLINE 6 /* max shows in a row before newline */
-#define MAXERRORS 64 /* error count before giving up */
+#define WRAPCOLUMN 64 /* were to start thinking about wrapping special */
+#define MAXSHOWONLINE 6 /* max shows in a row before newline */
+#define MAXERRORS 64 /* error count before giving up */
-#define MAXRANGES 16 /* max number of page ranges - now expands */
-/* #define MAXRANGES 12 */ /* max number of page ranges */
+#define MAXRANGES 16 /* max number of page ranges - now expands */
+/* #define MAXRANGES 12 */ /* max number of page ranges */
-/* #define DVIDICT 256 */ /* allocation for DVIDICT in printer */
-#define DVIDICT 300 /* allocation for DVIDICT in printer */
+/* #define DVIDICT 256 */ /* allocation for DVIDICT in printer */
+#define DVIDICT 300 /* allocation for DVIDICT in printer */
/* dvidict needs less to 256 (plus space for fonts */
/* but user may define a few extra things in dvidict ... */
/* can use command line -D=... to increase */
-#define MAXREMAP 128 /* MAXREMAP can be 32 or 128 */
-/* #define MAXREMAP 32 */ /* MAXREMAP can be 32 or 128 */
+#define MAXREMAP 128 /* MAXREMAP can be 32 or 128 */
+/* #define MAXREMAP 32 */ /* MAXREMAP can be 32 or 128 */
/* If it is 32, then code 32 does not get mapped to 195 and 127 not to 196 */
-#define MAXSUBFILES 16 /* 1994/Feb/8 */
-#define MAXPROLOGS 16 /* 1993/Dec/21 */
+#define MAXSUBFILES 16 /* 1994/Feb/8 */
+#define MAXPROLOGS 16 /* 1993/Dec/21 */
-/* #define MAXSUBFILES 8 */ /* 1994/Feb/8 */
-/* #define MAXPROLOGS 8 */ /* 1993/Dec/21 */
+/* #define MAXSUBFILES 8 */ /* 1994/Feb/8 */
+/* #define MAXPROLOGS 8 */ /* 1993/Dec/21 */
-#define MAXCOLORSTACK 16 /* max depth of color stack */
-/* #define MAXCOLORSTACK 8 */ /* max depth of color stack */
+#define MAXCOLORSTACK 16 /* max depth of color stack */
+/* #define MAXCOLORSTACK 8 */ /* max depth of color stack */
-// #define BLANKFONT 255 /* this font number in DVIPSONE not used */
-#define BLANKFONT -1 /* this font number in DVIPSONE not used */
+// #define BLANKFONT 255 /* this font number in DVIPSONE not used */
+#define BLANKFONT -1 /* this font number in DVIPSONE not used */
-#define INPUTEXT "dvi" /* default extension on input file */
-#define OUTPUTEXT "ps" /* extension on output file */
+#define INPUTEXT "dvi" /* default extension on input file */
+#define OUTPUTEXT "ps" /* extension on output file */
-#define RESIDENT "*reside*" /* font resident in printer */
-#define FORCESUB "*force*" /* force substitution */
-#define REMAPIT "*remap*" /* remap to specified encoding */
-#define ALIASED "*alias*" /* just another name for same thing */
-#define SYNTHETIC "*synthetic*" /* don't mess with innards ! */
-#define COMPOUND "*compound*" /* backward compatability */
-#define HYBRID "*hybrid*" /* don't mess with innards */
-#define MTMI "*mtmi*" /* font sucks rocks ! */
-#define EPSF "*epsf*" /* allow use for EPSF %%IncludeFont: */
-/* #define CONTROL "*control*" */ /* remap control character range */
+#define RESIDENT "*reside*" /* font resident in printer */
+#define FORCESUB "*force*" /* force substitution */
+#define REMAPIT "*remap*" /* remap to specified encoding */
+#define ALIASED "*alias*" /* just another name for same thing */
+#define SYNTHETIC "*synthetic*" /* don't mess with innards ! */
+#define COMPOUND "*compound*" /* backward compatability */
+#define HYBRID "*hybrid*" /* don't mess with innards */
+#define MTMI "*mtmi*" /* font sucks rocks ! */
+#define EPSF "*epsf*" /* allow use for EPSF %%IncludeFont: */
+/* #define CONTROL "*control*" */ /* remap control character range */
-#define C_RESIDENT 1 /* code for RESIDENT font */
-#define C_FORCESUB 2 /* code for FORCESUB font */
-#define C_REMAPIT 4 /* code for REMAPIT font */
-#define C_ALIASED 8 /* code for ALIASED font */
-#define C_MISSING 16 /* code for missing font */
-#define C_UNUSED 32 /* code for unused font */
-#define C_DEPENDENT 64 /* code for font in other size */
-/* #define C_COMPOUND 128 */ /* font is synthetic */
-/* #define C_HYBRID 128 */ /* font is synthetic */
-#define C_SYNTHETIC 128 /* font is synthetic */
-#define C_MTMI 256 /* font sucks rocks */
-#define C_EPSF 512 /* allow use for EPSF %%IncludeFont: */
-#define C_MULTIPLE 1024 /* Multiple Master Base Font */
-#define C_INSTANCE 2048 /* Multiple Master Instance */
-#define C_NOTBASE 4096 /* subfontname is MM instance, not MM base */
-/* #define C_CONTROL 8192 */ /* remap control character range */
+#define C_RESIDENT 1 /* code for RESIDENT font */
+#define C_FORCESUB 2 /* code for FORCESUB font */
+#define C_REMAPIT 4 /* code for REMAPIT font */
+#define C_ALIASED 8 /* code for ALIASED font */
+#define C_MISSING 16 /* code for missing font */
+#define C_UNUSED 32 /* code for unused font */
+#define C_DEPENDENT 64 /* code for font in other size */
+/* #define C_COMPOUND 128 */ /* font is synthetic */
+/* #define C_HYBRID 128 */ /* font is synthetic */
+#define C_SYNTHETIC 128 /* font is synthetic */
+#define C_MTMI 256 /* font sucks rocks */
+#define C_EPSF 512 /* allow use for EPSF %%IncludeFont: */
+#define C_MULTIPLE 1024 /* Multiple Master Base Font */
+#define C_INSTANCE 2048 /* Multiple Master Instance */
+#define C_NOTBASE 4096 /* subfontname is MM instance, not MM base */
+/* #define C_CONTROL 8192 */ /* remap control character range */
-#define CRYPT_MUL 52845u /* pseudo-random number generator multiplier */
-#define CRYPT_ADD 22719u /* pseudo-random number generator addend */
+#define CRYPT_MUL 52845u /* pseudo-random number generator multiplier */
+#define CRYPT_ADD 22719u /* pseudo-random number generator addend */
-#define REEXEC 55665 /* seed constant for eexec encryption */
-/* #define RCHARSTRING 4330 */ /* seed constant for charstring encryption */
+#define REEXEC 55665 /* seed constant for eexec encryption */
+/* #define RCHARSTRING 4330 */ /* seed constant for charstring encryption */
-/* #define SINFINITY 32767 */ /* 2^{15} - 1 */
-#define LINFINITY 2147483647 /* 2^{31} - 1 */
+/* #define SINFINITY 32767 */ /* 2^{15} - 1 */
+#define LINFINITY 2147483647 /* 2^{31} - 1 */
-#define SUBDIRSEARCH /* 1994/Aug/18 provide for sub-directory search */
+#define SUBDIRSEARCH /* 1994/Aug/18 provide for sub-directory search */
-#define TPIC /* insert code for dealing with TPIC \specials */
+#define TPIC /* insert code for dealing with TPIC \specials */
-#define TIFF /* insert code for dealing with TIFF \specials */
+#define TIFF /* insert code for dealing with TIFF \specials */
-#define ALLOWSCALE /* allow scaling of output DVI coordinates */
+#define ALLOWSCALE /* allow scaling of output DVI coordinates */
/* DVI one byte commands: */
/* what DVI commands translate to: */
/*
-#define SHOW "s"
-#define RIGHT "r"
-#define DOWN "d"
-#define WRIGHT "w"
+#define SHOW "s"
+#define RIGHT "r"
+#define DOWN "d"
+#define WRIGHT "w"
#define WSETRIGHT "W"
-#define XRIGHT "x"
+#define XRIGHT "x"
#define XSETRIGHT "X"
-#define YDOWN "y"
-#define YSETDOWN "Y"
-#define ZDOWN "z"
-#define ZSETDOWN "Z"
+#define YDOWN "y"
+#define YSETDOWN "Y"
+#define ZDOWN "z"
+#define ZSETDOWN "Z"
#define PUSHSTATE "u"
-#define POPSTATE "o"
-#define MAKEFONT "mf"
+#define POPSTATE "o"
+#define MAKEFONT "mf"
*/
/* AND: O => oo, U => u u, M => o u */
extern unsigned char decryptbyte(unsigned char, unsigned short *);
-extern void preextract(void); /* in dviextra.c */
-extern void writetextext(FILE *); /* in dviextra.c */
-/* extern void writeansicode(FILE *); */ /* in dviextra.c */
-extern void writeansicode(FILE *, char *); /* in dviextra.c */
-/* extern void writetextencode(FILE *, char *); */ /* in dviextra.c */
-extern int readtextencode(char *); /* in dviextra.c */
-extern void writedviencode(FILE *); /* in dviextra.c */
-/*extern void extract(FILE *); */ /* in dviextra.c */
-extern int extractfonts(FILE *); /* in dviextra.c */
-extern void fontsetup(FILE *); /* in dviextra.c */
-extern unsigned long readlength(FILE*); /* in dviextra.c */
-extern void makefilename(char *, char *); /* in dviextra.c */
-extern int underscore(char *); /* in dviextra.c */
-extern int removeunder(char *); /* in dviextra.c */
-extern int ResidentFont(char *); /* in dviextra.c */
-extern int FindFileName (char *, char *); /* in dviextra.c */
-extern int MarkUnusedFonts(void); /* in dviextra.c */
-extern int GetSubstitutes(void); /* in dviextra.c */
-
-extern int scanlogfile(FILE *); /* in dvipslog.c */
-extern void resetpagerangehit (int); /* in dvipslog.c */
-extern char *alias (char *); /* in dvipslog.c */
-extern char *nextpathname(char *, char *); /* in dvipslog.c */
+extern void preextract(void); /* in dviextra.c */
+extern void writetextext(FILE *); /* in dviextra.c */
+/* extern void writeansicode(FILE *); */ /* in dviextra.c */
+extern void writeansicode(FILE *, char *); /* in dviextra.c */
+/* extern void writetextencode(FILE *, char *); */ /* in dviextra.c */
+extern int readtextencode(char *); /* in dviextra.c */
+extern void writedviencode(FILE *); /* in dviextra.c */
+/*extern void extract(FILE *); */ /* in dviextra.c */
+extern int extractfonts(FILE *); /* in dviextra.c */
+extern void fontsetup(FILE *); /* in dviextra.c */
+extern unsigned long readlength(FILE*); /* in dviextra.c */
+extern void makefilename(char *, char *); /* in dviextra.c */
+extern int underscore(char *); /* in dviextra.c */
+extern int removeunder(char *); /* in dviextra.c */
+extern int ResidentFont(char *); /* in dviextra.c */
+extern int FindFileName (char *, char *); /* in dviextra.c */
+extern int MarkUnusedFonts(void); /* in dviextra.c */
+extern int GetSubstitutes(void); /* in dviextra.c */
+
+extern int scanlogfile(FILE *); /* in dvipslog.c */
+extern void resetpagerangehit (int); /* in dvipslog.c */
+extern char *alias (char *); /* in dvipslog.c */
+extern char *nextpathname(char *, char *); /* in dvipslog.c */
extern int searchalongpath (char *, char *, char *, int);
extern FILE *findandopen(char *, char *, char *, char *, int);
-// extern int ReadATMReg(char *, char *); /* in dvipslog.c */
-extern int LookupATMReg(char *, char *); /* in dvipslog.c */
-extern int SetupATMReg(void); /* in dvipslog.c */
-extern void freebackground (void); /* in dvipslog.c */
+// extern int ReadATMReg(char *, char *); /* in dvipslog.c */
+extern int LookupATMReg(char *, char *); /* in dvipslog.c */
+extern int SetupATMReg(void); /* in dvipslog.c */
+extern void freebackground (void); /* in dvipslog.c */
extern int readtfm(char *, FILE *, long widths[]);
extern int readafm(char *, FILE *, long widths[]);
/* extern int NamesFromPFM (FILE *, char *, int, char *, int); */
extern int NamesFromPFM (FILE *, char *, int, char *, int, char *);
-extern int scandvifile(FILE *, FILE *, int); /* in dvianal.c */
-extern long gotopost(FILE *); /* in dvianal.c */
+extern int scandvifile(FILE *, FILE *, int); /* in dvianal.c */
+extern long gotopost(FILE *); /* in dvianal.c */
-/* extern FILE *findepsfile(char *, int); */ /* in dvispeci.c */
+/* extern FILE *findepsfile(char *, int); */ /* in dvispeci.c */
/* extern FILE *findepsfile(char *, int, char *); *//* in dvispeci.c */
-extern FILE *findepsfile(char *, char *, int, int); /* in dvispeci.c */
-extern int scanspecial(FILE *, char *, int); /* in dvispeci.c */
-extern int scanspecialraw(FILE *, char *, int); /* in dvispeci.c */
-extern FILE *fopenfont (char *, char *, int); /* in dvispeci.c */
-extern int FindMMBaseFile (int k); /* in dvispeci.c */
-extern int checkCTM(FILE *); /* in dvispeci.c */
-extern int checkColorStack(FILE *); /* in dvispeci.c */
+extern FILE *findepsfile(char *, char *, int, int); /* in dvispeci.c */
+extern int scanspecial(FILE *, char *, int); /* in dvispeci.c */
+extern int scanspecialraw(FILE *, char *, int); /* in dvispeci.c */
+extern FILE *fopenfont (char *, char *, int); /* in dvispeci.c */
+extern int FindMMBaseFile (int k); /* in dvispeci.c */
+extern int checkCTM(FILE *); /* in dvispeci.c */
+extern int checkColorStack(FILE *); /* in dvispeci.c */
extern int doColorPopAll(int);
extern int doColorPop(int);
extern int doColorPush(int);
extern void doColorSet(FILE *, int);
-extern double decodeunits(char *); /* in dvispeci.c */
+extern double decodeunits(char *); /* in dvispeci.c */
extern int readcommands(char *filename);
extern void giveup(int);
/* extern void tellwhere(FILE *); */
extern void tellwhere(FILE *, int);
-extern void ShowLine(char *, int); /* new in dvipsone.c */
+extern void ShowLine(char *, int); /* new in dvipsone.c */
extern int getalphatoken(FILE *, char *, int);
extern int gettoken(FILE *, char *, int);
extern void flushspecial(FILE *);
extern int skipthispage(long);
extern int readspecial(FILE *, FILE *, unsigned long);
-extern void prereadspecial(FILE *, unsigned long);
+extern void prereadspecial(FILE *, unsigned long);
extern void lowercase(char *, char *);
extern void uppercase(char *, char *);
extern void extension(char *, char *);
/* extern char *nextpathname(char *, char *); */
extern char *removepath(char *);
extern int copyepssimple(FILE *, FILE *);
-extern int setupatmini(void); /* dvipsone.c */
-extern void checkexit(int); /* dvipsone.c */
-extern char *zstrdup(char *); /* dvipsone.c */
+extern int setupatmini(void); /* dvipsone.c */
+extern void checkexit(int); /* dvipsone.c */
+extern char *zstrdup(char *); /* dvipsone.c */
-extern int abortjob(void); /* dvipsone.c */
-extern char *grabenv (char *); /* dvipsone.c */
+extern void abortjob(void); /* dvipsone.c */
+extern char *grabenv (char *); /* dvipsone.c */
-extern void setupinifilesub(char*, char *); /* in dvipsone.c */
-extern int uexit (int); /* in dvipsone.c */
+extern void setupinifilesub(char*, char *); /* in dvipsone.c */
+extern int uexit (int); /* in dvipsone.c */
-extern void setupfontchar(int); /* set up wantchrs for one font */
+extern void setupfontchar(int); /* set up wantchrs for one font */
-extern void map850topdf(char *, int); /* in dvispeci.c */
+extern void map850topdf(char *, int); /* in dvispeci.c */
extern void complainspecial(FILE *);
-/* extern void initializeencoding(void); */ /* dviextra.c */
-extern void initializeencoding(int); /* dviextra.c */
+/* extern void initializeencoding(void); */ /* dviextra.c */
+extern void initializeencoding(int); /* dviextra.c */
extern int decompressfont(FILE *, FILE *, char *); /* dviextra.c */
-extern int newspecials(FILE *, FILE *); /* dvitiff.c */
-extern int dohptag(FILE *, FILE *); /* dvitiff.c */
+extern int newspecials(FILE *, FILE *); /* dvitiff.c */
+extern int dohptag(FILE *, FILE *); /* dvitiff.c */
extern unsigned long codefourty (char *);
-extern void DeAllocStringsIn(void); /* dvitiff.c */
-extern void DeAllocStringsOut(void); /* dvitiff.c */
+extern void DeAllocStringsIn(void); /* dvitiff.c */
+extern void DeAllocStringsOut(void); /* dvitiff.c */
-extern void doColor (FILE *, FILE *, int, int); /* dvispeci.c */
-extern void RestoreColorStack(int); /* dvipslog.c */
-extern void freecolorsave (void); /* dvipslog.c */
+extern void doColor (FILE *, FILE *, int, int); /* dvispeci.c */
+extern void RestoreColorStack(int); /* dvipslog.c */
+extern void freecolorsave (void); /* dvipslog.c */
-extern void doClipBoxPopAll(FILE *); /* dvispeci.c */
+extern void doClipBoxPopAll(FILE *); /* dvispeci.c */
/* extern unsigned int ureadone(FILE *); */
/* extern unsigned int ureadtwo(FILE *); */
////////////////////////////////////////////////////////////////////
-extern FILE *errout; /* where to send error output */
+extern FILE *errout; /* where to send error output */
-extern int logfileflag; /* write log file 99/Apr/20 */
-extern FILE *logfile; /* 1999/Apr/20 */
+extern int logfileflag; /* write log file 99/Apr/20 */
+extern FILE *logfile; /* 1999/Apr/20 */
-extern FILE *input; /* used by tellwhere */
+extern FILE *input; /* used by tellwhere */
-extern int volatile bAbort; /* set by user control-C */ /* 1992/Nov/24 */
+extern int volatile bAbort; /* set by user control-C */ /* 1992/Nov/24 */
extern int abortflag;
-extern char *task; /* current task - for error message */
-
-extern int const statisticsflag; /* non-zero => output stack depth, fonts used */
-extern int const complainflag; /* non-zero implies complain sub table warnings */
-extern int const timingflag; /* non-zero => show timing information */
-
-extern int verboseflag; /* non-zero => lots of output */
-extern int traceflag; /* non-zero => lots of output */
-extern int quietflag; /* non-zero => suppress \special complaints */
-extern int reverseflag; /* non-zero => do pages in reverse order */
-extern int skipflag; /* on when page to be skipped reading forward */
-extern int countzeroflag; /* non-zero => page limits based on TeX /count0 */
-extern int stripcomment; /* non-zero => strip comments */
-extern int bUseCounters; /* non-zero counter[1]-counter[2] 96/Jan/28 */
-extern int bShortFont; /* use shorter font numbers for /f... */
-extern int bBackWardFlag; /* force long form of octal escape in strings */
-extern int bForwardFlag; /* use \b, \t, \n, ... \f, \r in strings 93/Sep/29 */
-extern int textures; /* non-zero => textures style DVI file */
-extern int bBackGroundFlag; /* support \special{background ...} 98/Jun/30 */
-extern int bBackUsed; /* non-zero of \special{background ...} used */
-extern int oddpageflag; /* print only odd pages */
-extern int evenpageflag; /* print only even pages */
-extern double xoffsete; /* x offset even pages */
-extern double yoffsete; /* y offset even pages*/
-extern double xoffseto; /* x offset odd pages */
-extern double yoffseto; /* y offset odd pages */
-extern int evenoddoff; /* non-zero if offsets differ on even/odd page */
-extern int pagetpic; /* non-zero if TPIC special used on this page */
-extern int complainedaboutj; /* reset at top of page */
-extern int colorindex; /* color stack index 96/Nov/3 */
-extern int clipstackindex; /* clip push pop index 98/Sep/12 */
-extern int bColorUsed; /* non-zero if \special{color ...} seen */
-extern int bCarryColor; /* carry color across pages 98/Feb/14 */
-extern int CTMstackindex; /* CTM stack index 96/Nov/3 */
-extern int newbopflag; /* want LogicalPage PhysicalPage */
-extern int bOptionalDSC; /* want %%PageTrailer comments */
-extern int bRemapControl; /* non-zero => 0 - 32, 127 => 161 -- 196 */
-extern int bRemapSpace; /* non-zero => 32 => 195, 0 => 161 95/Oct/17 */
-extern int bRemapFont; /* remap just this one font ... 95/Oct/15 */
-extern int nRepeatIndex; /* 95/Aug/27 */
-extern int nRepeatCount; /* 95/Aug/27 */
-
-extern long pageno; /* for convenience in error messages dvipslog.c */
-extern long pagenumber; /* count of pages actually seen */
-extern long numpages; /* number of pages actually processed */
-extern long dvistart; /* where DVI part of Textures file starts */
-extern long nMinRule; /* min rule thickness (Acrobat fix) 95/Oct/10 */
-extern long previous; /* pointer to previous bop in this file */
-extern int finish; /* when seen last eop */
+extern char *task; /* current task - for error message */
+
+extern int const statisticsflag; /* non-zero => output stack depth, fonts used */
+extern int const complainflag; /* non-zero implies complain sub table warnings */
+extern int const timingflag; /* non-zero => show timing information */
+
+extern int verboseflag; /* non-zero => lots of output */
+extern int traceflag; /* non-zero => lots of output */
+extern int quietflag; /* non-zero => suppress \special complaints */
+extern int reverseflag; /* non-zero => do pages in reverse order */
+extern int skipflag; /* on when page to be skipped reading forward */
+extern int countzeroflag; /* non-zero => page limits based on TeX /count0 */
+extern int stripcomment; /* non-zero => strip comments */
+extern int bUseCounters; /* non-zero counter[1]-counter[2] 96/Jan/28 */
+extern int bShortFont; /* use shorter font numbers for /f... */
+extern int bBackWardFlag; /* force long form of octal escape in strings */
+extern int bForwardFlag; /* use \b, \t, \n, ... \f, \r in strings 93/Sep/29 */
+extern int textures; /* non-zero => textures style DVI file */
+extern int bBackGroundFlag; /* support \special{background ...} 98/Jun/30 */
+extern int bBackUsed; /* non-zero of \special{background ...} used */
+extern int oddpageflag; /* print only odd pages */
+extern int evenpageflag; /* print only even pages */
+extern double xoffsete; /* x offset even pages */
+extern double yoffsete; /* y offset even pages*/
+extern double xoffseto; /* x offset odd pages */
+extern double yoffseto; /* y offset odd pages */
+extern int evenoddoff; /* non-zero if offsets differ on even/odd page */
+extern int pagetpic; /* non-zero if TPIC special used on this page */
+extern int complainedaboutj; /* reset at top of page */
+extern int colorindex; /* color stack index 96/Nov/3 */
+extern int clipstackindex; /* clip push pop index 98/Sep/12 */
+extern int bColorUsed; /* non-zero if \special{color ...} seen */
+extern int bCarryColor; /* carry color across pages 98/Feb/14 */
+extern int CTMstackindex; /* CTM stack index 96/Nov/3 */
+extern int newbopflag; /* want LogicalPage PhysicalPage */
+extern int bOptionalDSC; /* want %%PageTrailer comments */
+extern int bRemapControl; /* non-zero => 0 - 32, 127 => 161 -- 196 */
+extern int bRemapSpace; /* non-zero => 32 => 195, 0 => 161 95/Oct/17 */
+extern int bRemapFont; /* remap just this one font ... 95/Oct/15 */
+extern int nRepeatIndex; /* 95/Aug/27 */
+extern int nRepeatCount; /* 95/Aug/27 */
+
+extern long pageno; /* for convenience in error messages dvipslog.c */
+extern long pagenumber; /* count of pages actually seen */
+extern long numpages; /* number of pages actually processed */
+extern long dvistart; /* where DVI part of Textures file starts */
+extern long nMinRule; /* min rule thickness (Acrobat fix) 95/Oct/10 */
+extern long previous; /* pointer to previous bop in this file */
+extern int finish; /* when seen last eop */
extern long counter[10];
-extern char line[MAXLINE]; /* general purpose input `buffer' 512 bytes */
-extern char logline[MAXLINE]; /* used for showline */
+extern char line[MAXLINE]; /* general purpose input `buffer' 512 bytes */
+extern char logline[MAXLINE]; /* used for showline */
-extern char *outputfile; /* output file or empty */
-extern char *filenamex; /* remember file name here */
-extern char *epspath; /* directory to look for EPF files */
-extern char *dvipath; /* directory of dvi file */
+extern char *outputfile; /* output file or empty */
+extern char *filenamex; /* remember file name here */
+extern char *epspath; /* directory to look for EPF files */
+extern char *dvipath; /* directory of dvi file */
extern char *fontsubpath;
-extern char *fontsubrest; /* font substitution file on command line */
+extern char *fontsubrest; /* font substitution file on command line */
-extern char fontsubfile[FNAMELEN]; /* font substitution file */
-extern char *subfontfile[MAXSUBFILES]; /* user subfile or empty (-s=...) */
+extern char fontsubfile[FNAMELEN]; /* font substitution file */
+extern char *subfontfile[MAXSUBFILES]; /* user subfile or empty (-s=...) */
-extern int remaptable[MAXREMAP]; /* 1994/June/20 */
+extern int remaptable[MAXREMAP]; /* 1994/June/20 */
-// extern int finx[MAXFONTNUMBERS]; /* indeces into next few */
-extern short finx[MAXFONTNUMBERS]; /* indeces into next few */
+// extern int finx[MAXFONTNUMBERS]; /* indeces into next few */
+extern short finx[MAXFONTNUMBERS]; /* indeces into next few */
-extern int fontsubflag[MAXFONTS]; /* non-zero if substitute font used */
-extern int fontproper[MAXFONTS]; /* code resident/forced/remap/alias */
-extern unsigned long fc[MAXFONTS]; /* checksum of TFM file (encoding info) */
-extern unsigned long fs[MAXFONTS]; /* at size */
+extern int fontsubflag[MAXFONTS]; /* non-zero if substitute font used */
+extern int fontproper[MAXFONTS]; /* code resident/forced/remap/alias */
+extern unsigned long fc[MAXFONTS]; /* checksum of TFM file (encoding info) */
+extern unsigned long fs[MAXFONTS]; /* at size */
-// extern char *fontname; /* 1994/Feb/2 */
-extern char *fontname[MAXFONTS]; /* 1999/Nov/6 */
-// extern char *subfontname; /* 1994/Feb/2 */
-extern char *subfontname[MAXFONTS]; /* 1999/Nov/6 */
-// extern char *fontvector; /* font remapping vector */
-extern char *fontvector[MAXFONTS]; /* font remapping vector */
-// extern char *fontchar; /* which characters needed */
-extern char *fontchar[MAXFONTS]; /* which characters needed */
+// extern char *fontname; /* 1994/Feb/2 */
+extern char *fontname[MAXFONTS]; /* 1999/Nov/6 */
+// extern char *subfontname; /* 1994/Feb/2 */
+extern char *subfontname[MAXFONTS]; /* 1999/Nov/6 */
+// extern char *fontvector; /* font remapping vector */
+extern char *fontvector[MAXFONTS]; /* font remapping vector */
+// extern char *fontchar; /* which characters needed */
+extern char *fontchar[MAXFONTS]; /* which characters needed */
// extern char *fontsubfrom;
-extern char *fontsubfrom[MAXSUBSTITUTE]; /* 1999/Nov/6 */
+extern char *fontsubfrom[MAXSUBSTITUTE]; /* 1999/Nov/6 */
// extern char *fontsubto;
-extern char *fontsubto[MAXSUBSTITUTE]; /* 1999/Nov/6 */
+extern char *fontsubto[MAXSUBSTITUTE]; /* 1999/Nov/6 */
// extern char *fontsubvec;
-extern char *fontsubvec[MAXSUBSTITUTE]; /* 1999/Nov/6 */
+extern char *fontsubvec[MAXSUBSTITUTE]; /* 1999/Nov/6 */
extern int dvi_s, dvi_t; /* stack depth & no of pages (bop) in DVI file */
-extern unsigned long dvi_l, dvi_u; /* max page height + depth & max width *//* NA */
+extern unsigned long dvi_l, dvi_u; /* max page height + depth & max width *//* NA */
-extern unsigned long num, den; /* from DVI file */
-extern unsigned long mag; /* Tex \mag => 1000 times desired magnification */
+extern unsigned long num, den; /* from DVI file */
+extern unsigned long mag; /* Tex \mag => 1000 times desired magnification */
-extern int ff; /* current font - changed by fnt and fnt_num - reset by bop */
-extern int fnt; /* fnt = finx[ff] */
+extern int ff; /* current font - changed by fnt and fnt_num - reset by bop */
+extern int fnt; /* fnt = finx[ff] */
-extern int fnext; /* next slot to use */
-extern int flast; /* last including MM fonts */
+extern int fnext; /* next slot to use */
+extern int flast; /* last including MM fonts */
#ifdef ALLOWSCALE
extern int outscaleflag;
extern int bTextColor;
extern double textred;
extern double textgreen;
-extern double textblue;
+extern double textblue;
extern int bRuleColor;
extern double rulered;
extern double rulegreen;
-extern double ruleblue;
+extern double ruleblue;
extern int bFigureColor;
extern double figurered;
extern double figuregreen;
-extern double figureblue;
+extern double figureblue;
extern int bReverseVideo;
-extern int bDVICopyReduce; /* 1995/Sep/16 */
-extern long postposition; /* position of post op in DVI */
+extern int bDVICopyReduce; /* 1995/Sep/16 */
+extern long postposition; /* position of post op in DVI */
extern COLORSPEC CurrColor;
extern COLORSPEC *BackColors;
-extern COLORSPEC ColorStack[MAXCOLORSTACK]; /* current stack 98/Jul/18 */
+extern COLORSPEC ColorStack[MAXCOLORSTACK]; /* current stack 98/Jul/18 */
-extern int bPDFmarks; /* write pdfmarks into PS file 95/Feb/25 */
+extern int bPDFmarks; /* write pdfmarks into PS file 95/Feb/25 */
extern int bGhostHackFlag;
-extern int bSuppressBack; /* suppress background in imagemask 95/Dec/31 */
-extern int nDefaultTIFFDPI; /* use if resolution not specified in TIFF */
-extern int bLevel2; /* if allowed to use level 2 features 96/Dec/20 */
-extern int bAllowCompression; /* allow use of compression of TIFF images */
-extern int bAllowColor; /* allow use of colorimage operator */
-extern int bKeepBlack; /* suppress textcolor, rulecolor, figurecolor */
-extern int bInsertImage; /* if \special{insertimage: ... } seen */
-extern int bLandScape; /* asked for landscape mode -*O 95/Jun/24 */
-
-extern int wantmagictiff; /* TIFF: want to use our own screen function */
-extern int frequency, angle; /* frequency and angle */
-extern int usealtGoToR; /* use alternate /GoToR action in PDF */
+extern int bSuppressBack; /* suppress background in imagemask 95/Dec/31 */
+extern int nDefaultTIFFDPI; /* use if resolution not specified in TIFF */
+extern int bLevel2; /* if allowed to use level 2 features 96/Dec/20 */
+extern int bAllowCompression; /* allow use of compression of TIFF images */
+extern int bAllowColor; /* allow use of colorimage operator */
+extern int bKeepBlack; /* suppress textcolor, rulecolor, figurecolor */
+extern int bInsertImage; /* if \special{insertimage: ... } seen */
+extern int bLandScape; /* asked for landscape mode -*O 95/Jun/24 */
+
+extern int wantmagictiff; /* TIFF: want to use our own screen function */
+extern int frequency, angle; /* frequency and angle */
+extern int usealtGoToR; /* use alternate /GoToR action in PDF */
// dvispeci.c
-extern int directprint; /* non-zero => output directly to printer */
-extern int bSmartCopyFlag; /* non-zero => look for %%EOF and such */
-extern int bPassControls; /* pass through control characters in EPSF */
-extern int bKeepTermination; /* keep line terminations intact in EPS */
-extern int passcomments; /* non-zero => do not flush comment lines EPS */
-extern int verbatimflag; /* non-zero => allow verbatim PostScript */
-extern int preservefont; /* preserve font across verbatim */
-extern int bWrapSpecial; /* prevent long linesin \special */
-
-extern int bSciWord; /* treat ps: filename case */
-extern int bIgnoreSpecials; /* non-zero => ignore \specials */
-extern int bPassEPSF; /* non-zero => pass EPSF files (normal) */
-extern int allowtpic; /* non-zero => allow TPIC \specials */
-extern int needtpic; /* non-zero => need TPIC header */
-extern int bOldDVIPSFlag; /* non-zero => wrap ps: code unlike ps:: */
-extern int bOldDVIPSFlip; /* flip coordinates in ps: code 96/Nov/7 */
-extern int bQuotePage; /* suppress showpage in \special{"..."} */
-extern int bProtectStack; /* add [ ... cleartomark 97/Nov/24 */
-extern int bStoppedContext; /* add { ... } stopped 97/Nov/24 */
-
-extern int bAllowInclude; /* expand %%IncludeResource: font ... */
-extern int bAllowBadBox; /* allow single % comment before BoundingBox */
-extern int bConvertReturn; /* convert isolated \r in EPS to \n */
-extern int reverseflag; /* non-zero => do pages in reverse order */
-extern int showcount; /* on when last sent out "set" or "put" */
-extern int freshflag; /* at start of new line from PS special 99/Dec/19 */
-
-extern int useatmini; /* use [Setup] section in `atm.ini' */
-extern int useatmreg; /* use armreg.atm */
-extern int usepsfontname; /* allow use of PS Fontnames in DVI TFM */
-extern int bFirstNull; /* non-zero => flush \special starts with null */
-
-extern char *szATMRegAtm; /* full file name of atmreg.atm */
-extern char *atmini; /* full file name for atm.ini, with path */
+extern int directprint; /* non-zero => output directly to printer */
+extern int bSmartCopyFlag; /* non-zero => look for %%EOF and such */
+extern int bPassControls; /* pass through control characters in EPSF */
+extern int bKeepTermination; /* keep line terminations intact in EPS */
+extern int passcomments; /* non-zero => do not flush comment lines EPS */
+extern int verbatimflag; /* non-zero => allow verbatim PostScript */
+extern int preservefont; /* preserve font across verbatim */
+extern int bWrapSpecial; /* prevent long linesin \special */
+
+extern int bSciWord; /* treat ps: filename case */
+extern int bIgnoreSpecials; /* non-zero => ignore \specials */
+extern int bPassEPSF; /* non-zero => pass EPSF files (normal) */
+extern int allowtpic; /* non-zero => allow TPIC \specials */
+extern int needtpic; /* non-zero => need TPIC header */
+extern int bOldDVIPSFlag; /* non-zero => wrap ps: code unlike ps:: */
+extern int bOldDVIPSFlip; /* flip coordinates in ps: code 96/Nov/7 */
+extern int bQuotePage; /* suppress showpage in \special{"..."} */
+extern int bProtectStack; /* add [ ... cleartomark 97/Nov/24 */
+extern int bStoppedContext; /* add { ... } stopped 97/Nov/24 */
+
+extern int bAllowInclude; /* expand %%IncludeResource: font ... */
+extern int bAllowBadBox; /* allow single % comment before BoundingBox */
+extern int bConvertReturn; /* convert isolated \r in EPS to \n */
+extern int reverseflag; /* non-zero => do pages in reverse order */
+extern int showcount; /* on when last sent out "set" or "put" */
+extern int freshflag; /* at start of new line from PS special 99/Dec/19 */
+
+extern int useatmini; /* use [Setup] section in `atm.ini' */
+extern int useatmreg; /* use armreg.atm */
+extern int usepsfontname; /* allow use of PS Fontnames in DVI TFM */
+extern int bFirstNull; /* non-zero => flush \special starts with null */
+
+extern char *szATMRegAtm; /* full file name of atmreg.atm */
+extern char *atmini; /* full file name for atm.ini, with path */
extern char *tpiccommands;
-extern char *fontpath; /* from PSFONTS env var in dvipsone.c */
-extern char *afmpath; /* default path for AFM font metric files */
-extern char *tfmpath; /* default path for TFM font metric files */
-extern char *pfmpath; /* default path for PFM font metric files */
-extern char *vecpath; /* default place for encoding vectors */
-extern char *texfonts; /* default place for TFM font metric files */
-
-extern int currentfirst; /* look in current directory for files */
-extern int useatmfontsmap; /* zero if tried and failed to find atmfonts.map */
-extern char *atmfontsmap; /* file name and path to ATMFONTS.MAP */
-
-extern int colortypeflag; /* 0 => gray, 1 => rgb, 2 => cmyk */
-extern int colorindex; /* points at next slot to push into */
-extern int clipstackindex; /* set to zero at start of page */
-
-extern int columns; /* maximum length of output line */
-extern int subfontfileindex; /* pointer into following */
-
-extern int showsubflag; /* non-zero => show substitution table */
-extern int wantnotdef; /* non-zero => want .notdef CharString */
-extern int flushcr; /* try and get rid of those pesky \r */
-extern int stripinfo; /* strip out rest of /FontInfo directory */
-extern int substituteflag; /* non-zero => do font substitution */
-extern int forcereside; /* non-zero => force printer resident */
-extern int avoidreside; /* non-zero => veto printer resident */
-extern int bWindowsFlag; /* reencode StandardEncoding to Windows ANSI */
- /* *or* by specified textencoding - ENCODING env var */
-extern int bCheckEncoding; /* check checksum for match with encoding */
-extern int insertmetrics; /* insert new font metrics in substituted */
-
-extern int tryunderscore; /* try underscore form of font file name */
-extern int bUseInternal; /* non-zero => use internal number for /fn...*/
-extern int bAllowShortEncode; /* allow name of Encoding instead of list */
-extern int bAllowStandard; /* allow use StandardEncoding if it works */
-extern int bAllowTexText; /* allow use TeXtext encoding if it works */
-extern int bAllowANSI; /* allow use ANSI encoding if it works */
-extern int busedviencode; /* use dvipsone reencoding of all fonts ! */
-extern int accentedflag; /* deal with accented / composite chars */
-extern int syntheticsafe; /* be paranoid about synthetic fonts */
-extern int bSuppressPartial; /* suppress partial font downloading */
-extern int bForceFullArr; /* force full 256 element Encoding array */
-extern int keepgap; /* keep space bytes before ND 93/Aug/5*/
-extern int showfontflag; /* non-zero => show font tables */
-extern int stripchecking; /* strip garbage from nasty old Adobe fonts */
-extern int textextwritten; /* non-zero textext encoding already written */
-extern int ansiwritten; /* non-zero ansi encoding already written */
-extern int bTexFontsMap; /* non-zero => allowed to use `texfonts.map'*/
-extern int bForceFontsMap; /* non-zero => replace aliases `texfonts.map'*/
-extern int bMarkUnused; /* non-zero => mark unused fonts early */
-extern int bMMShortCut; /* simple way to construct base file name */
-
-extern int bSubRealName; /* substitute file name for FontName in PFA */
- /* not good idea to set to zero ... */
-extern int bRandomPrefix; /* add random prefix to file names 95/Sep/30 */
-
-extern int bAddBaseName; /* add BaseFontName for Distiller 97/Jan/30 */
-
-extern char *textencoding; /* encoding used by plain vanilla text fonts */
- /* may override "ansinew" 94/Dec/17 */
-extern char *textenconame; /* just vector name itself 95/Feb/3 */
-
-extern unsigned long nCheckSum; /* expected checksum ENCODING= *//* 95/Feb/3 */
+extern char *fontpath; /* from PSFONTS env var in dvipsone.c */
+extern char *afmpath; /* default path for AFM font metric files */
+extern char *tfmpath; /* default path for TFM font metric files */
+extern char *pfmpath; /* default path for PFM font metric files */
+extern char *vecpath; /* default place for encoding vectors */
+extern char *texfonts; /* default place for TFM font metric files */
+
+extern int currentfirst; /* look in current directory for files */
+extern int useatmfontsmap; /* zero if tried and failed to find atmfonts.map */
+extern char *atmfontsmap; /* file name and path to ATMFONTS.MAP */
+
+extern int colortypeflag; /* 0 => gray, 1 => rgb, 2 => cmyk */
+extern int colorindex; /* points at next slot to push into */
+extern int clipstackindex; /* set to zero at start of page */
+
+extern int columns; /* maximum length of output line */
+extern int subfontfileindex; /* pointer into following */
+
+extern int showsubflag; /* non-zero => show substitution table */
+extern int wantnotdef; /* non-zero => want .notdef CharString */
+extern int flushcr; /* try and get rid of those pesky \r */
+extern int stripinfo; /* strip out rest of /FontInfo directory */
+extern int substituteflag; /* non-zero => do font substitution */
+extern int forcereside; /* non-zero => force printer resident */
+extern int avoidreside; /* non-zero => veto printer resident */
+extern int bWindowsFlag; /* reencode StandardEncoding to Windows ANSI */
+ /* *or* by specified textencoding - ENCODING env var */
+extern int bCheckEncoding; /* check checksum for match with encoding */
+extern int insertmetrics; /* insert new font metrics in substituted */
+
+extern int tryunderscore; /* try underscore form of font file name */
+extern int bUseInternal; /* non-zero => use internal number for /fn...*/
+extern int bAllowShortEncode; /* allow name of Encoding instead of list */
+extern int bAllowStandard; /* allow use StandardEncoding if it works */
+extern int bAllowTexText; /* allow use TeXtext encoding if it works */
+extern int bAllowANSI; /* allow use ANSI encoding if it works */
+extern int busedviencode; /* use dvipsone reencoding of all fonts ! */
+extern int accentedflag; /* deal with accented / composite chars */
+extern int syntheticsafe; /* be paranoid about synthetic fonts */
+extern int bSuppressPartial; /* suppress partial font downloading */
+extern int bForceFullArr; /* force full 256 element Encoding array */
+extern int keepgap; /* keep space bytes before ND 93/Aug/5*/
+extern int showfontflag; /* non-zero => show font tables */
+extern int stripchecking; /* strip garbage from nasty old Adobe fonts */
+extern int textextwritten; /* non-zero textext encoding already written */
+extern int ansiwritten; /* non-zero ansi encoding already written */
+extern int bTexFontsMap; /* non-zero => allowed to use `texfonts.map'*/
+extern int bForceFontsMap; /* non-zero => replace aliases `texfonts.map'*/
+extern int bMarkUnused; /* non-zero => mark unused fonts early */
+extern int bMMShortCut; /* simple way to construct base file name */
+
+extern int bSubRealName; /* substitute file name for FontName in PFA */
+ /* not good idea to set to zero ... */
+extern int bRandomPrefix; /* add random prefix to file names 95/Sep/30 */
+
+extern int bAddBaseName; /* add BaseFontName for Distiller 97/Jan/30 */
+
+extern char *textencoding; /* encoding used by plain vanilla text fonts */
+ /* may override "ansinew" 94/Dec/17 */
+extern char *textenconame; /* just vector name itself 95/Feb/3 */
+
+extern unsigned long nCheckSum; /* expected checksum ENCODING= *//* 95/Feb/3 */
extern int nfonts, nsubstitute, nremapped, nansified;
-extern int uppercaseflag; /* convert font names to upper case */
-extern int maxsubstitute; /* usually equal to MAXSUBSTITUTE */
-extern int maxfonts; /* usually equal to MAXFONTS */
-extern int bStripBadEnd; /* read to EOL at end of encrypted 96/Feb/22 */
+extern int uppercaseflag; /* convert font names to upper case */
+extern int maxsubstitute; /* usually equal to MAXSUBSTITUTE */
+extern int maxfonts; /* usually equal to MAXFONTS */
+extern int bStripBadEnd; /* read to EOL at end of encrypted 96/Feb/22 */
-extern char *fontprefix; /* prefix to use on FontName */
+extern char *fontprefix; /* prefix to use on FontName */
-extern int BBxll, BByll, BBxur, BByur; /* crop box given 96/May/4 */
+extern int BBxll, BByll, BBxur, BByur; /* crop box given 96/May/4 */
-extern int rangeindex; /* index into following table */
+extern int rangeindex; /* index into following table */
-// extern long beginpages[MAXRANGES]; /* table of pagebegins */
-extern long *beginpages; /* table of pagebegins */
-// extern long endpages[MAXRANGES]; /* table of pageends */
-extern long *endpages; /* table of pageends */
+// extern long beginpages[MAXRANGES]; /* table of pagebegins */
+extern long *beginpages; /* table of pagebegins */
+// extern long endpages[MAXRANGES]; /* table of pageends */
+extern long *endpages; /* table of pageends */
// extern int pagerangeseq[MAXRANGES];/* which instance of page range desired ? */
extern int *pagerangeseq;/* which instance of page range desired ? */
-extern char fn_in[FNAMELEN], fn_out[FNAMELEN]; /* 1994/Mar/1 */
+extern char fn_in[FNAMELEN], fn_out[FNAMELEN]; /* 1994/Mar/1 */
-extern long nspecial; /* byte count of special */
-extern long nspecialsav; /* byte count of special */
-extern long specstart; /* saved start of \special for error message */
+extern long nspecial; /* byte count of special */
+extern long nspecialsav; /* byte count of special */
+extern long specstart; /* saved start of \special for error message */
-extern char *comment; /* pointer to place for TeX comment */
+extern char *comment; /* pointer to place for TeX comment */
-extern char *papersize; /* Custom paper size specified via special */
+extern char *papersize; /* Custom paper size specified via special */
-extern int nheaderlength; // 99/July/14
-extern char *headerfile; /* name of user supplied header file(s) */
+extern int nheaderlength; // 99/July/14
+extern char *headerfile; /* name of user supplied header file(s) */
-extern int headertextlen; /* how much has been accumulated */
-extern char *headertext; /* accum header PS text from headertext= */
+extern int headertextlen; /* how much has been accumulated */
+extern char *headertext; /* accum header PS text from headertext= */
extern int commandspeclen;
extern char *commandspec;
-extern int dsccustomlen; /* how much has been accumulated */
-extern char *dsccustom; /* accum DSC header text from DSCcomment= */
+extern int dsccustomlen; /* how much has been accumulated */
+extern char *dsccustom; /* accum DSC header text from DSCcomment= */
-extern int keywordslen; /* how much has been accumulated in following */
-extern char *keywords; /* accumulated keywords from keywords= */
+extern int keywordslen; /* how much has been accumulated in following */
+extern char *keywords; /* accumulated keywords from keywords= */
-extern char *dscfile; /* name of (single) DSC header file */
+extern char *dscfile; /* name of (single) DSC header file */
-extern char *creatorstring; /* creator for DocInfo in Acrobat */
-extern char *titlestring; /* title for DocInfo in Acrobat */
-extern char *subjectstring; /* Subject for DocInfo in Acrobat */
-extern char *authorstring; /* Author for DocInfo in Acrobat */
-extern char *basestring; /* Base for DocView in Acrobat */
-extern char *pagemode; /* Base for DocView in Acrobat */
+extern char *creatorstring; /* creator for DocInfo in Acrobat */
+extern char *titlestring; /* title for DocInfo in Acrobat */
+extern char *subjectstring; /* Subject for DocInfo in Acrobat */
+extern char *authorstring; /* Author for DocInfo in Acrobat */
+extern char *basestring; /* Base for DocView in Acrobat */
+extern char *pagemode; /* Base for DocView in Acrobat */
-extern int stinx; /* stack index */ /* just for verification */
-extern int maxstinx; /* max stack index seen */
-extern int usefontmap; /* 1996/July/30 */
+extern int stinx; /* stack index */ /* just for verification */
+extern int maxstinx; /* max stack index seen */
+extern int usefontmap; /* 1996/July/30 */
-extern int dirindex; // number of dir paths in ATMREG.ATM
-extern int ATMfontindex; // number of font entries from ATMREG.ATM
+extern int dirindex; // number of dir paths in ATMREG.ATM
+extern int ATMfontindex; // number of font entries from ATMREG.ATM
extern int usecallbackflag;
-extern int ksubst; // entries in substitution table
+extern int ksubst; // entries in substitution table
extern int fontsubprop[MAXSUBSTITUTE]; /* resident/forced/remapped/alias */
extern char **DirPaths;
-extern jmp_buf jumpbuffer; // for non-local jumps
+extern jmp_buf jumpbuffer; // for non-local jumps