else return c;
} */
-#ifdef IGNORED
-/* static short int sreadtwo (FILE *infile) { */ /* ??? */
-static int sreadtwo (FILE *infile)
-{
- short int result;
-/* return (getc(infile) << 8) | getc(infile); */ /* 1995/Nov/15 */
-/* result = (getc(infile) << 8) | getc(infile); */
- result = ((short int) getc(infile) << 8) | (short int) getc(infile);
- return result;
-} /* needed now for code imported from dviextra.c readtfm etc */
-#endif
-
/* avoid possible compiler optimization error */
static int sreadtwo (FILE *input) /* experiment 98/Feb/7 */
logdo_setsub(ureadtwo(infile));
}
-#ifdef IGNORED
-void logdo_set2(FILE *infile)
-{
- unsigned int c;
- c = ureadtwo(infile);
- if (skipflag == 0) {
-/* if (ff < 0) invalidset((int) c); */
- if (ff == BLANKFONT) invalidset((int) c);
- else if (c < 256) {
-/* if (bRemapControl && c < MAXREMAP) c = remaptable[c]; */
- if (bRemapControl || bRemapFont) {
- if (c < MAXREMAP) c = remaptable[c];
-#if MAXREMAP < 128
- else if (c == 32) c = 195;
- else if (c == 127) c = 196;
-#endif
- }
- else if (bRemapSpace && c <= 32) { /* 1995/Oct/17 */
- if (c == 32) c = 195; /* not 160 */
- else if (c == 13) c = 176; /* 1996/June/4 */
- else if (c == 10) c = 173; /* 1996/June/4 */
- else if (c == 9) c = 170; /* 1996/June/4 */
- else if (c == 0) c = 161;
- }
- currentfont[c] = 1;
- }
- }
-}
-#endif
-
void logdo_set3(FILE *infile)
{
logdo_setsub(ureadthree(infile));
pagemode = get_common_string(infile);
}
-/* example \special{papersize=5.04in,3.751in} */
+/* example \special{paper_size=5.04in,3.751in} */
void get_paper_size (FILE *infile)
{
-// if (strcmp(papersize,"") != 0) return; /* ignore all but first */
- if (papersize != NULL) return;
-// papersize = malloc ((size_t) (nspecial+1));
-// get_common_string(infile, papersize);
- papersize = get_common_string(infile);
+// if (strcmp(paper_size,"") != 0) return; /* ignore all but first */
+ if (paper_size != NULL) return;
+// paper_size = malloc ((size_t) (nspecial+1));
+// get_common_string(infile, paper_size);
+ paper_size = get_common_string(infile);
}
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
/* following added in 1995 July */
else if (strcmp(line, "DSCheader") == 0) get_custom_name(infile);
else if (strcmp(line, "DSCtext") == 0) get_custom_text(infile);
- else if (strcmp(line, "papersize") == 0) get_paper_size(infile);
+ else if (strcmp(line, "paper_size") == 0) get_paper_size(infile);
else if (strcmp(line, "DVIPSONE") == 0) get_command_spec(infile);
else if (strcmp(line, "DVIWindo") == 0) flush_special(infile);
/* else complain ??? */
return 0;
}
-/* Look for given PS FontName in atmreg.atm and return file name of PFB */
-/* returns 0 if found, -1 if not found */
-
-#ifdef IGNORED
-int SearchATMReg (FILE *input, unsigned long endfontlist,
- char *szPSFontName, char *szPFBFileName)
-{
- int c, k;
- unsigned int stroffset, nlen;
- unsigned long next;
- int boldflag, italicflag; /* style bits */
- int ttfflag;
-/* following just used for statistics - could remove to save time */
- int psflag, mmmflag, mmiflag, genflag; /* font type bits */
- int nMMM, nPFB, nPFM; /* index into dir path table */
- unsigned int flag[16]; /* 16 bytes of flags */
- char FaceName[LF_FACENAME+1]; /* Windows Face Name - not used */
- char StyleName[LF_FACENAME+1]; /* Style Name for TT font - not used */
- char FullName[LF_FULLFACENAME+1]; /* Full Name - not used */
- char FontName[LF_FULLFACENAME+1]; /* Font Name - used in comparison (T1 only) */
- char MMMName[LF_FACENAME+1]; /* PFM file or TTF file or MMM file */
- char PFBName[LF_FACENAME+1]; /* PFB file or PSS file - not used */
- char PFMName[LF_FACENAME+1]; /* PFM file of MMM font - not used */
-// char *s;
-
- *szPFBFileName = '\0';
-
- fseek(input, startfontlist, SEEK_SET);
-
-/* positioned at start of font list at this point */
-
- for (;;) {
- c = getc(input); /* check for end of file 99/Mar/1 */
- if (c == EOF) {
- break;
- }
- ungetc(c, input);
- stroffset = xreadtwo(input); /* offset to first string == 44 */
- nlen = xreadtwo(input); /* length of this record in bytes */
- next = xreadfour(input); /* pointer to next record */
- for (k = 0; k < (28 - 8); k++) (void) getc(input);
- for (k = 0; k < 16; k++) flag[k] = getc(input);
- boldflag = flag[1];
- if (boldflag == 0 || boldflag > 2) {
- if (boldflag > 2) boldflag = 1; /* pretend it is OK */
-/* break; */ /* impossible */ /* `fixed' 97/Sep/14 */
- }
- else boldflag = boldflag - 1;
- italicflag = flag[2];
- if (italicflag > 1) {
-/* break; */ /* impossible */ /* `fixed' 97/Sep/14 */
- }
- ttfflag = psflag = mmmflag = mmiflag = genflag = 0;
-/* ttfflag = flag[5]; */
- if (flag[4] == 0) ttfflag = 1;
- else if (flag[4] == 1) psflag = 1;
- else if (flag[4] == 2) mmmflag = 1;
- else if (flag[4] == 4) mmiflag = 1;
- if (flag[6] == 10) {
- genflag = 1;
- mmmflag = 0;
- }
- nMMM = flag[8] | (flag[9] << 8); /* index into path name table */
- nPFB = flag[10] | (flag[11] << 8); /* index into path name table */
- nPFM = flag[12] | (flag[13] << 8); /* index into path name table */
-/* mmflag = flag[12]; */
-
-// if (ttfflag) ttfcount++;
-// else if (genflag) gencount++;
-// else if (mmiflag) mmicount++;
-// else if (mmmflag) mmmcount++;
-// else pscount++;
-
-/* These used to all continue when they hit trouble */
-/* Windows Face Name */
- if (ReadString(input, FaceName, sizeof(FaceName)) < 0) goto donext;
-/* Style Name (will be empty string for PS SM or MM font) */
- if (ReadString(input, StyleName, sizeof(StyleName)) < 0) goto donext;
-/* Full Name (will be empty string for PS SM or MM font) */
- if (ReadString(input, FullName, sizeof(FullName)) < 0) goto donext;
-/* Font Name (may be empty if font file not yet read by ATM) */
- if (ReadString(input, FontName, sizeof(FontName)) < 0) goto donext;
-/* Name of MMM file or PFM file or TTF file */
- if (ReadString(input, MMMName, sizeof(MMMName)) < 0) goto donext;
-/* Name of PFB file or PSS file */
- if (ReadString(input, PFBName, sizeof(PFBName)) < 0) goto donext;
-/* Name of PFM file in case of MMM font */
- if (ReadString(input, PFMName, sizeof(PFMName)) < 0) goto donext;
-/* Flush extension from file name --- MMMName is file name */
-// if ((s = strchr(MMMName, '.')) != NULL) *s = '\0';
-/* Remove underscores from file name */
-/* removeunderscores(MMMName); */
-/* if (testflag == 0) removeunderscores (MMMName); */ /* ??? */
-/* Make all uppercase ? It's a file name so its safe at least */
-/* makeuppercase (MMMName); */ /* ??? */
-#ifdef DEBUGATM
- if (traceflag) {
-// sprintf(logline, "%s %s %s%s %s (%d)\n", MMMName, FaceName,
-// boldflag ? "BOLD" : "",
-// italicflag ? "ITALIC" : "",
-// ttfflag ? "(TT)" : "", pscount);
-// showline(logline, 0);
- sprintf(logline, "Face: `%s' Style: `%s' Full: `%s' Font: `%s' MMM: `%s' PFB: `%s' PFM: `%s'",
- FaceName, StyleName, FullName, FontName, MMMName, PFBName, PFMName);
- showline(logline, 0);
- }
-#endif
-/* if (strcmp(FontName, szPSFontName) == 0) */ /* ignore TrueType fonts */
- if (ttfflag == 0 && strcmp(FontName, szPSFontName) == 0 &&
- *PFBName != '\0') { // 2000 July 3
- if (DirPaths[nPFB] != NULL) strcpy(szPFBFileName, DirPaths[nPFB]);
- else *szPFBFileName = '\0'; // should not happen
- strcat(szPFBFileName, PFBName);
- if (traceflag) {
- sprintf(logline, " FOUND: %s for %s\n", szPFBFileName, szPSFontName);
- showline(logline, 0);
- }
- return 0; /* success */
- }
-donext: /* 1999/Mar/1 */
-/* if (findfontstart(input) < 0) break; */
- if (next >= endfontlist) break;
- if (fseek(input, next, SEEK_SET) < 0) break;
- }
- *szPFBFileName = '\0'; /* wipe clean again */
- return -1; /* failed to find */
-}
-#endif
-
/* New version uses ATMFonts structure */ /* First argument is PS FontName */
/* WRITES BACK INTO SECOND ARGUMENT */
/* returns 0 if found, -1 if not found */
return count;
}
-
-/* Look up specific font in ATMREG.ATM */
-/* scan atmreg.atm in the windows directory for font info */
-/* called with a single specific PS FontName */
-/* returns -1 if it fails for one reason or another */
-/* WRITES BACK INTO SECOND ARGUMENT */
-
-#ifdef IGNORED
-int LookupATMReg (char *szPSFontName, char *szPSFileName)
-{
- FILE *input;
- int n=0;
-
- if (! useatmreg) return -1; // tried before and failed
- if (szATMRegAtm == NULL) {
- if (SetupATMReg()) return -1; // failed to setup now
- }
- input = fopen(szATMRegAtm, "rb"); // open in binary mode for reading
- if (input == NULL) return -1; // probably because not found
- if (traceflag) {
- sprintf(logline, "Scanning %s ", szATMRegAtm);
- showline(logline, 0);
- }
- (void) ReadPointers(input);
- if (AllocDirs(nDirs)) return -1;
- SetupDirs(input, startdirlist, enddirlist);
- (void) fseek (input, startfontlist, SEEK_SET);
- n = SearchATMReg(input, endfontlist, szPSFontName, szPSFileName);
-// showline(" LookupATMReg ATTEMPT TO FREE DIRPATHS\n", 0); // debugging only
-// FreeDirs();
- fclose(input);
- return n;
-}
-#endif
-
/* First arg is PS FontName */ /* WRITES BACK INTO SECOND ARG */
int LookupATMReg (char *szPSFontName, char *szPSFileName)
/* added A2 and B3 1994/Dec/10 */
-char *papertypes[] =
-{
- "letter", "note", "legal", "folio", "ledger", "tabloid", "executive",
- "a2", "a3", "a4", "a5", "b3", "b4", "b5", "quarto", ""
-};
-
-/* in inches */
-double pagewidths[] =
-{
- 8.5, 8.5, 8.5, 8.5, 11, 11, 7.25,
- 420/25.4, 297/25.4, 210/25.4, 148/25.4,
- 354/25.4, 250/25.4, 176/25.4, 215/25.4, 1
-};
+typedef struct {
+ char * type;
+ double width;
+ double height;
+} paper_size_t;
-/* in inches */
-double pageheights[] =
+static paper_size_t paper_struct [] =
{
- 11, 11, 14, 13, 17, 17, 10.5,
- 594/25.4, 420/25.4, 297/25.4, 210/25.4,
- 500/25.4, 354/25.4, 250/25.4, 275/25.4, 1
+ {"letter", 8.5, 11},
+ {"note", 8.5, 11},
+ {"legal", 8.5, 14},
+ {"folio", 8.5, 13},
+ {"ledger", 11, 17},
+ {"tabloid", 11, 17},
+ {"executive", 7.25, 10.5},
+ {"a2", 420/25.4, 594/25.4},
+ {"a3", 297/25.4, 420/25.4},
+ {"a4", 210/25.4, 297/25.4},
+ {"a5", 148/25.4, 210/25.4},
+ {"b3", 354/25.4, 500/25.4},
+ {"b4", 250/25.4, 354/25.4},
+ {"b5", 176/25.4, 250/25.4},
+ {"quarto", 215/25.4, 275/25.4},
+ {"", 1, 1}
};
/* `statement' 5 1/2 x 8 1/2 */
-char *papertype=NULL; /* "letter" or "" ? from command line */
-
-char *boundingtype=NULL; /* "letter" or "" ? 94/May/6 */
-
-char *papersize=NULL; /* Custom paper size specified via special */
-
-char *dscextra=NULL; /* extra DSC comment to add in 94/May/6 */
+char *paper_type = NULL; /* "letter" or "" ? from command line */
+char *bounding_type = NULL; /* "letter" or "" ? 94/May/6 */
+char *paper_size = NULL; /* Custom paper size specified via special */
+char *dsc_extra = NULL; /* extra DSC comment to add in 94/May/6 */
/* compute later using command line page size argument */
int currentdirect=1; /* non-zero => place output current directory */
-int magniflag=0; /* next arg => user specified magnification */
+int magniflag =0; /* next arg => user specified magnification */
int rotateflag=0; /* next arg => user specified rotation */
int xoffsetflag=0; /* next arg => user specified xoffset */
int yoffsetflag=0; /* next arg => user specified yoffset */
int wantcontrold=0; /* non-zero => want control D added at end */
int tryunderscore=1; /* non-zero => try underscore form of font file name */
-/* int showlogflag=0; */ /* non-zero => show log of fonts and characters */
-/* int wantpreamble=1; *//* non-zero => want preamble */
-/* int wanthistogram=0; */ /* non-zero => make histogram of commands */
-/* int deepstack=0; */ /* non-zero => want deeper stack */
-/* int wantpacking=1; */ /* try and pack PS code */
-/* int wantcpyrght=1; */ /* want copyright message in output file */
-
int bAllowStandard=1; /* allow use of StandardEncoding - if it works */
int bAllowTexText=1; /* allow use of TeXtext encoding - if it works */
int bAllowANSI=1; /* allow use of ANSI encoding - if it works */
char *fontprefix=NULL; /* prefix to use on FontName */
-char szRandomPrefix[8]="ABCDEF+"; /* Random prefix for Acrobat */
+char szRandomPrefix[8]="ABCDEF+"; /* Random prefix for Adobe Reader */
/* avoid partial font subfont cache problem */
/* 6 characters followed by + and terminating null */
int rangeindex=0; /* index into following table */
-// long beginpages[MAXRANGES]; /* table of pagebegins - 48 bytes*/
-long *beginpages=NULL; /* table of pagebegins */
-// long endpages[MAXRANGES]; /* table of pagebegins - 48 bytes*/
-long *endpages=NULL; /* table of pageends - */
+long *beginpages = NULL; /* table of pagebegins */
+long *endpages = NULL; /* table of pageends - */
// int pagerangeseq[MAXRANGES]; /* which instance of page range desired ? */
int *pagerangeseq=NULL; /* which instance of page range desired ? */
#define UNKNOWNOFFSET -32767.0
-double xoffsete=UNKNOWNOFFSET; /* x offset even pages */
-double yoffsete=UNKNOWNOFFSET; /* y offset even pages*/
-
-double xoffseto=UNKNOWNOFFSET; /* x offset odd pages */
-double yoffseto=UNKNOWNOFFSET; /* y offset odd pages */
+double xoffsete = UNKNOWNOFFSET; /* x offset even pages */
+double yoffsete = UNKNOWNOFFSET; /* y offset even pages*/
+double xoffseto = UNKNOWNOFFSET; /* x offset odd pages */
+double yoffseto = UNKNOWNOFFSET; /* y offset odd pages */
int evenoddoff = 0; /* non-zero if offset differs even/odd pages */
int nRepeatIndex=0;
int nRepeatCount=1; /* new way to make multiple copies 95/Aug/27 */
-long nMinRule=0; /* min rule thickness (Acrobat fix) 95/Oct/10 */
+long nMinRule=0; /* min rule thickness (Adobe Reader fix) 95/Oct/10 */
int version=2;
int revision=2; /* now obtained from progversion string */
int subrevision=4;
-char *progversion="2.2.4"; /* 2000/May/24 */
+char *progversion = "2.2.4"; /* 2000/May/24 */
/* WARNING: remember to *also* change version number in DVIPREAM.PS !!! */
/* look for line: /checkversion{1 2 3 hashversion 4 1 roll hashversion ne */
//"(at your option) any later version.\n\n";
-/* char *company="Y&&Y, Inc. USA"; */ /* double percent for Acrobat Info */
-
-/* char *company="Y&Y, Inc. USA"; */ /* 97/Jan/30 */
-
char *company = "Y&Y, Inc."; /* 97/Apr/29 */
char *URL = ""; /* string in binary ... */
char *commandspec=NULL; /* command line stuff from DVI file */
int keywordslen=0; /* how much has been accumulated in following */
-char *keywords=NULL; /* accumulated keywords from PDF: Keywords ... */
- /* need to free at end of file */
-
-char *creatorstring=NULL; /* Creator for DocInfo in Acrobat */
- /* need to free at end of file */
-
-char *titlestring=NULL; /* Title for DocInfo in Acrobat */
- /* need to free at end of file */
-
-char *subjectstring=NULL; /* Subject for DocInfo in Acrobat */
- /* need to free at end of file */
-
-char *authorstring=NULL; /* Author for DocInfo in Acrobat */
- /* need to free at end of file */
+char *keywords = NULL; /* accumulated keywords from PDF: Keywords ... */
+char *creatorstring = NULL; /* Creator for DocInfo in Adobe Reader */
+char *titlestring = NULL; /* Title for DocInfo in Adobe Reader */
+char *subjectstring = NULL; /* Subject for DocInfo in Adobe Reader */
+char *authorstring = NULL; /* Author for DocInfo in Adobe Reader */
+char *basestring = NULL; /* Base for DocView in Adobe Reader */
+char *pagemode = NULL; /* Base for DocView in Adobe Reader */
-char *basestring=NULL; /* Base for DocView in Acrobat */
- /* need to free at end of file */
-
-char *pagemode=NULL; /* Base for DocView in Acrobat */
- /* need to free at end of file */
char line[MAXLINE]; /* general purpose input `buffer' 512 bytes */
/* Code to show VM usage and page rendering time: */ /* flushed 1996/May/6 */
-#ifdef IGNORED
-static char showpagecode[] = "\
-dvidict begin\n\
-/showpageinfo{save % ctm setmatrix\n\
-/Helvetica findfont 10 scalefont setfont\n\
-72 PageHeight 36 sub moveto\n\
-(Total VM in use: ) show exch =string cvs show ( bytes) show\n\
-currentpoint exch pop PageWidth 3 div 36 add exch moveto\n\
-(Page VM usage: ) show exch =string cvs show ( bytes) show\n\
-currentpoint exch pop PageWidth 3 div 2 mul exch moveto\n\
-(Rendering time: ) show exch 10 div cvi 100 div =string cvs show\n\
-( seconds) show restore}bd\n\
-/bphook{vmstatus pop exch pop usertime}bd\n\
-/ephook{usertime exch sub exch dup vmstatus pop exch pop exch sub exch\n\
-showpageinfo}bd\n\
-end\n\
-";
-#endif
-
/* % add processing to beginning and end of page:\n\ */
/* char *duplexcode = "\
// int finx[MAXFONTNUMBERS]; /* index into next now default */
short finx[MAXFONTNUMBERS]; /* index into next */
-
-/* char fontname[MAXFONTS][MAXTEXNAME]; */ /* names of fonts called for */
-// char *fontname; /* 1994/Feb/2 */
char *fontname[MAXFONTS]; /* 1999/Nov.6 */
-
-/* char subfontname[MAXFONTS][MAXFONTNAME]; */ /* substituted font name */
-// char *subfontname; /* 1994/Feb/2 */
char *subfontname[MAXFONTS]; /* 1999/Nov/6 */
-
-// char fontvector[MAXFONTS][MAXVECNAME]; /* font remapping vector if any */
-// char *fontvector; /* font remapping vector if any */
char *fontvector[MAXFONTS]; /* font remapping vector if any */
-
-// char *fontchar; /* which characters seen */
char *fontchar[MAXFONTS]; /* which characters seen */
-
int fontsubflag[MAXFONTS]; /* non-negative if substitute font to be used */
- /* number indicates base font - 256 bytes */
-
int fontproper[MAXFONTS]; /* code if font is resident/forced/remapped */
-
unsigned long fc[MAXFONTS]; /* checksum of TFM file (use for encoding info) */
- /* reenabled 95/Jan/10 - 512 bytes */
-
unsigned long fs[MAXFONTS]; /* at size - 512 bytes */
/* unsigned long fd[MAXFONTS]; */ /* design size */ /* NOT ACCESSED ? */
char *logfilename = "dvipsone.log";
#endif
-FILE *logfile = NULL; /* 1999/Apr/20 */
-FILE *input = NULL; /* used by following */
-FILE *output = NULL; /* used by `interrupt handler' */
+FILE * logfile = NULL; /* 1999/Apr/20 */
+FILE * input = NULL; /* used by following */
+FILE * output = NULL; /* used by `interrupt handler' */
char fn_in[FNAMELEN], fn_out[FNAMELEN]; /* 1994/Mar/1 */
void checkexit (int n) /* 95/Oct/28 */
{
checkpause(1);
+
#ifdef USELOGFILE
if (logfile != NULL)
{
logfile = NULL;
}
#endif
-#ifdef _WINDOWS
-// sprintf(logline, "CHECKEXIT %d\n", n);
-// showline(logline, 1); // debugging only
-// abortflag++;
-#else
-// exit(n);
-#endif
+
uexit(n);
}
sprintf(logline, " ERROR: Unable to allocate memory for %s\n", s);
showline(logline, 1);
-#ifdef _WINDOWS
-// abortflag++;
-// return NULL;
-#endif
+
#ifndef _WINDOWS
showline("Press any key to continue . . .\n", 0);
pause();
/* WARNING: this will return NULL if not found anywhere - just like getenv */
-#ifdef _WINDOWS
-char *grabenvvar (char *varname, char *inifile, char *section, int useini)
-{
- (void) GetPrivateProfileString(section, varname, "", line, sizeof(line), inifile);
-
- if (traceflag)
- {
- sprintf(logline, "%s=%s\n", varname, line);
- showline(logline, 0);
- }
-
- if (*line != '\0')
- return zstrdup(line);
- else
- return getenv(varname);
-}
-#else
char *grabenvvar (char *varname, char *inifile, char *section, int useini)
{
FILE *input;
return getenv(varname); /* failed, so try and get from environment */
/* no tusing strdup when non-NULL ? */
} /* this will return NULL if not found anywhere */
-#endif
-
-/* WARNING: this will return NULL if not found anywhere - just like getenv */
-
-#ifdef _WINDOWS
-/* get from [Environment] in dviwindo.ini */
-char *grabenv (char *varname)
-{
- (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);
-}
-#else
-/* get from [Environment] in dviwindo.ini */
+/* WARNING: this will return NULL if not found anywhere - just like getenv */
char *grabenv (char *varname)
{
if (usedviwindo && ! dviwindoinisetup)
return grabenvvar (varname, dviwindo, "[Environment]", usedviwindo);
}
-#endif
/***************************************************************************/
s += strlen(s);
showline(s, 0);
sprintf(s, " l: paper size type (default `%s')\n",
- (papertype != NULL) ? papertype : "");
+ (paper_type != NULL) ? paper_type : "");
s += strlen(s);
sprintf(s, " d: destination ");
s += strlen(s);
void cleanup (void)
{
-/* nothing much to do unless output file open */
if (output != NULL)
{
if (directprint)
fflush(stdout); /* ??? 98/Jun/30 */
#endif
-/* if (wantcontrold != 0) { */ /* changed 1993/Mar/5 */
if (wantcontrold != 0 || stripcomment != 0)
{
-/* putc(3, output); */ /* send control-C */
-// putc(4, output); /* send control-D */
PSputc(4, output); /* send control-D */
}
-#ifdef _WINDOWS
- PSputs("", output); // flush PS buffer in DLL version
-#else
- fflush(output); /* ??? 98/Jun/30 */
-#endif
- fclose(output); /* close output */
- waitasec(1000); /* give it time to clear out ? */
+
+ fflush(output); /* ??? 98/Jun/30 */
+ fclose(output); /* close output */
+ waitasec(1000); /* give it time to clear out ? */
}
else
{
- if (wantcontrold) { /* added 1993/Mar/5 */
-/* putc(3, output); */ /* send control-C */
-// putc(4, output); /* send control-D */
+ if (wantcontrold)
+ {
PSputc(4, output); /* send control-D */
}
+
fclose(output); /* close output */
(void) remove(fn_out); /* and remove bad file */
}
}
-/* fcloseall(); */
}
void abortjob (void)
{
cleanup();
checkexit(3);
-// return -1;
}
/* called each time `survivable' error encountered */
}
/***********************************************************************/
-
/* flag = 0 => DocumentFonts */ /* => no longer used */
/* flag = 1 => DocumentSuppliedFonts */ /* => DocumentSuppliedResources */
/* this should also write out fonts that have not been found when flag = 0 */
int writefontlist (FILE *outfile, int flag, int column)
{
int k, want;
- int wanted=0, missing=0, resident=0, dependent=0, unused=0, instance=0;
+ int wanted = 0, missing = 0, resident = 0, dependent = 0, unused = 0, instance = 0;
// char ftemp[MAXTEXNAME];
char ftemp[FNAMELEN];
/* a4tray, b5tray, legaltray, lettertray - or setpageparams ? */
-/* \special{papersize=5.04in,3.75in} */
+/* \special{paper_size=5.04in,3.75in} */
-int decodepapersize (char *papersize, double *pagewidth, double *pageheight)
+int decode_paper_size (char *paper_size, double *pagewidth, double *pageheight)
{
double multiple;
double width, height;
char units[3];
- char *s=papersize;
+ char *s=paper_size;
int n;
- if (papersize == NULL || *papersize == '\0')
+ if (paper_size == NULL || *paper_size == '\0')
return -1;
if(sscanf(s, "%lg%n", &width, &n) > 0)
}
else
{
- sprintf(logline, "Don't understand papersize %s\n", papersize);
+ sprintf(logline, "Don't understand paper_size %s\n", paper_size);
showline(logline, 1);
return -1;
}
}
else
{
- sprintf(logline, "Don't understand papersize %s\n", papersize);
+ sprintf(logline, "Don't understand paper_size %s\n", paper_size);
showline(logline, 1);
return -1;
}
/* PS letter, note, legal, ledger ? */
/* use table for neatness */
-int analpapertype (char *papertype, double *pagewidth, double *pageheight)
+int analpapertype (char *paper_type, double *pagewidth, double *pageheight)
{
int k;
- if (papertype == NULL)
+ if (paper_type == NULL)
return 0;
- for (k= 0; k < 32; k++) /* 94/May/6 */
+ for (k= 0; k < 32; k++)
{
- if (strcmp(papertypes[k], "") == 0)
+ if (strcmp(paper_struct[k].type, "") == 0)
break;
- if (strcmp(papertypes[k], papertype) == 0)
+ if (strcmp(paper_struct[k].type, paper_type) == 0)
{
- *pagewidth = pagewidths[k] * 72;
- *pageheight = pageheights[k] * 72;
+ *pagewidth = paper_struct[k].width * 72;
+ *pageheight = paper_struct[k].height * 72;
return 0;
}
}
-/* stupid compiler doesn't like it if we do following in same loop! */
-/* 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 */
+
+ for (k= 0; k < 32; k++)
{
- if (strcmp(papertypes[k], "") == 0)
+ if (strcmp(paper_struct[k].type, "") == 0)
break;
/* Try landscape versions ... (In which first letter upper case) 94/July/1 */
- if (_strcmpi(papertypes[k], papertype) == 0)
+ if (_strcmpi(paper_struct[k].type, paper_type) == 0)
{
- *pageheight = pagewidths[k] * 72;
- *pagewidth = pageheights[k] * 72;
+ *pageheight = paper_struct[k].width * 72;
+ *pagewidth = paper_struct[k].height * 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)
+/* if (sscanf(paper_type, "%lg*%lg", &pagewidth, &pageheight) == 2) { *//*NO*/
+ if (sscanf(paper_type, "%lg*%lg", pagewidth, pageheight) == 2)
{
return 0;
}
// insert code to interpret 4in*5in e.g. ???
- if (decodepapersize(papertype, pagewidth, pageheight) == 0)
+ if (decode_paper_size(paper_type, pagewidth, pageheight) == 0)
return 0;
- sprintf(logline, "Don't understand papertype: %s\n", papertype);
+ sprintf(logline, "Don't understand paper_type: %s\n", paper_type);
showline(logline, 1);
errcount(0);
}
/* Thu Sep 27 06:26:35 1990 => 1990 Sep 27 06:26:35 */
-
void lcivilize (char *date)
{
int k;
strcpy(date, compiledate);
scivilize(date);
-// following revised for Acrobat 4.0 so Creator shows URL
-#ifdef _WINDOWS
+// following revised for Adobe Reader 4.0 so Creator shows URL
strcpy(s, "DVIPSONE ");
-#else
- strcpy(s, "DVIPSONE ");
-#endif
s += strlen(s);
fclose(input);
}
-void showowner(char *, char *, int);
-
void showownerout(char *);
void addescapes (char *sline, char *filename, int nlen) // puts result in line
}
/* Write DSC header */
-
void writestruct (FILE *outfile)
{
time_t ltime; /* for time and date */
int xll, yll, xur, yur; /* 1995/Sep/16 */
char *u; /* 1995/July/15 */
- PSputs("%!PS-Adobe-3.0\n", outfile); /* 1992/July/18 */
+ PSputs("%!PS-Adobe-3.0\n", outfile);
if (stripcomment != 0)
- return; /* 1993/March/5 */
+ return;
+
+ (void) time(<ime);
-/* get current date and time */
- (void) time(<ime); /* get seconds since 1970 */
- if (ltime < 0) /* "impossible" error */
+ if (ltime < 0)
{
sprintf(logline, "ERROR: Time not available (%0ld)!\n", ltime);
showline(logline, 1);
}
s = ctime(<ime);
- if (s == NULL) /* "impossible" error */
+
+ if (s == NULL)
{
- sprintf(logline, "ERROR: Cannot convert time (%0ld)!\n", ltime); /* 96/Jan/4 */
+ sprintf(logline, "ERROR: Cannot convert time (%0ld)!\n", ltime);
showline(logline, 1);
s = "Thu Jan 18 22:14:00 2038";
}
if (filenamex != NULL)
{
- addescapes(line, filenamex, sizeof(line)); /* MAXLINE */
+ addescapes(line, filenamex, sizeof(line));
PSputs(line, outfile);
}
+
PSputc('\n', outfile);
- PSputs("%%Creator: ", outfile); /* 1992/July/18 */
+ PSputs("%%Creator: ", outfile);
stampit(line, 0);
PSputs(line, outfile);
PSputc('\n', outfile);
PSputs("%%For: ", outfile);
- showownerout(line); /* MAXLINE */
+ showownerout(line);
strcat(line, "\n");
PSputs(line, output);
}
PSputs("%%BoundingBox: ", outfile);
- if (BBxll != 0 || BByll != 0 || BBxur != 0 || BByur != 0) /* 96/May/4 */
+
+ if (BBxll != 0 || BByll != 0 || BBxur != 0 || BByur != 0)
{
/* should really convert from TeX coordinates to PS coordinates */
xll = BBxll; yll = BByll;
}
else
{
- if (boundingtype == NULL) /* 94/May/6 */
+ if (bounding_type == NULL)
{
xll = 72;
yll = (int) ((double) pageheight - 72 - (unsigned long) (dvi_l / 65781));
}
else
{
- boundheight = 11*72; boundwidth = 8.5*72; /* default */
+ boundheight = 11 * 72; boundwidth = 8.5 * 72; /* default */
- if (boundingtype != NULL)
- analpapertype(boundingtype, &boundwidth, &boundheight);
+ if (bounding_type != NULL)
+ analpapertype(bounding_type, &boundwidth, &boundheight);
xll = 0;
yll = 0;
yur = (int) boundheight;
}
}
- sprintf(logline, "%d %d %d %d\n", xll, yll, xur, yur); /* 95/Sep/16 */
+
+ sprintf(logline, "%d %d %d %d\n", xll, yll, xur, yur);
PSputs(logline, output);
pages = numpages;
+
if (collated)
- pages = pages * copies; /* 94/Oct/12 */
+ pages = pages * copies;
if (nRepeatCount > 1)
- pages = pages * nRepeatCount; /* 95/Aug/27 */
+ pages = pages * nRepeatCount;
PSputs("%%Pages: ", outfile);
sprintf(logline, "%ld\n", pages);
PSputs(logline, output);
-/* %%PageOrder is highly optional ... */
+ /* %%PageOrder is highly optional ... */
if (bOptionalDSC)
{
PSputs("%%PageOrder: ", outfile);
- sprintf(logline, "%s\n",
- reverseflag ? "Descend" : "Ascend");
+ sprintf(logline, "%s\n", reverseflag ? "Descend" : "Ascend");
PSputs(logline, output);
}
missing = writefontlist(outfile, 1, 29);
PSputs("%%+ procset ", outfile);
- sprintf(logline, "%s %d %d\n",
- procsetrest, version, revision); /* no subrevision number */
+ sprintf(logline, "%s %d %d\n", procsetrest, version, revision);
PSputs(logline, output);
if (needtpic != 0)
{
PSputs("%%+ procset ", outfile);
- sprintf(logline, "%s %d %d\n",
- tpicrest, version, revision); /* no subrevision number */
+ sprintf(logline, "%s %d %d\n", tpicrest, version, revision);
PSputs(logline, output);
}
prolog_comments (prologfile[k], outfile);
}
-/* should have version and revision? */
+ /* should have version and revision? */
if (headerfile != NULL)
prolog_comments(headerfile, outfile); /* 1993/Nov/15 */
PSputs("%%DocumentNeededResources: ", outfile);
writemissing(outfile, 27);
}
-/* Extra DSC code supplied on command line using -*D=... */
-/* 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)
+
+ /* Extra DSC code supplied on command line using -*D=... */
+ /* If first character is not %, then convert all matching chars to space */
+ /* If --- after that --- first char is not %, insert %% before it */
+ if (dsc_extra != NULL)
{
- c = *dscextra; /* look at first character */
+ c = *dsc_extra; /* look at first character */
if (c != '%')
{
- s = dscextra;
+ s = dsc_extra;
while (*(s+1) != '\0') {
if (*(s+1) == c)
*s = ' '; /* replace magic with space */
else
- *s = *(s+1); /* shift left one character */
+ *s = *(s+1); /* shift left one character */
s++;
}
*s = '\0'; /* terminate */
- c = *dscextra;
+ c = *dsc_extra;
}
if (c != '%')
{
PSputs("%%", output);
}
- PSputs(dscextra, output);
+
+ PSputs(dsc_extra, output);
PSputc('\n', output);
}
-/* Extra DSC code supplied in \special{DSCtext=...} */
-/* We are not checking whether lines start with %% and so on */
+ /* Extra DSC code supplied in \special{DSCtext=...} */
+ /* We are not checking whether lines start with %% and so on */
if (dsccustom != NULL) /* 1995/July/15 */
{
u = dsccustom;
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);
- PSputc('\n', output);
-
-
+ PSputs("%%Copyright: (C) 2014, Clerk Ma.\n", output);
PSputs("%%EndComments", outfile); /* may omit if next line ... */
PSputc('\n', outfile);
}
/* Made common routines to save strig space */
-
-void dvidictbegin(FILE *outfile) /* 1993/Dec/29 */
+void dvidictbegin(FILE *outfile)
{
PSputs("dvidict begin\n", outfile);
}
-void dvidictend(FILE *outfile) /* 1993/Dec/29 */
+void dvidictend(FILE *outfile)
{
PSputs("end", outfile);
{
sprintf(logline, "/den %lu def ", den);
}
+
PSputs(logline, output);
#else
{
showline(logline, 0);
}
}
+
sprintf(logline, "/mag %lu def\n", mag); /* TeX magnification * 1000 */
PSputs(logline, output);
-/* now for user specified transformations: */
+ /* 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);
+ PSputs(logline, output);
sprintf(logline, "/xmagnif %lg def /ymagnif %lg def /rotation %lg def\n",
xmagnification, ymagnification, rotation);
PSputs(logline, output);
-
sprintf(logline, "/PageHeight %lg def /PageWidth %lg def\n",
pageheight, pagewidth);
PSputs(logline, output);
PSputs(logline, output);
}
-/* Does user want to explicitly set screen frequency ? 94/March/18 */
+ /* Does user want to explicitly set screen frequency ? 94/March/18 */
if (frequency >= 0)
{
if (frequency > 0) /* did user specified frequency & angle ? */
}
PSputs(" dviscreen\n", output);
}
+
dvidictend (outfile);
}
// returns -1 if it fails
-int copypreamble (FILE *output, FILE *input, char *procsetfile, int checkflag)
+int copy_preamble (FILE *output, FILE *input, char *procsetfile, int checkflag)
{
int c, d, column;
int goodflag = 0; /* 93/Mar/31 */
return -1;
}
-void expand_separators (char *line) // for filename in PS string
+void expand_separators (char *line)
{
- char *s=line;
- while ((s = strchr(s, '\\')) != NULL) {
+ char *s = line;
+
+ while ((s = strchr(s, '\\')) != NULL)
+ {
memmove(s+1, s, strlen(s)+1); // "\" => "\\"
s += 2;
}
if (stripcomment == 0)
{
- sprintf(logline, "procset %s %d %d\n", procsetrest, version, revision); /* no subrevision number */
+ sprintf(logline, "procset %s %d %d\n", procsetrest, version, revision);
PSputs(logline, output);
}
-/* if ((infile = fopen(procsetfile, "r")) == NULL) { */
infile = fopen(procsetfile, "rb");
- if (input == NULL) /* 93/Oct/3 */
+ if (input == NULL)
{
sprintf(logline, "ERROR: Can't find preamble file `%s'\n", procsetfile);
showline(logline, 1);
strcat(logline, " ]%%) = flush % for Distiller log\n");
PSputs(logline, outfile);
}
- ret = copypreamble(outfile, infile, procsetfile, checkflag);
+ ret = copy_preamble(outfile, infile, procsetfile, checkflag);
fclose(infile);
if (abortflag) ret = -1;
}
+
if (stripcomment == 0)
PSputs("%%EndResource\n", outfile);
return ret;
}
-/* void copyprologfile(char *filename, FILE *outfile) { */
void copyprologfilesub (char *filename, FILE *outfile)
{
- FILE *infile;
+ FILE * infile;
if (verboseflag)
{
sprintf(logline, "procset %s\n", filename); /* should have version and revision? */
PSputs(logline, output);
}
+
dvidictbegin(outfile);
copyepssimple(outfile, infile); /* 1993/Jan/24 */
fclose(infile);
fclose(infile);
return 0;
}
+
return -1; // failed
}
FILE *infile;
char *s;
-// if explicit path given use that
+ // if explicit path given use that
if (strpbrk(procsetrest, "\\/:") != NULL)
{
strcpy(procsetfile, procsetrest);
return -1; // failed
}
-#ifdef _WINDOWS
-char *achDiag = "Diagnostics"; /* Profile file section name */
-char *achFile = "dviwindo.ini";
-#endif
-
/* the following needs more work ... structuring conventions and such */
/* also no coalesced mostly into on preamble => make file ? */
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);
}
else if (paperflag != 0)
{
- papertype = s;
+ paper_type = s;
paperflag = 0;
}
else if (boundingflag != 0)
{
- boundingtype = s;
+ bounding_type = s;
boundingflag = 0;
}
else if (dscextraflag != 0)
{
- dscextra = s;
+ dsc_extra = s;
dscextraflag = 0;
}
else if (afmflag != 0)
strcpy(date + 6, date + 7);
}
-void writedocinfo (FILE *output) /* write DOCINFO & PAGES pdfmarks */
+void writedocinfo (FILE *output)
{
time_t ltime; /* for time and date */
char *s = "";
}
sprintf(logline, "[ /Title (%s)\n", line); /* optional */
PSputs(logline, output);
-/* for PDFmark need date/time format (D:YYYYMMDDHHmmSS) */
- (void) time(<ime); /* get seconds since 1970 */
-/* added some sanity checks 98/July/29 */
+ (void) time(<ime);
+
if (ltime > 0)
{
s = ctime(<ime);
+
if (s != NULL)
{
lcivilize(s);
free(creatorstring);
creatorstring = NULL;
}
-// fputs(" /Creator (", output); /* optional */
-// PSputs(" /Creator (", output); /* optional */
-/* stampit(output, 1, 0); */
-// stampit(output, 0, 0); /* 98/Apr/20 */
-// stampit(line, 0, 0); /* 98/Apr/20 */
-// PSputs(line, output);
-/* putc(' ', output); */
-/* fputs(company, output); */
-/* putc(' ', output); */
-/* fputs(URL, output); */
-// fputs(")\n", output);
-// PSputs(")\n", output);
+
if (*line != '\0')
{
sprintf(logline, " /Creator (%s)\n", line);
PSputs(logline, output);
}
-/* Allow insertion of keywords using \special{keywords=...} 96/May/10 */
+ /* Allow insertion of keywords using \special{keywords=...} 96/May/10 */
if (keywords != NULL)
{
*line = '\0';
/* only if PageMode or Base URL specified */
PSputs("[", output);
+
if (pagemode != NULL)
{
strcpy(line, pagemode);
sprintf(logline, " /URI << /Base (%s) >>\n", line);
PSputs(logline, output);
}
+
PSputs("/DOCVIEW pdfmark\n", output);
/* Could also have PageMode (UseNone, UseOutlines, UseThumbs, FullScreen) */
/* (Default is UseNone) --- see Table 10 in TN 5150 */
void writesetup (FILE *output, char *filename)
{
time_t ltime; /* for time and date */
- int c; /* for first letter of papertype */
+ int c; /* for first letter of paper_type */
char *s;
/* Don't bother with following if writing direct to printer ? */
PSputs(s, output);
PSputs(")\nput\n", output);
- if (papertype != NULL || papersize != NULL)
+ if (paper_type != NULL || paper_size != NULL)
{
PSputs("[{\n", output);
if (stripcomment == 0)
PSputs("%%BeginFeature: ", output);
PSputs("*PageSize", output);
- if (papertype != NULL && strchr(papertype, '*') == NULL)
+ if (paper_type != NULL && strchr(paper_type, '*') == NULL)
{
PSputc(' ', output);
- c = *papertype;
+ c = *paper_type;
if (c >= 'a' && c <= 'z')
c = c + 'A' - 'a';
PSputc(c, output);
- PSputs(papertype + 1, output);
+ PSputs(paper_type + 1, output);
}
PSputc('\n', output);
}
/* don't output page command if `custom size' -l=<width>*<height> 94/Dec/16 */
-/* if (strcmp(papertype, "custom") != 0) */
+/* if (strcmp(paper_type, "custom") != 0) */
/* statusdict /lettertray get exec ??? */
- if (papertype != NULL && strchr(papertype, '*') == NULL)
+ if (paper_type != NULL && strchr(paper_type, '*') == NULL)
{
- PSputs(papertype, output); /* since already stopped context */
+ PSputs(paper_type, output); /* since already stopped context */
}
else
{
fontname[k] = subfontname[k] = fontvector[k] = fontchar[k] = NULL;
}
-/* exehdr says: DVIPSONE.EXE needs 190k to load */
-/* In DOS: */
-/* Above says allocated 78848, 22454 avail, 22434 memmax, 2628 stack avail */
-/* In Epsilon 7.0 process buffer in Windows NT: */
-/* Above says allocated 39434, 21910 avail, 21890 memmax, 2628 stack avail */
-
void freememory (void) /* check that heap was not corrupted */
{
int k;
+
for (k = 0; k < MAXSUBSTITUTE; k++)
{
if (fontsubfrom[k] != NULL)
char *s, *t, *filename;
clock_t sclock, lclock, fclock, eclock;
char *mode;
- unsigned long starttime; /* seconds since 1970 Jan 1 */
+ unsigned long starttime;
int count = 0;
#ifdef USELOGFILE
// following assumes dvipsone and dviwindo are subdirectories of same thing
-#ifdef _WINDOWS
- if ((s = grabenv("YANDYPATH")) != NULL)
- {
- strcpy(line, s);
- strcat(line, "\\dvipsone");
- programpath = zstrdup(s);
- }
- else
- {
- 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"
- }
-#else
programpath = zstrdup(argv[0]);
stripname(programpath); // flush executable name
-#endif
+
strcpy(programpath, getenv("DVIPSONE")); // CM 20140401
/* if programpath doesn't exist - try and guess - not really likely ! */
if (verboseflag)
showline("\n", 0);
-/* Code to make up random prefix to avoid Acrobat partial font problem */
+/* Code to make up random prefix to avoid Adobe Reader partial font problem */
if (bRandomPrefix)
{
starttime = (unsigned long) time(NULL);
evenpageflag = 0; oddpageflag = 0;
}
-#ifdef _WINDOWS
- showcommand(NULL, argc, argv, 0); /* show command line */
-#else
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 */
}
-#endif
-// doallocation();
initialtables();
-
initializeencoding(bANSITeX); /* textext and ansi encoding from SE */
- /* now used only in 16 bit version */
if (traceflag)
{
/* also, don't force extension if an extension was specified */
/* also, try and figure out if going direct to a printer */
-#ifdef _WINDOWS
- if (outputfile != NULL && usecallbackflag == 0)
-#else
if (outputfile != NULL)
-#endif
{
strcpy(fn_out, outputfile);
}
}
-#ifdef _WINDOWS
- if (usecallbackflag) // if we are going to use callback function
- {
- directprint = 0;
- stripcomment = 0;
- output = NULL;
- }
-#endif
-
if (bAbort)
abortjob();
filename = removepath(fn_in); /* strip off path of file */
// if (strcmp(outputfile, "") == 0) /* output file specified ? */
-#ifdef _WINDOWS
- if (outputfile == NULL && usecallbackflag == 0)
-#else
if (outputfile == NULL)
-#endif
{
if (currentdirect != 0) /* write in current directory ? */
strcpy(fn_out, filename);
// directprint = 1; // debugging only
// stripcomment = 1; // debugging only
-#ifdef _WINDOWS
- sprintf(logline, "(%sto %s)\n", directprint ? "direct " : "",
- usecallbackflag ? "DVIWindo" : fn_out);
-#else
sprintf(logline, "(%sto %s)\n", directprint ? "direct " : "",
fn_out);
-#endif
showline(logline, 0);
/* input = fp_in; */
rewind(input); /* get set for next pass */
-/* printf("NUMPAGES %ld\n", numpages); */ /* debugging 94/Oct/13 */
-
- if (useatmreg)
- {
- if (LoadATMREG() < 0) // try and get info from ATMREG.ATM
- {
- if (verboseflag) showline("Warning: no ATMREG.ATM ", 0);
-// return -1;
- }
- }
-
task = "checking for duplicate & substitutions";
if (substituteflag) // this is done once per file now
preextract();
/* do the following only once ? not needed for every file ? */
-/* analpapertype(papertype); */
+/* analpapertype(paper_type); */
/* get PageHeight and PageWidth */ /* 94/May/6 */
pageheight = 11*72; pagewidth = 8.5*72; /* default */
- if (papersize != NULL)
- decodepapersize(papersize, &pagewidth, &pageheight);
+ if (paper_size != NULL)
+ decode_paper_size(paper_size, &pagewidth, &pageheight);
- if (papertype != NULL)
- analpapertype(papertype, &pagewidth, &pageheight);
+ if (paper_type != NULL)
+ analpapertype(paper_type, &pagewidth, &pageheight);
lclock = clock(); /* end of prescan - start of fonts */
if (bCarryColor && bColorUsed)
freecolorsave(); // 2000 May 27
- if (papersize != NULL)
+ if (paper_size != NULL)
{
- free(papersize);
- papersize = NULL;
+ free(paper_size);
+ paper_size = NULL;
}
+
count++; /* 99/Mar/17 */
-#ifdef _WINDOWS
- PSputs("", output); // flush PS buffer in DLL version
-#else
fflush(stdout); /* ??? 98/Jun/30 */
-#endif
freememory(); // moved here to happen every file
if (flag == 0)
return 0;
-
-#ifdef _WINDOWS
- return flag;
-#else
- else exit (flag);
-#endif
+ else
+ exit (flag);
}
//////////////////////////////////////////////////////////////////////////////
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA. */
-/////////////////////////////////////////////////////////
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
-#ifdef _WINDOWS
- #pragma warning(disable:4100) // unreferenced formal variable
-#endif
-
#pragma warning(disable:4996)
#pragma warning(disable:4127) // conditional expression is constant
#ifdef _WINDOWS
-
-// MYLIBAPI is defined as __declspec(dllexport) in the
-// implementation file (dvipsone.c). Thus when this
-// header file is included by dvipsone.c, functions will
-// be exported instead of imported.
-
-#ifndef MYLIBAPI
-#define MYLIBAPI __declspec(dllimport)
-#endif
-
-//////////////////////////////////////////////////////////
-
-// MYLIBAPI int dvipsone(HWND, char *);
-
-// MYLIBAPI int dvipsone(HWND, char *, int (*) (const char *));
-MYLIBAPI int dvipsone(HWND, char *, int (*) (const char *, int));
-
-// 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
-
-// MYLIBAPI int reencodeflag;
-
-#endif
-
-#ifdef _WINDOWS
-#define PSBUFLEN 256
-extern unsigned int psbufpos;
-extern char psbuffer[PSBUFLEN];
-extern void sendpsbuffer(FILE *);
-extern void psputs(char *, FILE *);
-#endif
-
-#ifdef _WINDOWS
#define PSputs(str,output) psputs(str,output)
#else
#define PSputs(str,output) fputs(str,output)
#endif
// PSputc done as macro for speed
-
#ifdef _WINDOWS
// #define PSputc(chr,output) psputc(str, output);
#define PSputc(chr,output) \
} while(0)
#endif
-#ifdef _WINDOWS
-// 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 */
/* Introduce new convenient structure for color info 98/Jul/18 */
-typedef struct tagCOLORSPEC {
+typedef struct
+{
float A;
float B;
float C;
}
COLORSPEC;
-/* the following kills __far */
-#define __far
-/* and redefine far malloc, far realloc and far free in Win 32 */
-#define _ffree free
-#define _fmalloc malloc
-#define _frealloc realloc
-/* following are not standard C anyway */
-/* #define _strdup strdup */
-/* #define _searchenv searchenv */
-/* #define _access access */
-/* #define _alloca alloca */
-
/* #define FILENAME_MAX 128 */ /* 16 bit compiler stdio.h */
/* #define FILENAME_MAX 260 */ /* 32 bit compiler stdio.h */
/* DVI one byte commands: */
-enum dvicom {
-/* set_char_0 = 0, set_char_1, set_char_2, */
-set1 = 128, set2, set3, set4,
-set_rule = 132,
-put1 = 133, put2, put3, put4,
-put_rule = 137,
-nop = 138, bop, eop, push, pop,
-right1 = 143, right2, right3, right4,
-w0 = 147, w1, w2, w3, w4,
-x0 = 152, x1, x2, x3, x4,
-down1 = 157, down2, down3, down4,
-y0 = 161, y1, y2, y3, y4,
-z0 = 166, z1, z2, z3, z4,
-/* fnt_num_0 = 171, font_num_1, font_num_2, font_num_3, */
-fnt1 = 235, fnt2, fnt3, fnt4,
-xxx1 = 239, xxx2, xxx3, xxx4,
-fnt_def1 = 243, fnt_def2, fnt_def3, fnt_def4,
-pre = 247, post, post_post
+enum dvicom
+{
+ set1 = 128, set2, set3, set4,
+ set_rule = 132,
+ put1 = 133, put2, put3, put4,
+ put_rule = 137,
+ nop = 138, bop, eop, push, pop,
+ right1 = 143, right2, right3, right4,
+ w0 = 147, w1, w2, w3, w4,
+ x0 = 152, x1, x2, x3, x4,
+ down1 = 157, down2, down3, down4,
+ y0 = 161, y1, y2, y3, y4,
+ z0 = 166, z1, z2, z3, z4,
+ /* fnt_num_0 = 171, font_num_1, font_num_2, font_num_3, */
+ fnt1 = 235, fnt2, fnt3, fnt4,
+ xxx1 = 239, xxx2, xxx3, xxx4,
+ fnt_def1 = 243, fnt_def2, fnt_def3, fnt_def4,
+ pre = 247, post, post_post
};
/* srefl = 250, erefl = 251 used for `right-to-left' languages in TeX-XeT */
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 nMinRule; /* min rule thickness (Adobe Reader fix) 95/Oct/10 */
extern long previous; /* pointer to previous bop in this file */
extern int finish; /* when seen last eop */
extern char *comment; /* pointer to place for TeX comment */
-extern char *papersize; /* Custom paper size specified via special */
+extern char *paper_size; /* Custom paper size specified via special */
extern int nheaderlength; // 99/July/14
extern char *headerfile; /* name of user supplied header file(s) */
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 Adobe Reader */
+extern char *titlestring; /* title for DocInfo in Adobe Reader */
+extern char *subjectstring; /* Subject for DocInfo in Adobe Reader */
+extern char *authorstring; /* Author for DocInfo in Adobe Reader */
+extern char *basestring; /* Base for DocView in Adobe Reader */
+extern char *pagemode; /* Base for DocView in Adobe Reader */
extern int stinx; /* stack index */ /* just for verification */
extern int maxstinx; /* max stack index seen */