/* WARNING: following writes back into argument */
/* NOT ANYMORE IT DOESN'T - now caller needs to pick up fontsubto[k] */
-/* int fontremap (char *font) { */ /* expects lower case fontname */
-int fontremap (char *font) { /* expects lower case fontname */
+/* expects lower case fontname */
+int fontremap (char *font)
+{
int k;
// char oldname[MAXFONTNAME];
char oldname[FNAMELEN];
char newname[FNAMELEN];
if (font == NULL) return -1;
- if ((k = fontremapsub(font)) >= 0) {
+ if ((k = fontremapsub(font)) >= 0)
+ {
// strcpy(newname, fontsubto + k * MAXFONTNAME);
strcpy(newname, fontsubto[k]);
if (verboseflag && quietflag == 0 &&
// strcpy(font, newname); /* NO! */
}
return k; /* pointer to substitute */
-}
+}
/* need also copy across fontsubprop[k] to fontproper[.] ? */
/* not announce if its just a remap ? */
/* not announce if its just printer resident ? */
/* see whether this font is being forced to be substituted */
-
-int forcedsubstitute (char *font) { /* expects lower case fontname */
+/* expects lower case fontname */
+int forcedsubstitute (char *font)
+{
int k;
if (font == NULL) return -1;
- for (k = 0; k < ksubst; k++) {
+ for (k = 0; k < ksubst; k++)
+ {
if ((fontsubprop[k] & C_FORCESUB) != 0 &&
/* if (((fontsubprop[k] & C_FORCESUB) != 0 || */ /* NO */
/* (fontsubprop[k] & C_RESIDENT) != 0) && *//* 1992/July/4 */
}
/* is this font synthetic based on substitution table -- 1993/Nov/6 */
-
-int checksynthetic (char *font) { /* expects lower case fontname */
+/* expects lower case fontname */
+int checksynthetic (char *font)
+{
int k;
if (font == NULL) return -1;
}
/* see whether font name is being aliased based on font substitution table */
-
-void replacealias (void) { /* replace aliases with real names */
+/* replace aliases with real names */
+void replacealias (void)
+{
int k, n;
/* need to have these `near' for verboseflag output ... */
// char newname[MAXFONTNAME];
}
/* see whether font name is being aliased based on texfonts.map 95/Dec/29 */
-
-void replacetexfontsmap (void) { /* replace aliases with real names */
+/* replace aliases with real names */
+void replacetexfontsmap (void)
+{
int k;
/* int n; */
char *s;
/* returns 0 normally, -1 on EOF, +1 if start of new section (128) */
-int readaline (char *line, FILE *input) {
+int readaline (char *line, FILE *input)
+{
int c;
char *s=line;
/* Could we do this using the new ATMFonts table ??? 2000 July 7 */
-int FindMMBaseFile (int k) {
+int FindMMBaseFile (int k)
+{
/* char FontName[MAXTEXNAME]; */ /* 95/May/25 */
// char FontName[MAXFONTNAME]; /* 95/July/27 */
char FontName[FNAMELEN]; /* 99/Nov/6 */
/* Finds corresponding MM base font - or adds it if not found */
/* Adds characters needed by new instance */
-int AddMMBase (int m) { /* add the corresponding MM base 94/Dec/6 */
+/* add the corresponding MM base 94/Dec/6 */
+int AddMMBase (int m)
+{
int k, i;
char *basewantchrs; /* wanted chars array of MM base font */
char *instwantchrs; /* wanted chars array of MM instance */
if (subfontname[m] != NULL) strcpy(psfontname, subfontname[m]);
else *psfontname = '\0';
/* Truncate MM instance PS FontName if that is what we have 97/June/1 */
- if ((s = strchr(psfontname, '_')) != NULL && s > psfontname) {
+ if ((s = strchr(psfontname, '_')) != NULL && s > psfontname)
+ {
*s = '\0';
}
/* if (bMMShortCut == 0) {
}
#ifdef DEBUG
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, "Need to construct new MM base entry %s\n", psfontname);
showline(logline, 0);
}
/* if (bMMShortCut == 0) { */ /* copy PS FileName from instance, exists yet ??? */
/* strcpy(subfontname + fnext * MAXFONTNAME, subfontname + m * MAXFONTNAME); */
#ifdef DEBUG
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, "New base font with PS FontName %s\n", psfontname);
showline(logline, 0);
}
#endif
-// strcpy(subfontname + fnext * MAXFONTNAME, psfontname);
+// strcpy(subfontname + fnext * MAXFONTNAME, psfontname);
if (subfontname[fnext] != NULL) free(subfontname[fnext]);
subfontname[fnext] = zstrdup(psfontname);
/* hope this does not create problems with tests on subfontname ... */
}
fnext++;
mmcount++; /* how many MM base fonts */
- if (fnext >= maxfonts - 1) {
+ if (fnext >= maxfonts - 1)
+ {
/* fprintf(errout, "Too many MM base fonts (%d)\n", fnext - mmbase); */
sprintf(logline, " ERROR: Too many MM base fonts (%d)\n", mmcount);
showline(logline, 1);
/* Not used anymore ? */
#ifdef IGNORED
-void AddInBaseFonts(void) {
+void AddInBaseFonts(void)
+{
int k;
/* for (k = 0; k < mmbase; k++) { */
- for (k = 0; k < fnext; k++) {
+ for (k = 0; k < fnext; k++)
+ {
/* if (fontproper[k] & C_MULTIPLE) continue; */
if (fontproper[k] & C_INSTANCE) AddMMBase(k);
}
/* Could we do this using the new ATMFonts table ??? 2000 July 7 */
//int AddMMFontName (FILE *input, int k, int pssflag, char *FileName)
-int AddMMFontName (FILE *input, int k, int pssflag, char *FileName, int nlen) {
+int AddMMFontName (FILE *input, int k, int pssflag, char *FileName, int nlen)
+{
int c, m, flag;
char *s;
-// *(subfontname + k * MAXFONTNAME) = '\0';
+// *(subfontname + k * MAXFONTNAME) = '\0';
if (subfontname[k] != NULL) { /* reset in case not found */
free(subfontname[k]);
subfontname[k] = NULL;
}
-/* PSS file case first --- now outdated since ATM NT no longer */
+/* PSS file case first --- now outdated since ATM NT no longer */
if (pssflag) { /* read PSS file to extract MM base FontName */
if ((c = getc(input)) != 128) return -1; /* sanity test */
if ((c = getc(input)) != 1) return -1; /* sanity test */
while (readaline(line, input) == 0) {
/* printf("LINE: %s", line); */ /* debugging 95/May/25 */
if (*line == '%') continue; /* ignore comments */
- if ((s = strstr(line, "findfont")) != NULL) {
+ if ((s = strstr(line, "findfont")) != NULL)
+ {
s--;
while (*s <= ' ' && s >= line) *s-- = '\0';
if ((s = strrchr(line, '/')) == NULL) return -1;
/* we are assuming this happens *before* we start adding MM base fonts */
-void checksubstitute (void) {
+void checksubstitute (void)
+{
FILE *fp_in;
int k, j, i, n, baseexist, wipeflag;
// char fontnamek[MAXTEXNAME];
/* now pass in subfile as argument so we can read more than one 1994/Feb/4 */
/* FILE *OpenFontsub(void) { */
-FILE *OpenFontsub (char *subfile) {
+FILE *OpenFontsub (char *subfile)
+{
FILE *input;
if (strcmp(subfile, "") == 0) return NULL; /* 1994/Feb/4 */
return 0;
} */
-int charneeded (char *wantchrs) { /* see whether font actually used */
+/* see whether font actually used */
+int charneeded (char *wantchrs)
+{
int k;
if (wantchrs == NULL) return 0;
/* test in decreasing order of expected use */
/* read font substitution table */ /* returns non-zero if success */
-int GetSubstitutes (void) { /* return value not used ? */
+/* return value not used ? */
+int GetSubstitutes (void)
+{
FILE *input;
char nextfontsub[FNAMELEN]; /* need for multi sub files */
int k, flag=0; /* 1994/Feb/5 */
/* input = OpenFontsub(fontsubrest); */
strcpy(nextfontsub, s);
/* if ((input = OpenFontsub(s)) != NULL) { */
- if ((input = OpenFontsub(nextfontsub)) != NULL) {
+ if ((input = OpenFontsub(nextfontsub)) != NULL)
+ {
/* if (traceflag)
printf("Reading %s\n", nextfontsub); */ /* debugging */
readsubstitutes(input); /* read font substitution file */
/* if (traceflag) showsubtable(stdout); */ /* an experiment */
/* return -1; */ /* OK, specified file worked */
}
- else {
+ else
+ {
sl = removepath(fontsubfile);
/* fprintf(errout, "WARNING: Can't find font subst file: "); */
sprintf(logline, " WARNING: Can't find %s subst file %s\n",
/* if (strcmp(fontsubrest, "standard") != 0) { */ /* 1994/Feb/10 */
/* strcpy(fontsubrest, "standard"); */
/* if((input = OpenFontsub()) != NULL) { */
- if((input = OpenFontsub("standard")) != NULL) {
- readsubstitutes(input);
+ if((input = OpenFontsub("standard")) != NULL)
+ {
+ readsubstitutes(input);
fclose(input); /* 1994/Feb/4 */
/* if (traceflag) showsubtable(stdout); */ /* an experiment */
/* return -1; */ /* OK, standard file worked */
flag++;
}
- else {
+ else
+ {
sl = removepath(fontsubfile);
/* substitute = 0; */ /* NO: still have built in table ? */
sprintf(logline, " WARNING: Can't find %s subst file %s\n",
/* return 0; */ /* No success ! */
}
/* if (traceflag) showsubtable(stdout); */ /* an experiment */
- if (showsubflag) {
+ if (showsubflag)
+ {
showsubtable(); /* an experiment */
-// if (logfileflag) showsubtable(logfile);
+// if (logfileflag) showsubtable(logfile);
}
return flag; /* non zero if some substitution table has been read */
}
-int markunusedfonts0 (void) { /* separated out 94/Oct/5 */
+/* separated out 94/Oct/5 */
+int markunusedfonts0 (void)
+{
int k, unused=0;
/* fontproper[k] &= ~C_UNUSED; */
- for (k = 0; k < fnext; k++) {
+ for (k = 0; k < fnext; k++)
+ {
/* if (charneeded(fontchar[k]) == 0) */
// if (fontproper[k] | C_MULTIPLE) continue; /* for now 94/Dec/6 ??? */
if (fontproper[k] & C_MULTIPLE) continue; /* fixed 2000 July 4 */
fontproper[k] |= C_UNUSED;
unused++;
}
- }
+ }
return unused;
}
/* following called from dvipsone.c before calling extract itself */
/* task = "checking for duplicate & substitutions"; */
-void preextract (void) { /* get font tables straightened out first */
+/* get font tables straightened out first */
+void preextract (void)
+{
int k;
/* FILE *input; */
// char fontnamek[MAXTEXNAME];
/* Deal with situtation where all fonts considered resident */
/* moved down here 1992/July/4 */ /* do this LAST */
- if (forcereside != 0) {
- for (k = 0; k < fnext; k++) {
+ if (forcereside != 0)
+ {
+ for (k = 0; k < fnext; k++)
+ {
/* debugging output 95/Sep/16 */
/* if (fontsubflag[k] < 0) { */ /* 1992/July/4 */
/* Don't mark fonts substituted for as resident */
if (subfontname[k] != NULL) strcpy(subfontnamek, subfontname[k]);
else *subfontnamek = '\0';
#ifdef DEBUG
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, "%d %s %s %d\n", k, fontnamek, subfontnamek,
fontproper[k]); /* debugging */
showline(logline, 0);
/* following contains kludgy test to avoid repeating vector */
-void constructvectors(FILE *fp_out) {
+void constructvectors(FILE *fp_out)
+{
int k, i, flag;
/* maybe nothing to do here if just need ansinew due to `-X' flag */
/* we should already have the ansinew vector dumped out */
writedvistart(fp_out); /* 93/Sep/30 */
- for (k=0; k < fnext; k++) {
+ for (k=0; k < fnext; k++)
+ {
if ((fontproper[k] & C_REMAPIT) != 0 &&
- (fontproper[k] & C_RESIDENT) != 0) {
+ (fontproper[k] & C_RESIDENT) != 0)
+ {
flag = 0;
- for (i = 0; i < k; i ++) {
+ for (i = 0; i < k; i ++)
+ {
if ((fontproper[i] & C_REMAPIT) != 0 &&
- (fontproper[i] & C_RESIDENT) != 0 &&
-// strcmp(fontvector + i * MAXVECNAME, fontvector + k * MAXVECNAME) == 0)
- fontvector[i] != NULL && fontvector[k] != NULL &&
- strcmp(fontvector[i], fontvector[k]) == 0) {
- flag = 1; break;
- }
+ (fontproper[i] & C_RESIDENT) != 0 &&
+/* strcmp(fontvector + i * MAXVECNAME, fontvector + k * MAXVECNAME) == 0) */
+ fontvector[i] != NULL &&
+ fontvector[k] != NULL &&
+ strcmp(fontvector[i], fontvector[k]) == 0)
+ {
+ flag = 1; break;
+ }
}
if (flag == 0) {
// readencoding(fontvector + k * MAXVECNAME);
/* Check whether font itself, or its base font are resident */
-int fontreside (int f) { /* 1995/July/5 */
+int fontreside (int f) /* 1995/July/5 */
+{
int k;
if ((fontproper[f] & C_RESIDENT) != 0) return 1;
if ((fontproper[f] & C_DEPENDENT) != 0) {
/* fn is the internal font number if bShortFont == 0 || bUseInternal != 0 */
/* fn is the short font number if bShortFont != 0 && bUseInternal == 0 */
-void dofont (FILE *fp_out, int f, int fn) {
+void dofont (FILE *fp_out, int f, int fn)
+{
// char fname[MAXFONTNAME];
char fname[FNAMELEN];
int n;
if (f < 0 || f >= maxfonts) { /* 93/May/23 */
sprintf(logline, "Bad font index %d\n", f); /* debugging */
showline(logline, 1);
-/* should we skip it in this case to avoid access errors ? */
+/* should we skip it in this case to avoid access errors ? */
}
property = fontproper[f]; /* 97/June/1 */
/* if (traceflag)
- printf("font %d fontname %s subfontname %s fontsubflag %d\n",
+ printf("font %d fontname %s subfontname %s fontsubflag %d\n",
f, fontname[f], subfontname[f], fontsubflag[f]); */
// strcpy(fname, fontname + f * MAXTEXNAME);
if (fontname[f] != NULL) strcpy(fname, fontname[f]);
/* Replace PostScript FontName in PSS stub with new one */
-int replacename (char *line, char *fname) {
+int replacename (char *line, char *fname)
+{
char *s, *t;
char buffer[FNAMELEN];
/* int copyPSS_sub(FILE *output, FILE *input, char *fname, char *encode) { */
/* int copyPSS_sub(FILE *output, FILE *input, char *fname, char *bname, char *encode) { */
-int copyPSS_sub(FILE *output, FILE *input, char *fname, char *bname,
- char *encode, int proper) {
+int copyPSS_sub(FILE *output, FILE *input, char *fname, char *bname, char *encode, int proper)
+{
/* int c; */
char *s;
// char basename[MAXTEXNAME]; /* char basename[16]; */
if (readaline(line, input) != 0) return -1;
}
/* while ((s = strchr(line, '/')) == NULL) { */
- while ((s = strstr(line, "findfont")) == NULL) {
+ while ((s = strstr(line, "findfont")) == NULL) {
// fputs(line, output);
PSputs(line, output);
- if (readaline(line, input) != 0) return -1;
+ if (readaline(line, input) != 0) return -1;
}
if ((s = strchr(line, '/')) == NULL) return -1;
/* replace PostScript Multiple Master *Instance* FontName */
/* Construct MM base font file name from stub PSS file name */
if (bMMShortCut) { /* disallow this ? */
strcpy(basename, fname);
- strcpy(basename+5, "___");
+ strcpy(basename+5, "___");
/* MM base font has same name, but ends in ___ simple minded ? */
}
else strcpy(basename, bname);
/* work in progress: deal with PSS stub for Multiple Master */
-int copyPSS(FILE *fp_out, FILE *fp_in, int k) {
+int copyPSS(FILE *fp_out, FILE *fp_in, int k)
+{
int flag, m;
int proper=0;
char *s;
return flag;
}
-int IsItUsed (char *wantchrs) {
+int IsItUsed (char *wantchrs)
+{
int k;
if (wantchrs == NULL) return 0;
/* test in decreasing order of expected use */
/* See if can mark unused fonts (in jobs with less than full page range) */
-int MarkUnusedFonts (void) { /* an experiment 95/Mar/5 */
+int MarkUnusedFonts (void) /* an experiment 95/Mar/5 */
+{
int fn, flag=0;
/* int k, count, property; */
// char fontnamek[MAXTEXNAME];
/* following split off 95/May/13 to improve readability ... */
-int extractafont (FILE *fp_out, int k) {
+int extractafont (FILE *fp_out, int k)
+{
FILE *fp_in;
int flag=0;
int proper; /* 1992/Aug/23 */
/* once it has been verified this works correctly, strip out IGNORE part */
/* present order is: MM base fonts, PSS stub files, other fonts ... */
-int extractfonts (FILE *fp_out) { /* was called by main */
+int extractfonts (FILE *fp_out) /* was called by main */
+{
int k;
int proper; /* 1992/Aug/23 */
/* int oldsuppress; */
/* extract PSS stub files next */
- for (k = 0; k < fnext; k++) {
+ for (k = 0; k < fnext; k++)
+ {
proper = fontproper[k];
if ((proper & C_INSTANCE) == 0) continue;
if (extractafont(fp_out, k) != 0) nfonts++; /* do we count these ? */
/* separated out from the above 94/Mar/3 ************************** */
-void fontsetup (FILE *fp_out) {
+void fontsetup (FILE *fp_out)
+{
int k, i, ne, f;
/* int n; */
int count, flag;
/* fputs("%%EndSetup\n", fp_out); */ /* ??? */
}
-/* Following called from dvispeci.c
+/* Following called from dvispeci.c */
/* Don't expand %%IncludeFont for printer resident fonts */
/* Use a fixed list ??? */
/* tir, tii, tib, tibi, hv, hvo, hvb, hvbo, com, coo, cob, cobo, sy, zd */
-int ResidentFont (char *FileName) { /* 1994/Feb/10 */
+int ResidentFont (char *FileName) /* 1994/Feb/10 */
+{
char *s, *t;
int k;
#ifdef DEBUG
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, "ResidentFont %s?\n", FileName); /* debugging 97/June/5 */
showline(logline, 0);
}
else s = FileName; */
s = removepath(FileName); /* 95/May/28 */
/* get rid of extension */
- if ((t = strrchr(s, '.')) != NULL) *t ='\0';
+ if ((t = strrchr(s, '.')) != NULL) *t ='\0';
t = s + strlen(s) - 1;
while (*t == '_') *t-- = '\0'; /* strip underscores */
#ifdef DEBUG
/* now for the scan of the DVI file for PS output generation */
-void reset_stack(void) {
+void reset_stack(void)
+{
stinx = 0;
}
-void check_stack(int pageno) {
- if (stinx != 0) {
- sprintf(logline,
- " ERROR: stack not empty at EOP: %d on page %d ",
- stinx, pageno); /* pageno ? logical page */
+void check_stack(int pageno)
+{
+ if (stinx != 0)
+ {
+ sprintf(logline, " ERROR: stack not empty at EOP: %d on page %d ", stinx, pageno); /* pageno ? logical page */
showline(logline, 1);
tellwhere(input, 1);
/* errcount(0); */
return getc(infile);
} */
-static unsigned int ureadtwo (FILE *infile) {
- return (getc(infile) << 8) | getc(infile);
+static unsigned int ureadtwo (FILE *infile)
+{
+ return (getc(infile) << 8) | getc(infile);
}
-static unsigned long ureadthree (FILE *infile) {
+static unsigned long ureadthree (FILE *infile)
+{
int c, d, e;
/* unsigned int c, d, e; */
c = getc(infile); d = getc(infile); e = getc(infile);
return ((((unsigned long) c << 8) | d) << 8) | e;
}
-static unsigned long ureadfour (FILE *infile) {
+static unsigned long ureadfour (FILE *infile)
+{
int c, d, e, f;
c = getc(infile); d = getc(infile);
e = getc(infile); f = getc(infile);
#ifdef IGNORED
/* static short int sreadtwo (FILE *infile) { */ /* ??? */
-static 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); */
/* avoid possible compiler optimization error */
-static int sreadtwo (FILE *input) { /* experiment 98/Feb/7 */
+static int sreadtwo (FILE *input) /* experiment 98/Feb/7 */
+{
int c, d;
c = getc(input); d = getc(input);
- if (c > 127) c = c - 256;
+ if (c > 127) c = c - 256;
return (c << 8) | d;
}
return ((((long) c << 8) | d) << 8) | e;
} */
-static long sreadfour (FILE *infile) {
+static long sreadfour (FILE *infile)
+{
int c, d, e, f;
c = getc(infile); d = getc(infile);
e = getc(infile); f = getc(infile);
/* restore at start of page what was current at end of page-1 */
/* called from dvianal.c */ /* page is physical DVI page from start of file */
-void RestoreColorStack (int page) {
+void RestoreColorStack (int page)
+{
COLORSPEC *SavedStack;
int k;
/* don't bother if color \special{...} was never used */
if (ColorStacks == NULL) return; /* sanity check */
/* GrabColor(); */
SavedStack = ColorStacks[page];
- if (SavedStack == NULL) {
+ if (SavedStack == NULL)
+ {
sprintf(logline, " Bad Color Restore page %d (%d)",
page, MaxColor-1);
showline(logline, 1);
}
colorindex = (int) (SavedStack[0].D + 0.5); /* depth of saved stack */
#ifdef DEBUGCOLORSTACK
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, " RestoreColorStack from page-1 %d colorindex %d\n",
page, colorindex);
showline(logline, 0);
/* Save at end of page for start of page+1 */
/* called from logdo_eop dvipslog.c */ /* page is DVI page from start of file */
-void SaveColorStack (int page, int colorindex) {
+void SaveColorStack (int page, int colorindex)
+{
COLORSPEC *SavedStack;
int k;
/* if (bCarryColor == 0 || bColorUsed == 0) return; */
/* free(lpColor[page]); */
}
#ifdef DEBUGCOLORSTACK
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, " SaveColorStack page %d colorindex %d\n",
page, colorindex);
showline(logline, 0);
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-void logdo_push(void) {
+void logdo_push(void)
+{
if (skipflag == 0) {
stinx++;
if (stinx > maxstinx) maxstinx = stinx;
}
}
-void logdo_pop(void) {
- if (skipflag == 0) {
+void logdo_pop(void)
+{
+ if (skipflag == 0)
+ {
stinx--;
- if (stinx < 0) {
+ if (stinx < 0)
+ {
sprintf(logline,
" ERROR: The stack will underflow on page %d ",
pageno); /* pagenumber ??? logical page */
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-void invalidset(int c) {
+void invalidset(int c)
+{
sprintf(logline, " ERROR: Setting char %d without font on page %d ",
c, pageno); /* pagenumber ??? logical page */
showline(logline, 1);
/* common subroutine for set2 set3 set4 --- which should not occur */
-void logdo_setsub(unsigned long c) {
+void logdo_setsub(unsigned long c)
+{
if (skipflag == 0) {
/* if (ff < 0) invalidset((int) c); */
if (ff == BLANKFONT) invalidset((int) c);
/* For speed we keep the set1 case separate since it occurs often */
-void logdo_set1(FILE *infile) {
+void logdo_set1(FILE *infile)
+{
unsigned int c;
/* c = ureadone(infile); */
c = getc(infile);
/* simplified 95/Oct/17 by using logo_setsub for logdo_set2 */
-void logdo_set2(FILE *infile) {
+void logdo_set2(FILE *infile)
+{
logdo_setsub(ureadtwo(infile));
}
#ifdef IGNORED
-void logdo_set2(FILE *infile) {
+void logdo_set2(FILE *infile)
+{
unsigned int c;
c = ureadtwo(infile);
if (skipflag == 0) {
}
#endif
-void logdo_set3(FILE *infile) {
+void logdo_set3(FILE *infile)
+{
logdo_setsub(ureadthree(infile));
}
-void logdo_set4(FILE *infile) {
+void logdo_set4(FILE *infile)
+{
logdo_setsub(ureadfour(infile));
}
/* common subroutine for put2, put3, pu4 --- which should not occur */
-void logdo_putsub(unsigned long c) {
- if (skipflag == 0) {
+void logdo_putsub(unsigned long c)
+{
+ if (skipflag == 0)
+ {
/* if (ff < 0) invalidset((int) c); */
if (ff == BLANKFONT) invalidset((int) c);
else if (c < 256) {
/* For speed we keep the set1 case separate since it occurs sometimes */
-void logdo_put1(FILE *infile) {
+void logdo_put1(FILE *infile)
+{
unsigned int c;
/* c = ureadone(infile); */
c = getc(infile);
/* simplified 95/Oct/17 by using logo_putsub for logdo_put2 */
-void logdo_put2(FILE *infile) {
+void logdo_put2(FILE *infile)
+{
logdo_putsub(ureadtwo(infile));
}
#ifdef IGNORED
-void logdo_put2(FILE *infile) {
+void logdo_put2(FILE *infile)
+{
unsigned int c;
c = ureadtwo(infile);
if (skipflag == 0) {
}
#endif
-void logdo_put3(FILE *infile) {
+void logdo_put3(FILE *infile)
+{
logdo_putsub(ureadthree(infile));
}
-void logdo_put4(FILE *infile) {
+void logdo_put4(FILE *infile)
+{
logdo_putsub(ureadfour(infile));
}
-void logdo_set_rule(FILE *infile) {
+void logdo_set_rule(FILE *infile)
+{
int k;
for (k=0; k < 8; k++) (void) getc(infile);
}
-void logdo_put_rule(FILE *infile) {
+void logdo_put_rule(FILE *infile)
+{
int k;
for (k=0; k < 8; k++) (void) getc(infile);
}
/* returns zero if page is to be printed */ /* non-zero if to be skipped */
-int skipthispage(long pageno) {
+int skipthispage(long pageno)
+{
int k;
/* int hitrange=0; */
/* int wantpage=0; */
return 1; /* not inside any specified range */
}
-void logdo_bop(FILE *infile) { /* beginning of page */
+void logdo_bop(FILE *infile) /* beginning of page */
+{
int k;
long current; /* ??? */
skipflag = 0;
}
-void logdo_right1(FILE *infile) { /* rare */
+void logdo_right1(FILE *infile) /* rare */
+{
(void) getc(infile);
}
-void logdo_right2(FILE *infile) {
+void logdo_right2(FILE *infile)
+{
(void) getc(infile); (void) getc(infile);
}
-void logdo_right3(FILE *infile) {
+void logdo_right3(FILE *infile)
+{
(void) getc(infile); (void) getc(infile); (void) getc(infile);
}
-void logdo_right4(FILE *infile) {
- (void) getc(infile); (void) getc(infile);
+void logdo_right4(FILE *infile)
+{
+ (void) getc(infile); (void) getc(infile);
(void) getc(infile); (void) getc(infile);
}
-void logdo_w0(void) {
+void logdo_w0(void)
+{
}
-void logdo_w1(FILE *infile) { /* rare */
- (void) getc(infile);
+void logdo_w1(FILE *infile) /* rare */
+{
+ (void) getc(infile);
}
-void logdo_w2(FILE *infile) {
+void logdo_w2(FILE *infile)
+{
(void) getc(infile); (void) getc(infile);
}
-void logdo_w3(FILE *infile) {
+void logdo_w3(FILE *infile)
+{
(void) getc(infile); (void) getc(infile); (void) getc(infile);
}
-void logdo_w4(FILE *infile) {
- (void) getc(infile); (void) getc(infile);
+void logdo_w4(FILE *infile)
+{
(void) getc(infile); (void) getc(infile);
-}
+ (void) getc(infile); (void) getc(infile);
+}
-void logdo_x0(void) {
+void logdo_x0(void)
+{
}
-void logdo_x1(FILE *infile) { /* rare */
+void logdo_x1(FILE *infile) /* rare */
+{
(void) getc(infile);
}
-void logdo_x2(FILE *infile) {
+void logdo_x2(FILE *infile)
+{
(void) getc(infile); (void) getc(infile);
}
-void logdo_x3(FILE *infile) {
+void logdo_x3(FILE *infile)
+{
(void) getc(infile); (void) getc(infile); (void) getc(infile);
}
-void logdo_x4(FILE *infile) {
- (void) getc(infile); (void) getc(infile);
+void logdo_x4(FILE *infile)
+{
+ (void) getc(infile); (void) getc(infile);
(void) getc(infile); (void) getc(infile);
}
-void logdo_down1(FILE *infile) { /* rare */
+void logdo_down1(FILE *infile) /* rare */
+{
(void) getc(infile);
}
-void logdo_down2(FILE *infile) { /* rare */
+void logdo_down2(FILE *infile) /* rare */
+{
(void) getc(infile); (void) getc(infile);
-}
+}
-void logdo_down3(FILE *infile) {
+void logdo_down3(FILE *infile)
+{
(void) getc(infile); (void) getc(infile); (void) getc(infile);
}
-void logdo_down4(FILE *infile) {
- (void) getc(infile); (void) getc(infile);
+void logdo_down4(FILE *infile)
+{
(void) getc(infile); (void) getc(infile);
-}
+ (void) getc(infile); (void) getc(infile);
+}
-void logdo_y0(void) {
+void logdo_y0(void)
+{
}
-void logdo_y1(FILE *infile) { /* rare */
+void logdo_y1(FILE *infile) /* rare */
+{
(void) getc(infile);
}
-void logdo_y2(FILE *infile) {
+void logdo_y2(FILE *infile)
+{
(void) getc(infile); (void) getc(infile);
-}
+}
-void logdo_y3(FILE *infile) {
+void logdo_y3(FILE *infile)
+{
(void) getc(infile); (void) getc(infile); (void) getc(infile);
}
-void logdo_y4(FILE *infile) { /* not used */
- (void) getc(infile); (void) getc(infile);
+void logdo_y4(FILE *infile) /* not used */
+{
(void) getc(infile); (void) getc(infile);
-}
+ (void) getc(infile); (void) getc(infile);
+}
-void logdo_z0(void) {
+void logdo_z0(void)
+{
}
-void logdo_z1(FILE *infile) { /* rare */
+void logdo_z1(FILE *infile) /* rare */
+{
(void) getc(infile);
}
-void logdo_z2(FILE *infile) {
+void logdo_z2(FILE *infile)
+{
(void) getc(infile); (void) getc(infile);
}
-void logdo_z3(FILE *infile) {
+void logdo_z3(FILE *infile)
+{
(void) getc(infile); (void) getc(infile); (void) getc(infile);
}
-void logdo_z4(FILE *infile) {
- (void) getc(infile); (void) getc(infile);
+void logdo_z4(FILE *infile)
+{
(void) getc(infile); (void) getc(infile);
-}
+ (void) getc(infile); (void) getc(infile);
+}
-void logswitchfont(int fn, FILE *infile) { /* switching to other font */
+void logswitchfont(int fn, FILE *infile) /* switching to other font */
+{
int c;
ff = fn; /* set state */
fnt = finx[fn];
if (fn == 52) {
c = getc(infile); (void) ungetc(c, infile);
if (c == 171 + 52) {
- sprintf(logline,
- " ERROR: Unexpected encounter of DVI trailer on page %d ", pagenumber);
+ sprintf(logline, " ERROR: Unexpected encounter of DVI trailer on page %d ", pagenumber);
showline(logline, 1);
/* errcount(0); */
/* finish = -1; */
fonthit[fnt] = 1; /* even if skipflag != 0 ? */
}
-void logdo_fnt1(FILE *infile) { /* switch fonts */
+void logdo_fnt1(FILE *infile) /* switch fonts */
+{
int fn;
/* fn = ureadone(infile); */
fn = getc(infile);
logswitchfont(fn, infile);
}
-void logdo_fnt2(FILE *infile) { /* switch fonts */
+void logdo_fnt2(FILE *infile) /* switch fonts */
+{
unsigned int fn;
fn = ureadtwo(infile);
/* if (skipflag == 0) */
logswitchfont((int) fn, infile);
}
-void logdo_fntsub(unsigned long fn, FILE *infile) { /* switch fonts */
+void logdo_fntsub(unsigned long fn, FILE *infile) /* switch fonts */
+{
/* if (skipflag == 0) */
if (fn >= MAXFONTNUMBERS) fn = MAXFONTNUMBERS-1;
logswitchfont((int) fn, infile);
}
-void logdo_fnt3(FILE *infile) { /* switch fonts */
+void logdo_fnt3(FILE *infile) /* switch fonts */
+{
/* unsigned long fn;
fn = ureadthree(infile); */
logdo_fntsub(ureadthree(infile), infile);
}
-void logdo_fnt4(FILE *infile) { /* switch fonts */
+void logdo_fnt4(FILE *infile) /* switch fonts */
+{
long fn;
fn = sreadfour(infile);
/* if (skipflag == 0) */
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-void getheadername (FILE *infile) { /* new version 95/Aug/30 */
+void getheadername (FILE *infile) /* new version 95/Aug/30 */
+{
char fname[FNAMELEN]; /* buffer to get token into */
char *s;
/* get name of file with DSC header comments */ /* only one allowed */
-void getcustomname (FILE *infile) {
+void getcustomname (FILE *infile)
+{
/* int n=0; */
if (dscfile != NULL) {
/* accumulate verbatim PS header text for prolog */
- void getheadertext (FILE *infile) { /* new 1993/Dec/29 */
+void getheadertext (FILE *infile) /* new 1993/Dec/29 */
+{
char *headernew;
char *u;
int n;
/* errcount(0); */
/* return; */
checkexit(1); /* 1995/July/15 */
-// more serious exit(1) ???
+// more serious exit(1) ???
}
headertext = headernew;
u = headernew + headertextlen;
/* accumulate command line args for DVIPSONE - passed through DVI file */
-void getcommandspec (FILE *infile) { // 99/Sept/6
+void getcommandspec (FILE *infile) // 99/Sept/6
+{
char *commandnew;
char *u;
int n;
/* accumulate verbatim PS header text for prolog */
-void getcustomtext (FILE *infile) { /* new 1995/July/15 */
+void getcustomtext (FILE *infile) /* new 1995/July/15 */
+{
int c, n, needpercent=0;
char *customnew;
char *u;
*u++ = '\n'; *u++ = '\0'; /* terminating linefeed and \0 */
}
-void getbbox (FILE *infile) { /* Use for CropBox pdfmark not tested */
+void getbbox (FILE *infile) /* Use for CropBox pdfmark not tested */
+{
/* Right now this is in PS coordinates, should be in TeX coordinates */
if (gettoken(infile, line, sizeof(line)) != 0) { /* MAXLINE */
sscanf(line, "%d", &BBxll);
/* accumulate Keywords for DOCINFO pdfmark */
-void getkeywords (FILE *infile) { /* 1996/May/10 */
+void getkeywords (FILE *infile) /* 1996/May/10 */
+{
char *keywordsnew;
char *u;
int n, c;
}
// void getcommonstring (FILE *infile, char *newstring)
-char *getcommonstring (FILE *infile) {
+char *getcommonstring (FILE *infile)
+{
char *u;
char *newstring = malloc ((size_t) (nspecial+1));
if (newstring == NULL) {
// unadvertized ability to change Creator fieldin DocInfo
-void getcreator (FILE *infile) {
+void getcreator (FILE *infile)
+{
if (creatorstring != NULL) return; /* ignore all but first */
// creatorstring = malloc ((size_t) (nspecial+1));
// getcommonstring(infile, creatorstring);
creatorstring = getcommonstring(infile);
}
-void gettitle (FILE *infile) {
+void gettitle (FILE *infile)
+{
if (titlestring != NULL) return; /* ignore all but first */
// titlestring = malloc ((size_t) (nspecial+1));
// getcommonstring(infile, titlestring);
titlestring = getcommonstring(infile);
}
-void getsubject (FILE *infile) {
+void getsubject (FILE *infile)
+{
if (subjectstring != NULL) return; /* ignore all but first */
// subjectstring = malloc ((size_t) (nspecial+1));
// getcommonstring(infile, subjectstring);
subjectstring = getcommonstring(infile);
}
-void getauthor (FILE *infile) {
+void getauthor (FILE *infile)
+{
if (authorstring != NULL) return; /* ignore all but first */
// authorstring = malloc ((size_t) (nspecial+1));
// getcommonstring(infile, authorstring);
authorstring = getcommonstring(infile);
}
-void getbase (FILE *infile) {
+void getbase (FILE *infile)
+{
if (basestring != NULL) return; /* ignore all but first */
// basestring = malloc ((size_t) (nspecial+1));
// getcommonstring(infile, basestring);
basestring = getcommonstring(infile);
}
-void getpagemode (FILE *infile) {
+void getpagemode (FILE *infile)
+{
if (pagemode != NULL) return; /* ignore all but first */
// pagemode = malloc ((size_t) (nspecial+1));
// getcommonstring(infile, pagemode);
/* example \special{papersize=5.04in,3.751in} */
-void getpapersize (FILE *infile) {
+void getpapersize (FILE *infile)
+{
// if (strcmp(papersize,"") != 0) return; /* ignore all but first */
if (papersize != NULL) return;
// papersize = malloc ((size_t) (nspecial+1));
/* Attempt at \special{background rgb 0 0 1} support 98 June 30 */
-void DoBackGround (FILE *infile, int c) {
+void DoBackGround (FILE *infile, int c)
+{
char *s;
int n, m;
int setcolor=0;
COLORSPEC SavedColor;
- if (bBackGroundFlag == 0) {
+ if (bBackGroundFlag == 0)
+ {
flushspecial(infile);
return;
}
*s = '\0'; /* just in case */
(void) scanspecial(input, line, MAXLINE);
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, "\n%s %c (%d) ", line, c, c);
showline(logline, 0);
}
if (bKeepBlack) return; /* 96/Nov/3 */
SavedColor = CurrColor; /* 99/Apr/06 */
- if (strncmp(s, "rgb", 3) == 0) {
+ if (strncmp(s, "rgb", 3) == 0)
+ {
s += 3;
m = sscanf(s, "%g %g %g%n\n", &CurrColor.A, &CurrColor.B, &CurrColor.C, &n);
- if (m == 3) {
+ if (m == 3)
+ {
CurrColor.D = -1.0F;
setcolor=1;
s += n;
}
- else {
+ else
+ {
complainspecial(input);
return;
}
return;
}
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, " PAGENUMBER %d (%d %d) ", pagenumber, dvi_t, MaxColor);
showline(logline, 0);
}
return;
}
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, "\npage %d %g %g %g %g\n",
pagenumber, CurrColor.A, CurrColor.B, CurrColor.C,
CurrColor.D);
/* also check for \special{color ...} */
/* also check for \special{background ...} 98/Jun/30 */
-void logdo_com (FILE *infile) {
+void logdo_com (FILE *infile)
+{
int c;
/* int k=0; */
- if (bIgnoreSpecials) {
+ if (bIgnoreSpecials)
+ {
flushspecial(infile);
return;
}
flushspecial(infile);
}
-void logdo_xxxi(FILE *infile, unsigned int n) {
+void logdo_xxxi(FILE *infile, unsigned int n)
+{
/* unsigned int k; */
nspecial = (long) n;
logdo_com(infile);
/* for(k = 0; k < n; k++) getc(infile); */
}
-void logdo_xxx1(FILE *infile) { /* for /special */
+void logdo_xxx1(FILE *infile) /* for /special */
+{
unsigned int k;
k = getc(infile);
logdo_xxxi(infile, k);
}
-void logdo_xxx2(FILE *infile) { /* for /special */
- unsigned int k;
+void logdo_xxx2(FILE *infile) /* for /special */
+{
+ unsigned int k;
k = ureadtwo(infile);
logdo_xxxi(infile, k);
}
-void logdo_xxxl(FILE *infile, unsigned long n) {
+void logdo_xxxl(FILE *infile, unsigned long n)
+{
/* unsigned long k; */
nspecial=(long) n;
logdo_com(infile);
/* for(k = 0; k < n; k++) getc(infile); */
}
-void logdo_xxx3(FILE *infile) {
+void logdo_xxx3(FILE *infile)
+{
logdo_xxxl(infile, ureadthree(infile));
}
-void logdo_xxx4(FILE *infile) {
+void logdo_xxx4(FILE *infile)
+{
logdo_xxxl(infile, ureadfour(infile));
}
/* need to do this even if skipping pages */
-void logfnt_def(FILE *infile, unsigned int k) {
+void logfnt_def(FILE *infile, unsigned int k)
+{
int fn;
unsigned int na, nl, i;
int newfont=1; /* if this is a new one (not defined before) */
memset(fontchar[fn], 0, MAXCHRS);
}
-void logdo_fnt_def1(FILE *infile) { /* define font */
+void logdo_fnt_def1(FILE *infile) /* define font */
+{
unsigned int k;
/* k = ureadone(infile); */
k = getc(infile);
logfnt_def(infile, k);
}
-void logdo_fnt_def2(FILE *infile) { /* define font */
+void logdo_fnt_def2(FILE *infile) /* define font */
+{
unsigned int k;
k = ureadtwo(infile);
if (k >= MAXFONTNUMBERS) k = MAXFONTNUMBERS-1;
logfnt_def(infile, k);
}
-void logdo_fnt_defsub(FILE *infile, unsigned long k) {
+void logdo_fnt_defsub(FILE *infile, unsigned long k)
+{
if (k >= MAXFONTNUMBERS) k = MAXFONTNUMBERS-1;
logfnt_def(infile, (unsigned int) k);
}
-void logdo_fnt_def3(FILE *infile) { /* define font */
+void logdo_fnt_def3(FILE *infile) /* define font */
+{
/* unsigned long k;
k = ureadthree(infile); */
logdo_fnt_defsub(infile, ureadthree(infile));
}
-void logdo_fnt_def4(FILE *infile) { /* define font */
+void logdo_fnt_def4(FILE *infile) /* define font */
+{
long k;
k = sreadfour(infile);
if (k < 0) k = 0;
/* need to do this even if skipping pages */
-void logdo_pre(FILE *infile) {
+void logdo_pre(FILE *infile)
+{
unsigned int i, k, j;
int c;
char *s;
/* i = ureadone(infile); */
i = getc(infile);
- if (i < 1 || i > 3) {
+ if (i < 1 || i > 3)
+ {
showline("Not a valid DVI file ", 1);
giveup(3);
return;
}
- else if (i != ID_BYTE) {
+ else if (i != ID_BYTE)
+ {
sprintf(logline, "File is DVI version %d - *not* %d\n",
i, ID_BYTE);
showline(logline, 1);
comment = NULL;
}
comment = malloc(k+1);
- if (comment == NULL) {
+ if (comment == NULL)
+ {
showline(" Unable to allocate memory\n", 1);
checkexit(1);
// more serious exit(1) ???
}
- s = comment;
+ s = comment;
/* if (traceflag) fprintf(stdout, "Comment:"); */
c = getc(infile); /* try and discard initial space */
- if (c == ' ') k--;
+ if (c == ' ') k--;
else (void) ungetc(c, infile);
- for (j=0; j < k; j++) {
- c = getc(infile);
+ for (j=0; j < k; j++)
+ {
+ c = getc(infile);
if (j < MAXCOMMENT) *s++ = (char) c;
/* if (verboseflag) putc(c, stdout); */
}
/* need to do this even if skipping pages */
-void logdo_post(FILE *infile) {
+void logdo_post(FILE *infile)
+{
/* int k; */
previous = sreadfour(infile); /* was ureadfour ... */
num = ureadfour(infile);
den = ureadfour(infile);
mag = ureadfour(infile);
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, " POST: previous %ld num %ld den %ld mag %ld\n",
previous, num, den, mag);
showline(logline, 0);
/* could do this even in forward mode to check on number of pages ? */
-void logdo_post_post(FILE *infile) { /* only in reverse ? */
+void logdo_post_post(FILE *infile) /* only in reverse ? */
+{
/* unsigned long q; */
/* unsigned int i; */
/* Search for 3 or more zeros in a row, followed by dont-care (length) */
/* - followed by pre and ID_BYTE */
-int readovertext(FILE *infile) {
+int readovertext(FILE *infile)
+{
int c, n;
c = getc(infile);
}
}
-void resetpagerangehit (int flag) {
+void resetpagerangehit (int flag)
+{
/* int k; */
/* for (k = 0; k < rangeindex; k++) pagerangehit[k] = 0; */ /* 1994/Jan/16 */
/* currentrange = -1; */
/***************************************************************************/
-void alloccolorsave (int npages) {
+void alloccolorsave (int npages)
+{
int k;
- if (ColorStacks != NULL) {
+ if (ColorStacks != NULL)
+ {
showline(" ERROR: color save stacks allocation\n", 1);
freecolorsave();
}
#ifdef DEBUGCOLORSTACK
- if (traceflag) {
+ if (traceflag)
+ {
sprintf(logline, "Allocating color save stack for %d pages\n", npages);
showline(logline, 0);
}
MaxColor = npages+1; /* make note of size of allocation */
}
-void freecolorsave (void) {
+void freecolorsave (void)
+{
int k, npages = MaxColor;
if (ColorStacks == NULL) return;
}
#ifdef DEBUGCOLORSTACK
-void dumpcolorsave (void) { /* debugging only */
+void dumpcolorsave (void) /* debugging only */
+{
int k, m, i, npages = MaxColor-1;
COLORSPEC *ColorSaved;
- if (ColorStacks == NULL) {
+ if (ColorStacks == NULL)
+ {
showline(" No saved color stacks to show\n", 1);
return;
}
}
#endif
-void allocbackground (int npages) {
+void allocbackground (int npages)
+{
int k;
if (BackColors != NULL) {
showline(" ERROR: background allocation\n", 1);
/***************************************************************************/
-int scanlogfileaux(FILE *fp_in) {
+int scanlogfileaux(FILE *fp_in)
+{
int c, k, fn;
/* long filptr; */
bBackUsed=0; /* non-zero of \special{background ...} used */
bColorUsed = 0; /* assume no color \special until ... 98/Feb/15 */
- if (bCarryColor || bBackGroundFlag) {
+ if (bCarryColor || bBackGroundFlag)
+ {
postposition = gotopost(input); /* in dvianal.c */
(void) getc(input); /* absorb the post byte */
logdo_post(input);
/* main entry point, prescan DVI file font usage, \specials */
-int scanlogfile (FILE *fp_in) {
+int scanlogfile (FILE *fp_in)
+{
int c, d;
input = fp_in; /* remember file handle */
d = getc(fp_in);
rewind(fp_in);
// we now forget about Textures files 99/July/14
- if (c != pre || d != ID_BYTE) {
+ if (c != pre || d != ID_BYTE)
+ {
sprintf(logline, " Not a proper DVI file `%s'\n",
(filenamex != NULL) ? filenamex : "");
showline(logline, 1);
struct map_element_struct *next;
} map_element_type;
-typedef map_element_type **map_type;
+typedef map_element_type **map_type;
/* **************************** auxiliary functions *********************** */
-static void complain_mem (unsigned int size) { /* out of memory */
+static void complain_mem (unsigned int size) /* out of memory */
+{
sprintf(logline, "Unable to honor request for %u bytes.\n", size);
showline(logline, 1);
checkexit(1);
}
-static void *xmalloc (unsigned int size) {
+static void *xmalloc (unsigned int size)
+{
void *new_mem = (void *) malloc (size);
if (new_mem == NULL) complain_mem(size);
return new_mem;
}
-static void *xrealloc (void *old_ptr, unsigned int size) {
+static void *xrealloc (void *old_ptr, unsigned int size)
+{
void *new_mem;
if (old_ptr == NULL)
/* new_mem = xmalloc (size); *//* could just let realloc do this case? */
return new_mem;
}
-static char *xstrdup (char *s) {
+static char *xstrdup (char *s)
+{
char *new_string = (char *) xmalloc (strlen (s) + 1);
return strcpy (new_string, s);
}
return answer;
} */ /* used by extend_filename only */
-static void *xcalloc (unsigned int nelem, unsigned int elsize) {
+static void *xcalloc (unsigned int nelem, unsigned int elsize)
+{
void *new_mem = (void *) calloc (nelem, elsize);
if (new_mem == NULL) complain_mem (nelem * elsize);
return new_mem;
#define BLOCK_SIZE 40
-static char *read_line (FILE *f) {
+static char *read_line (FILE *f)
+{
int c;
unsigned int limit = BLOCK_SIZE;
unsigned int loc = 0;
/* The hash function. We go for simplicity here. */
-static unsigned int map_hash (char *key) {
+static unsigned int map_hash (char *key)
+{
unsigned int n = 0;
char *s = key;
/* There are very few font names which are anagrams of each other
/* Look up STR in MAP. Return the corresponding `value' or NULL. */
-static char *map_lookup_str (map_type map, char *key) {
+static char *map_lookup_str (map_type map, char *key)
+{
unsigned int n = map_hash (key);
map_element_type *p;
}
#ifdef DEBUGALIAS
-static void map_show (map_type map) { /* debugging tool */
+static void map_show (map_type map) /* debugging tool */
+{
map_element_type *p;
unsigned int n;
/* Append the same suffix we took off, if necessary. */
/* if (ret) ret = extend_filename (ret, suffix); */
-char *map_lookup (map_type map, char *key) {
+char *map_lookup (map_type map, char *key)
+{
char *ret = map_lookup_str(map, key);
/* char *suffix; */
/* If KEY is not already in MAP, insert it and VALUE. */
/* This was a total mess! Fixed 1994/March/18 */
-static void map_insert (map_type map, char *key, char *value) {
+static void map_insert (map_type map, char *key, char *value)
+{
unsigned int n = map_hash (key);
- map_element_type **ptr = &map[n];
+ map_element_type **ptr = &map[n];
- while (*ptr != NULL && !(strcmp(key, (*ptr)->key) == 0))
- ptr = &((*ptr)->next);
+ while (*ptr != NULL && !(strcmp(key, (*ptr)->key) == 0))
+ ptr = &((*ptr)->next);
if (*ptr == NULL) {
*ptr = (map_element_type *) xmalloc (sizeof(map_element_type));
`r', because of the virtual fonts Dvips uses.
And what a load of bull! And who cares about DVIPS and VF files !*/
-static void map_file_parse (map_type map, char *map_filename) {
+static void map_file_parse (map_type map, char *map_filename)
+{
char *l;
unsigned int map_lineno = 0;
unsigned int entries = 0;
TEXFONTS. Entries in earlier files override later files. */
/* void oursearchenv (char *mapname, char *envvar, char *pathname) { */
-void oursearchenv (char *mapname, char *searchpath, char *pathname) {
+void oursearchenv (char *mapname, char *searchpath, char *pathname)
+{
/* char *searchpath; */ /* 97/May/10 */
int foundfile=0; /* set, but not used ? */
#ifndef SUBDIRSEARCH
/* Returns NULL if it failed for some reason */
/* map_type map_create (char *envvar) { */ /* 94/May/23 */
-map_type map_create (char *texfonts) { /* 97/May/10 */
+map_type map_create (char *texfonts) /* 97/May/10 */
+{
char pathname[_MAX_PATH];
map_type map;
/* returns NULL if failed to find an alias */
-char *alias (char *name) {
+char *alias (char *name)
+{
/* static map_type fontmap = NULL; */ /* static - keep around once set */
char *mapped_name;
/* used for pfb search path and eps search path */
/* this version also allows space as separator */
-char *nextpathname(char *pathname, char *searchpath) {
+char *nextpathname(char *pathname, char *searchpath)
+{
int n;
char *s;
/* so save on stack space, by having one copy, not one per expand_subdir */
/* possibly allocate this in the caller of findsubpath ? not static ? */
-int findsubpath (char *filename, char *pathname, int recurse) {
+int findsubpath (char *filename, char *pathname, int recurse)
+{
char *s;
int code;
int ret;
/* If a path in `pathlist' ends in \\, then this works recursively */
/* (which may be slow and cause stack overflows ...) */
-int searchalongpath (char *filename, char *pathlist, char *pathname, int current) {
-/* struct _find_t c_file; * /* need to preserve across calls to DOS */
+int searchalongpath (char *filename, char *pathlist, char *pathname, int current)
+{
+/* struct _find_t c_file; */ /* need to preserve across calls to DOS */
char *s, *t, *u, *send;
int c, n;
int recurse;
/* if current < 0, look in PFM sub directories also */
// only place we use _alloca ...
-FILE *findandopen (char *filename, char *pathlist, char *pathname,
- char *mode, int current) {
+FILE *findandopen (char *filename, char *pathlist, char *pathname, char *mode, int current)
+{
FILE *file;
if (pathname == NULL) {
/* stuff for reading .afm files */
-int readafm(char *font, FILE *fp_afm, long widths[]) {
+int readafm(char *font, FILE *fp_afm, long widths[])
+{
double fwidth;
int chr, k=0;
/* if (fp_afm == NULL) checkexit(5); */
(void) getrealline(fp_afm, line);
- while (strstr(line, "StartCharMetrics") == NULL) {
+ while (strstr(line, "StartCharMetrics") == NULL) {
if(getrealline(fp_afm, line) == 0) {
sprintf(logline,
" Can't find CharMetrics in AFM file for %s\n", font);
/* lf, lh, nw, nh, nd, ni, nl, nk, ne are numbers of words */
-int readtfm(char *font, FILE *fp_tfm, long widths[]) {
+int readtfm(char *font, FILE *fp_tfm, long widths[])
+{
static long qwidths[MAXCHRS]; /* 256 */
int lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np;
int k;
(void) sreadtwo(fp_tfm); /* design size */
/* discard rest of header */
for (k = 2; k < lh; k++) {
- (void) getc(fp_tfm); (void) getc(fp_tfm);
+ (void) getc(fp_tfm); (void) getc(fp_tfm);
}
/* now read the actual widths */
fseek(fp_tfm, (long) ((6 + lh + (ec - bc + 1)) << 2), SEEK_SET);
/* stuff for reading widths from .pfm files */
-int readpfm(char *font, FILE *fp_pfm, long widths[]) {
+int readpfm(char *font, FILE *fp_pfm, long widths[])
+{
unsigned long length, offset;
/* double fwidth; */
long lwidth;
/* if (fp_pfm == NULL) checkexit(5); */
/* first check that this is a PFM file - start with version number */
- if ((c = getc(fp_pfm)) != 0 || (c = getc(fp_pfm)) != 1) {
+ if ((c = getc(fp_pfm)) != 0 || (c = getc(fp_pfm)) != 1)
+ {
sprintf(logline, " Not a proper PFM file %s\n", font);
showline(logline, 1);
errcount(0);
/* int pfminstance (FILE *input, char *FontName, int nlen) { */
int NamesFromPFM (FILE *input, char *FaceName, int nface,
- char *FontName, int nfont, char *FileName) {
+ char *FontName, int nfont, char *FileName)
+{
short version;
long length, offset;
int n, ndrive;
/* stuff for reading ATMREG.ATM imported from winpslog.c 98/Jan/9 */
-unsigned int xreadtwo (FILE *input) {
+unsigned int xreadtwo (FILE *input)
+{
unsigned int c, d, n;
c = getc(input);
d = getc(input);
return n;
}
-unsigned long xreadfour (FILE *input) {
+unsigned long xreadfour (FILE *input)
+{
unsigned int a, b, c, d;
unsigned long n;
a = getc(input);
/* read string from ATMREG.ATM up to null, string may be empty */
/* returns -1 if hit EOF or name too long */
-int ReadString (FILE *input, char *name, int nlen) {
+int ReadString (FILE *input, char *name, int nlen)
+{
int c;
int n=0;
char *s=name;
int dirindex=0;
-void FreeDirs (void) {
+void FreeDirs (void)
+{
int k;
if (DirPaths == NULL) return;
for (k = 0; k <= nDirs; k++) {
DirPaths = NULL;
}
-int AllocDirs (int nDirs) {
+int AllocDirs (int nDirs)
+{
int k, nlen;
if (DirPaths != NULL) FreeDirs();
nlen = (nDirs + 1) * sizeof(char *);
return 0;
}
-void FreeFonts (void) {
+void FreeFonts (void)
+{
int k;
if (ATMFonts == NULL) return;
for (k = 0; k < ATMfontindex; k++) {
ATMFonts = NULL;
}
-int AllocFonts (int nFonts) {
+int AllocFonts (int nFonts)
+{
int nlen;
if (ATMFonts != NULL) FreeFonts();
nlen = nFonts * sizeof(struct ATMRegRec);
return 0;
}
-void ShowATMREG (void) {
+void ShowATMREG (void)
+{
int k;
char *szType;
sprintf(logline, "ATMREG has %d T1 font entries (out of %d total):\n", ATMfontindex, nFonts);
/**********************************************************************************/
-int SetupDirs (FILE *input, unsigned long startdirlist, unsigned long enddirlist) {
+int SetupDirs (FILE *input, unsigned long startdirlist, unsigned long enddirlist)
+{
int c, k, noff, nlen;
int npath=0;
unsigned long noffset;
#ifdef IGNORED
int SearchATMReg (FILE *input, unsigned long endfontlist,
- char *szPSFontName, char *szPFBFileName) {
+ char *szPSFontName, char *szPFBFileName)
+{
int c, k;
unsigned int stroffset, nlen;
unsigned long next;
/* WRITES BACK INTO SECOND ARGUMENT */
/* returns 0 if found, -1 if not found */
-int SearchATMReg (char *szPSFontName, char *szPFBFileName) {
+int SearchATMReg (char *szPSFontName, char *szPFBFileName)
+{
int k;
for (k = 0; k < ATMfontindex; k++) {
if (strcmp(szPSFontName, ATMFonts[k].FontName) == 0) {
/* Create new ATMFonts data structure 2000 July */
-int ScanATMReg (FILE *input, unsigned long endfontlist) {
+int ScanATMReg (FILE *input, unsigned long endfontlist)
+{
int c, k;
unsigned int stroffset, nlen;
unsigned long next;
/* also determines whether wide strings are used (ATM 4.1) */
/* also reads in directory path table */
-unsigned long ReadPointers (FILE *input) {
+unsigned long ReadPointers (FILE *input)
+{
(void) fseek(input, 6, SEEK_SET);
nDirs = xreadtwo(input); /* 6 number of directory paths */
nFonts = xreadtwo(input); /* 8 number of font entries */
return endfontlist;
}
-int SetupATMReg (void) {
+int SetupATMReg (void)
+{
char szFullFileName[FNAMELEN]="";
if (useatmreg == 0) return -1; /* tried already and failed */
// LOAD information from ATMREG.ATM in convenient form 2000 July 6
-int LoadATMREG (void) {
+int LoadATMREG (void)
+{
FILE *input;
int count;
/* WRITES BACK INTO SECOND ARGUMENT */
#ifdef IGNORED
-int LookupATMReg (char *szPSFontName, char *szPSFileName) {
+int LookupATMReg (char *szPSFontName, char *szPSFileName)
+{
FILE *input;
int n=0;
/* First arg is PS FontName */ /* WRITES BACK INTO SECOND ARG */
-int LookupATMReg (char *szPSFontName, char *szPSFileName) {
+int LookupATMReg (char *szPSFontName, char *szPSFileName)
+{
int n;
if (! useatmreg) return -1; // tried before and failed
if (szATMRegAtm == NULL) { // create ATMFonts structure
// exit(1); // pretty serious !
#endif
uexit(1);
- return new; // keep compiler happy
+// return new; // keep compiler happy
}
/*****************************************************************************/
#ifdef _WINDOWS
showline("ABORTJOB", 1); // debugging only - can't happen
#endif
- cleanup();
+ cleanup();
checkexit(3);
return -1;
}
{
if (flag) errlevel++;
/* if (errlevel > MAXERRORS) { */
- if (errlevel > nMaxErrors && nMaxErrors > 0) { /* 95/Dec/28 */
+ if (errlevel > nMaxErrors && nMaxErrors > 0) /* 95/Dec/28 */
+ {
showline("\n", 0);
sprintf(logline, "Too many errors (> %d) - giving up", nMaxErrors);
showline(logline, 1);
if (yoffsete == UNKNOWNOFFSET) yoffsete = 0.0;
if (yoffseto == UNKNOWNOFFSET) yoffseto = yoffsete;
- if (quietflag == 3) { /* dvipsone -qqq */
+ if (quietflag == 3) /* dvipsone -qqq */
+ {
// showpedigree(stdout);
showpedigree(line, sizeof(line)); /* MAXLINE */
showline(line, 0);
checkexit(0); /* 96/Feb/25 */
- return 0;
+// return 0;
}
quietflag = (quietflag & 1); /* only depend on even/odd */
double xll, yll, xur, yur;
/* error message output of beginning of long item */
-char *showbeginning (char *s, char *t, int n) {
+char *showbeginning (char *s, char *t, int n)
+{
int k;
for (k=0; k < n; k++) *s++ = *t++;
// fputs("...\n", output);
/* returns 0 if no more tokens found - else returns terminator */
/* what to do if error ? */
-int getalphatoken (FILE *input, char *token, int nmax) {
+int getalphatoken (FILE *input, char *token, int nmax)
+{
int c, k = 0;
char *s = token;
/* flush rest of special to get back to rest of DVI code */
-void flushspecial(FILE *input) {
+void flushspecial(FILE *input)
+{
int c;
if (nspecial <= 0) return;
c = getc(input); nspecial--;
/* - either up to white space - or - double quote delimited */
/* returns 0 if no more tokens found - else returns terminator */
-int gettoken (FILE *input, char *buff, int nmax) {
+int gettoken (FILE *input, char *buff, int nmax)
+{
int c, k=0, marker=' '; // end of token marker
char *s=buff;
/* copy special into line buffer for sscanf */
/* - either double quote delimited - or - up to end of special */
-int scanspecial (FILE *input, char *buff, int nmax) {
+int scanspecial (FILE *input, char *buff, int nmax)
+{
int c, k=0;
char *s=buff;
/* As above, but do not fiddle with "..." 97/Nov/11 needed for "mark" */
-int scanspecialraw (FILE *input, char *buff, int nmax) {
+int scanspecialraw (FILE *input, char *buff, int nmax)
+{
int c, k=0;
char *s=buff;
/* possibly just use scanspecial or gettoken instead ? */
/* return value seems to be mostly ignored */
-int getstring (FILE *input, char *buff, int nmax) {
+int getstring (FILE *input, char *buff, int nmax)
+{
int c, k = 0;
char *s=buff;
}
/* skip forward to comma in special string */
-void skiptocomma(FILE *input) {
+void skiptocomma(FILE *input)
+{
int c;
if (nspecial <= 0) return;
c = getc(input); --nspecial;
}
/* skip over double-quote-delimited string in special string */
-void flushstring (FILE *input) {
+void flushstring (FILE *input)
+{
int c;
if (nspecial <= 0) return;
c = getc(input); --nspecial;
/* copystring starts by emitting '\n' */
/* copystring ends by emitting '\n' when it is done */
-void copystring (FILE *output, FILE *input) {
+void copystring (FILE *output, FILE *input)
+{
int c;
int column=0;
int nesting=0; /* 1999/Feb/28 */
/* copy verbatim PostScript - but strip bracket enclosed crap first */
/* global | local | inline | asis | begin | end <user PS> ??? */
-void stripbracket (FILE *output, FILE *input) {
+void stripbracket (FILE *output, FILE *input)
+{
int c;
c = getc(input); nspecial--;
/* try and find bbox at end of file */
/* the following may inefficiently read stuff several times, but, so what */
-int findbboxatend (FILE *special, char *fname, long pslength) {
+int findbboxatend (FILE *special, char *fname, long pslength)
+{
int k, foundit = 0;
/* if (pslength > 0) fseek(special, pslength - (long) STEPSIZE, SEEK_SET); */
/* extract bounding box from inserted eps file and offset */
-int readbbox (FILE *special, char *fname, long pslength) {
+int readbbox (FILE *special, char *fname, long pslength)
+{
char *s;
int c, k;
/* if needshift < 0 then (xll, yur) is at TeX's current point */
/* - last one only used by DVIALW ? */
-void dealwithbbox (FILE *output, FILE *special, char *fname,
- long pslength, int needshift) {
+void dealwithbbox (FILE *output, FILE *special, char *fname, long pslength, int needshift)
+{
if (readbbox(special, fname, pslength) > 0) {
/* now perform shift - if asked for it */
if (needshift > 0) {
/* returns 0 if not found, +1 if found and not resident, -1 if resident */
/* file name returned in second arg */ /* first arg *is* case sensitive */
-int FindFileName (char *fontname, char *filename) { /* experiment 94/Aug/15 */
+int FindFileName (char *fontname, char *filename) /* experiment 94/Aug/15 */
+{
int k;
if (fontname == NULL) return 0;
/* Emits on stdout the font file name (minus trailing _) unless mmflag set */
char *fopenfont_sub (FILE *atmfile, char *FontName, char *pfbname,
- int atmflag, int mmflag){
+ int atmflag, int mmflag)
+{
/* FILE *atmfile; */
/* char atmini[FNAMELEN]; */
/* char *windir; */
/* maybe don't look along PSFONTS path if pfbname contains \ or / ? */
/* changed to look in current directory first 98/Jul/20 */
-FILE *findpfbfile (char *pfbname, char *FileName) { /* 1994/Aug/18 */
+FILE *findpfbfile (char *pfbname, char *FileName) /* 1994/Aug/18 */
+{
FILE *pfbfile;
char filename[FNAMELEN]; /* used for PFB file name ? */
#else
-FILE *findpfbfile (char *pfbname, char *FileName) {
+FILE *findpfbfile (char *pfbname, char *FileName)
+{
FILE *pfbfile;
char *searchpath;
char filename[FNAMELEN]; /* used for PFB file name ? */
/* find the atmfonts.map file and get its full path */
-int setupatmfontsmap (void) {
+int setupatmfontsmap (void)
+{
FILE *atmfile=NULL;
char atmfilename[FNAMELEN];
#ifndef SUBDIRSEARCH
/* Returns NULL if font file not found */
/* FILE *fopenfont (char *FontName, char *FileName) */
-FILE *fopenfont (char *FontName, char *FileName, int mmflag) {
+FILE *fopenfont (char *FontName, char *FileName, int mmflag)
+{
FILE *atmfile=NULL;
- FILE *pfbfile=NULL;
+ FILE *pfbfile=NULL;
char pfbfilename[FNAMELEN]; /* use for full PFB file name */
/* char *windir; */
char *s;
/* Returns 0 if plain ASCII format - or length of PS section if not */
/* Also advances file to start of PostScript part */
-long checkpcform (FILE *special, char *fname) {
+long checkpcform (FILE *special, char *fname)
+{
unsigned long n, m;
/* unsigned long i; */
int c, k;
/****************************************************************************
* *
-* The EPSF header has the following structure: *
+* The EPSF header has the following structure: *
* *
-* 0-3 the first four bytes are the letters EPSF with the meta-bit on - *
-* that is, hex C5D0D3C6. *
-* 4-7 the next four are the byte position of start of the PS section *
+* 0-3 the first four bytes are the letters EPSF with the meta-bit on - *
+* that is, hex C5D0D3C6. *
+* 4-7 the next four are the byte position of start of the PS section *
* 8-11 The next four are the length of the PostScript part of file; *
-* 12-15 The next four are the byte position of start of MetaFile version; *
-* 16-19 The next four are the length of the MetaFile version; *
-* 20-23 The next four are the byte position of start of TIFF version; *
-* 24-27 The next four are the length of the TIFF version; *
-* 28-29 The next two bytes are the header checksum or hex FFFF *
-* that is, two bytes that are all ones (meta-control-? = 255) *
+* 12-15 The next four are the byte position of start of MetaFile version; *
+* 16-19 The next four are the length of the MetaFile version; *
+* 20-23 The next four are the byte position of start of TIFF version; *
+* 24-27 The next four are the length of the TIFF version; *
+* 28-29 The next two bytes are the header checksum or hex FFFF *
+* that is, two bytes that are all ones (meta-control-? = 255) *
* *
-* IN EACH CASE THE LOW ORDER BYTE IS GIVEN FIRST *
+* IN EACH CASE THE LOW ORDER BYTE IS GIVEN FIRST *
* *
-* Either the MetaFile length or the TIFF length or both are zero *
+* Either the MetaFile length or the TIFF length or both are zero *
* *
-* If there is no MetaFile or Tiff version, the PS code starts at 30 *
+* If there is no MetaFile or Tiff version, the PS code starts at 30 *
* *
-* The file produced as plain PS by Designer, instead starts and ends *
+* The file produced as plain PS by Designer, instead starts and ends *
* on control-D. The first control-D is followed by %<space>, *
* which is non-standard, to say the least. *
* *
/* FreeHand produces EPS file only %%EndDocument, no %%BeginDocument ! */
/* Canvas produces EPS file that end with %%EndDocument: */
-void warnnesting (int nesting) {
+void warnnesting (int nesting)
+{
if (nesting != 0) {
sprintf(logline, " nesting level %d at end", nesting);
showline(logline, 1);
/* and also for EPS when -*s on command line */
/* flush blank lines ? flush comment lines ? <- NOT SAFE */
-int copyepssimple (FILE *output, FILE *special) { /* 1993/Jan/24 */
+int copyepssimple (FILE *output, FILE *special) /* 1993/Jan/24 */
+{
int c;
while ((c = getc(special)) != EOF) {
if (c >= 128) {
return 0;
}
-void reincludefont (FILE *output, char *FontName) {
+void reincludefont (FILE *output, char *FontName)
+{
/* fputs(line, output); */ /* line has been changed */
// fputs("%%", output);
PSputs("%%", output);
/* Should really implement more modern %%BeginData also ? */
-int CopyBinary (FILE *output, FILE *special, long nbytes) {
+int CopyBinary (FILE *output, FILE *special, long nbytes)
+{
long kk;
int c=0;
/* Skip %%BeginPreview: .... to %%EndPreview */
-long SkipEPSI (FILE *special) { /* 97/June/5 */
+long SkipEPSI (FILE *special) /* 97/June/5 */
+{
long nbytes=0;
int k;
for (;;) {
// \e%-12345X@PJL EOJ
// \e%-12345X
-int skiphpjunkathead (FILE *special, int flag) { // 99/Oct/14
+int skiphpjunkathead (FILE *special, int flag) // 99/Oct/14
+{
int c;
c = getc(special); // escape character (27)
c = getc(special); // %
/* called only by copyepsfileaux --- copyepsfilesub does not close file */
-void copyepsfilesub (FILE *output, FILE *special, long pslength) {
+void copyepsfilesub (FILE *output, FILE *special, long pslength)
+{
int k, nesting=0;
int c=0; /* keep down complaints */
int hpjunkflag=0; // set if escape (27) at start
/* Is there any problem here because of C-M and C-J ??? */
/* Input now is `rb' mode, output possibly in `w' (or `wb' mode) */
-int copyepsfilesimple (FILE *output, FILE *special, long pslength) {
+int copyepsfilesimple (FILE *output, FILE *special, long pslength)
+{
int c;
if (! bPassEPSF) { /* 1994/Mar/9 */
/* do similar hack for extension longer than 3 characters ? */
/* trunactes file name is long */
-int islongname (char *name) {
+int islongname (char *name)
+{
char *s, *t;
if ((t = strrchr(name, '.')) == NULL) t = name + strlen(name);
s = t;
/* FINDEPSFILE: Try to open the file to be included (or overlayed) */
/* FILE *findepsfile(char *name, int warnflag) { */ /* 1993/Oct/13 */
-FILE *findepsfile (char *name, char *ext, int warnflag, int readflag) {
+FILE *findepsfile (char *name, char *ext, int warnflag, int readflag)
+{
FILE *special=NULL;
char *s;
char *epsname=""; /* may be used before defined ??? */
showline(logline, 0);
}
/* if ((ret = _stat(filename, &statbuf)) != 0) {
- sprintf(logline, "ERROR: Unable to obtain info on %s\n", filename);
+ sprintf(logline, "ERROR: Unable to obtain info on %s\n", filename);
} */
/* printf("- FILENAME %s - EPSNAME %s - ", filename, epsname); */
return special;
}
-void copyepsfileaux (FILE *output, FILE *special, char *fname) {
+void copyepsfileaux (FILE *output, FILE *special, char *fname)
+{
long pslength; /* zero or length of PS section in EPSF file */
int ret;
char *s;
/* Note: copyepsfile also opens and closes the special file */
-void copyepsfile (FILE *output, char *epsfilename, int inclflag, int needshift) {
+void copyepsfile (FILE *output, char *epsfilename, int inclflag, int needshift)
+{
FILE *special;
long pslength;
/* copy rest of special to get back to rest of DVI code (used by Textures) */
-void colontoslash (char *name, char *buff) {
+void colontoslash (char *name, char *buff)
+{
int c;
char *s=name;
char *t=buff;
*s = '\0';
}
-void startspecial (FILE *output) {
+void startspecial (FILE *output)
+{
PSputc('\n', output); // always in new line ?
PSputs("dvispsav undsclx dvispbeg ", output);
}
-void startspecial1 (FILE *output) {
+void startspecial1 (FILE *output)
+{
PSputc('\n', output); // always in new line ?
PSputs("dvispsav ", output);
}
-void startspecial2 (FILE *output) {
+void startspecial2 (FILE *output)
+{
PSputc('\n', output); // always in new line ?
PSputs("dvispbeg ", output);
}
/* dvidict /dvispend get exec <== 92/Nov/26 */
-void endspecial (FILE *output) {
+void endspecial (FILE *output)
+{
// PSputc('\n', output); // always in new line ?
PSputs("dvidict /dvispend get exec\n", output);
}
#define MAXCOMPLAIN 127
-void complainspecial (FILE *input) { /* list contents and do flushspecial */
+void complainspecial (FILE *input) /* list contents and do flushspecial */
+{
int c, k=0;
/* long specnow; */
/* fseek(input, specnow, SEEK_SET); */ /* and restore count ? */
}
-void complainjflag (FILE *input) { /* 1993/Oct/17 */
+void complainjflag (FILE *input) /* 1993/Oct/17 */
+{
/* if (complainedaboutj++ > 0) return; */
if (complainedaboutj++ == 0)
showline(" WARNING: verbatim PS - use `j' flag?", 1);
/* Textures style include eps file */ /* added "scaled <double>" ? */
-void readtextures (FILE *output, FILE *input) { /* Texture style special ? */
+void readtextures (FILE *output, FILE *input) /* Texture style special ? */
+{
int c;
int clipflag = 0;
double scale=1.0;
/* Textures style "postscript" - direct inclusion of PostScript code */
/* void copypostscript(FILE *output, FILE *input) {*/ /* Texture style special ? */
-void copypostscript (FILE *output, FILE *input, int rawflag) { /* 1994/July/4 */
+void copypostscript (FILE *output, FILE *input, int rawflag) /* 1994/July/4 */
+{
/* startspecial(output); */
/* why not just use undscl ??? */
/* fputs("\nrevscl ", output); */
/* can this really take a scale factor ? */
/* should this neuter stuff ? and use save-restore pair ? */
/* void readpostscript(FILE *output, FILE *input) { */ /* Texture style special ? */
-void readpostscript (FILE *output, FILE *input, int rawflag) { /* 1994/July/5 */
+void readpostscript (FILE *output, FILE *input, int rawflag) /* 1994/July/5 */
+{
/* int c; */
double scale=1.0;
char epsname[FNAMELEN]="";
/* There may be a problem if /magnification != 1000 */
/* - since OzTeX uses absolute 72 per inch scaling ??? */
-int readandrew (FILE *output, FILE *input) {
+int readandrew (FILE *output, FILE *input)
+{
FILE *special;
char epsfilename[FNAMELEN]="";
}
/* separator is ` ' (space) */ /* DVIALW style special ? */
-int readdvialw (FILE *output, FILE *input) {
+int readdvialw (FILE *output, FILE *input)
+{
char epsfilename[FNAMELEN]="";
long flitpos=0; /* place in file where literal was */
long fendspec; /* saved pointer to end of special */
void texlandscape(FILE *output) { /* 92/Nov/28 */
PSputc('\n', output); // always on new line ?
PSputs("dvidict begin ", output);
- PSputs("revscl Texlandscape forscl end\n", output);
+ PSputs("revscl Texlandscape forscl end\n", output);
}
void endtexfig(FILE *output) { /* 92/Nov/28 */
/* ... need to touch up coords in startTexFig line */
#ifdef ALLOWSCALE
-void rescaletexfig (char *line) {
+void rescaletexfig (char *line)
+{
char *s;
int n;
long w, h, llx, lly, urx, ury;
/* output verbatim what is in buffer - except leading white space */
/* rewritten 1994/June/27 for crude wrapping of long lines */
-void verbout (FILE *output, char *str) {
+void verbout (FILE *output, char *str)
+{
char *s=str; // work from string
int c;
int column=0;
/* split up the following - its too darn long ! */
/* Separator is `=' dvi2ps style */
-int readdvi2ps (FILE *output, FILE *input) {
+int readdvi2ps (FILE *output, FILE *input)
+{
char epsfilename[FNAMELEN]="";
/* int includeflag=1; */ /* always include instead of overlay */
int firsttime=1; /* already read first token */
/* example: \special{picture screen0 scaled 500} */
/* To do this, one would need to extract a bit-map */
-void readpicture (FILE *output, FILE *input) {
+void readpicture (FILE *output, FILE *input)
+{
complainspecial(input);
}
/* The following were separated out for convenience 96/Nov/3 */
-int doColorPop (int pageno) {
+int doColorPop (int pageno)
+{
int flag = 0;
if (colorindex <= 0) {
sprintf(logline, " %s stack underflow on page %d\n", "color", pageno);
CurrentD = ColorD[colorindex]; */
CurrColor = ColorStack[--colorindex];
if (colorindex == 0) { /* hit bottom of stack ? */
- if (CurrColor.A == 0.0 && CurrColor.B == 0.0 && CurrColor.C == 0.0) {
+ if (CurrColor.A == 0.0 && CurrColor.B == 0.0 && CurrColor.C == 0.0)
+ {
if (colortypeflag == 2) /* cmyk */
CurrColor.D = 1.0F;
else if (colortypeflag == 1) /* rgb */
return flag;
}
-int doColorPush (int pageno) {
+int doColorPush (int pageno)
+{
/* ColorA[colorindex] = CurrentA;
ColorB[colorindex] = CurrentB;
ColorC[colorindex] = CurrentC;
/* popflag == 2 => beginning of page color setting */
/* popflag == 3 => background color setting at top of page */
-void doColorSet (FILE *output, int popflag) {
+void doColorSet (FILE *output, int popflag)
+{
if (! freshflag) PSputc('\n', output);
- if (CurrColor.D >= 0.0) {
+ if (CurrColor.D >= 0.0)
+ {
sprintf(logline, "%g %g %g %g cmyk ",
CurrColor.A, CurrColor.B, CurrColor.C, CurrColor.D);
PSputs(logline, output);
}
- else if (CurrColor.D == -1.0F) {
+ else if (CurrColor.D == -1.0F)
+ {
sprintf(logline, "%g %g %g rgb ",
CurrColor.A, CurrColor.B, CurrColor.C);
PSputs(logline, output);
sprintf(logline, "%g gray ", CurrColor.A);
PSputs(logline, output);
}
- if (popflag && ! directprint) {
+ if (popflag && ! directprint)
+ {
if (popflag == 1) {
PSputs("% pop", output);
}
showcount = 0;
}
-int doColorPopAll (int pageno) { /* 1996/Nov/3 */
+int doColorPopAll (int pageno) /* 1996/Nov/3 */
+{
if (colorindex == 0) return -1;
while (colorindex > 0) doColorPop(pageno);
return 0;
/* called from dvianal.c if color stack not empty at EOP */
-int checkColorStack (FILE *output) { /* 96/Nov/3 */
+int checkColorStack (FILE *output) /* 96/Nov/3 */
+{
if (colorindex == 0) return 0;
if (bCarryColor == 0) { /* 98/Feb/14 */
showline(" color stack not empty at EOP", 1);
/* outflag controls whether emitting PS output - off when skipflag set */
-void doColor (FILE *output, FILE *input, int c, int outflag) { /* 95/Mar/1 */
+void doColor (FILE *output, FILE *input, int c, int outflag) /* 95/Mar/1 */
+{
char *s;
int n, m, setcolor=0, popflag = 0;
long page;
/* flag != 0 (pop*) means do not preserve current point */
-int popCTM (FILE *output, int flag) {
+int popCTM (FILE *output, int flag)
+{
CTMstackindex--;
if (CTMstackindex < 0) {
sprintf(logline, " %s stack underflow on page %d\n", "CTM", pageno);
return 0;
}
-void popallCTM (FILE *output, int flag) {
+void popallCTM (FILE *output, int flag)
+{
// PSputs(" grestoreall\n", output);
// PSputs(" curentfont grestoreall setfont\n", output);
PSputs(restoreCTMall, output);
CTMstackindex = 0;
}
-int checkCTM (FILE *output) { /* CALL AT END OF PAGE */
+int checkCTM (FILE *output) /* CALL AT END OF PAGE */
+{
if (CTMstackindex == 0) return 0;
showline(" CTM stack not empty at EOP", 1);
popallCTM(output, 0);
return -1;
}
-int pushCTM (FILE *output, int flag) {
+int pushCTM (FILE *output, int flag)
+{
CTMstackindex++;
// PSputs(" gsave\n", output);
PSputs(saveCTM, output);
/* NOTE: This has different semantics from rotate, scale, and concat */
/* If would make no sense to make it relative to current point! */
-void translateCTM (FILE *output, double dx, double dy, int flag) {
+void translateCTM (FILE *output, double dx, double dy, int flag)
+{
PSputs(" currentpoint\n", output); // remember current point
dy = - dy; /* upside down coordinate system 96/Nov/5 */
if (flag == 0) {
/* flag != 0 (scale*) means scale by inverse of given factors */
-int scaleCTM (FILE *output, double sx, double sy, int flag) {
+int scaleCTM (FILE *output, double sx, double sy, int flag)
+{
PSputs(tranCP, output);
// PSputc('\n', output);
if (flag == 0) {
/* flag != 0 (rotate*) means rotate in opposite direction */
/* NOTE: we are in a left-hand coordinate system so flip sign of angle */
-void rotateCTM (FILE *output, double theta, int flag) {
+void rotateCTM (FILE *output, double theta, int flag)
+{
PSputs(tranCP, output);
// PSputc('\n', output);
if (flag == 0) {
void concatCTM (FILE* output,
double m11, double m12, double m21, double m22, double m31, double m32,
- int flag) {
+ int flag)
+{
double det, n11, n12, n21, n22, n31, n32;
PSputs(tranCP, output);
// PSputc('\n', output);
/* Deal with \special{CTM: ...} push pop rotate scale translate concat */
/* Some of these have alternate forms indicated by trailing `*' */
-void doCTM (FILE *output, FILE *input) { /* \special{CTM: } 96/Oct/10 */
+void doCTM (FILE *output, FILE *input) /* \special{CTM: } 96/Oct/10 */
+{
char *s;
int n, flag;
double dx, dy, sx, sy, theta, m11, m12, m21, m22, m31, m32;
/* logical coordinates upper left corner, lower right corner */
-void clipbox (FILE *output, long dwidth, long dheight, int flag) {
+void clipbox (FILE *output, long dwidth, long dheight, int flag)
+{
/* int ret; */
PSputc('\n', output); // always on new line ?
} */
}
-void doClipBoxPush (FILE *output) {
+void doClipBoxPush (FILE *output)
+{
// PSputc('\n', output); // always on new line ?
// PSputs("gsave ", output);
// PSputs(" gsave\n", output); // saveCTM
clipstackindex++;
}
-void doClipBoxPop (FILE *output) {
+void doClipBoxPop (FILE *output)
+{
if (clipstackindex <= 0) return; /* avoid stack underflow */
clipstackindex--;
// PSputc('\n', output); // always on new line ?
PSputs(restoreCTM, output);
}
-void doClipBoxPopAll (FILE *output) {
+void doClipBoxPopAll (FILE *output)
+{
while (clipstackindex > 0) doClipBoxPop(output);
}
/* int c is terminating character */
-void doClipBox (FILE *output, FILE *input, int c) { /* 98/Sep/8 */
+void doClipBox (FILE *output, FILE *input, int c) /* 98/Sep/8 */
+{
char *s;
long dwidth, dheight;
/* long cxll, cyll, cxur, cyur; */
};
double unitscale[] = {
- (72.0 / 72.27), 12.0 * (72.0 / 72.27), 72.0, 1.0,
- (72.0 / 2.54), (72.0 / 25.4), (1238.0 / 1157.0) * (72.0 / 72.27),
- 12.0 * (1238.0 / 1157.0) * (72.0 / 72.27),
- (72.0 / 72.27) / 65536.0
+ (72.0 / 72.27),
+ 12.0 * (72.0 / 72.27), 72.0, 1.0,
+ (72.0 / 2.54), (72.0 / 25.4), (1238.0 / 1157.0) * (72.0 / 72.27),
+ 12.0 * (1238.0 / 1157.0) * (72.0 / 72.27),
+ (72.0 / 72.27) / 65536.0
};
-double decodeunits (char *units) {
+double decodeunits (char *units)
+{
int k;
for (k = 0; k < 9; k++) {
if (strcmp(unitnames[k], units) == 0)
/* make common to save string space */
-void dvitopsmiss (void) {
+void dvitopsmiss (void)
+{
showline(" File name missing in DVITPS, DVITOPS or PC-TeX special ", 1);
}
/* added PC-TeX \special{eps: <filename> <x=2in> <y=3cm>} 94/Jun/17 */
/* void readdvitops(FILE *output, FILE *input) { */ /* 1994/June/17 */
-int readdvitops (FILE *output, FILE *input, int pctexflag) {
+int readdvitops (FILE *output, FILE *input, int pctexflag)
+{
double width=0.0, height=0.0, widthd, heightd;
double hscale, vscale, scale, multiple;
double xshift, yshift;
/* em:point n --- remember current coordinates for point n */
/* em:line a[h|v|p],b[h|v|p][,w] draw line thickness w from point a to b */
-void reademtex (FILE *output, FILE *input) {
+void reademtex (FILE *output, FILE *input)
+{
double linewidth, multiple;
long emline = 26214; /* default 0.4pt * 65536 */
char *s;
int n;
/* if (getalphatoken(input, line, MAXLINE) == 0) { */
- if (getalphatoken(input, line, sizeof(line)) == 0) {
+ if (getalphatoken(input, line, sizeof(line)) == 0)
+ {
complainspecial(input);
return;
}
- if (strcmp(line, "message") == 0) {
+ if (strcmp(line, "message") == 0)
+ {
// putc(' ', stdout);
showline(" ", 0);
(void) scanspecial(input, line, MAXLINE);
/* DVITPS specials for figure insertion --- 1993/March/24 */
/* Not done as carefully as it should be, see DVI2PS and DVIPS code */
-int readdvitps (FILE *output, FILE *input) {
+int readdvitps (FILE *output, FILE *input)
+{
char epsfilename[FNAMELEN]="";
/* char units[3]; */
long pslength;
/* Special starts with `ps:' or `ps::' - lots of possibilities ... */
/* DVIPS style? - some DVIPS stuff not implemented */
/* Also DVIPS operates in left-handed coordinate system */
-int readdvips (FILE *output, FILE *input) {
+int readdvips (FILE *output, FILE *input)
+{
int c;
double scale=1.0;
char *s, *t;
/* support \special{src123file.tex} */
-void DoScr (FILE *output, FILE *input) { /* 98/Nov/4 */
+void DoScr (FILE *output, FILE *input) /* 98/Nov/4 */
+{
int lineno=0;
char srcfile[FILENAME_MAX]="";
/* Terminated by : => ArborText style special or DVITOPS or DVITPS or EM */
/* Separator is `:' */ /* or HP TAG tiff: */
-int readdvilaserps (FILE *output, FILE *input) {
+int readdvilaserps (FILE *output, FILE *input)
+{
if (strcmp(line, "ps") == 0) readdvips(output, input);
- else if (strcmp(line, "dvitops") == 0) readdvitops(output, input, 0);
- else if (strcmp(line, "eps") == 0) readdvitops(output, input, 1);
- else if (strcmp(line, "dvitps") == 0) readdvitps(output, input);
- else if (strcmp(line, "em") == 0) reademtex(output, input);
+ else if (strcmp(line, "dvitops") == 0) readdvitops(output, input, 0);
+ else if (strcmp(line, "eps") == 0) readdvitops(output, input, 1);
+ else if (strcmp(line, "dvitps") == 0) readdvitps(output, input);
+ else if (strcmp(line, "em") == 0) reademtex(output, input);
else if (strcmp(line, "tiff") == 0) dohptag(output, input);
/* Is it one of DVIWINDO's specials ? */ /* colon after `color' 95/June/21 */
else if (strcmp(line, "color") == 0) doColor(output, input, ':', 1);
/* * 0.001 => in */ /* * 72.27 => points */ /* * 65536 => scaled points */
-long convscal (long z) { /* convert to scaled point from 0.001 inch */
+long convscal (long z) /* convert to scaled point from 0.001 inch */
+{
/* return (long) ((double) z * 0.001 * 72.27 * 65536); */
/* return (long) ((double) z * 4736.28672); */
return z * 4736; /* avoid round-off error accumulation & floating */
}
-long convscaldouble (double z) { /* as above, but for positive double */
+long convscaldouble (double z) /* as above, but for positive double */
+{
if (z < 0.0) return - (long) (-z * 4736.0 + 0.5);
else return (long) (z * 4736.0 + 0.5);
}
// On entry contains TPIC command token in line
// If it takes arguments, scanspecial is used to read in the rest
-int readtpic (FILE *output, FILE *input) {
+int readtpic (FILE *output, FILE *input)
+{
long x=xold, y=yold;
double z=0.0;
long xr=0, yr=0;
int c, k;
char *s;
char temp[3];
- char bits[16]="0112122312232334"; /* "0123456789ABCDEF" */
+ char bits[17]="0112122312232334"; /* "0123456789ABCDEF" */
// check whether it could be TPIC command
if (strlen(line) != 2) return 0; /* quick exit */
/* read and analysize special command called from dvianal.c xxx */
-int readspecial (FILE *output, FILE *input, unsigned long ns) {
+int readspecial (FILE *output, FILE *input, unsigned long ns)
+{
int c;
if (bIgnoreSpecials != 0) { /* ignore \specials ? */
(void) ungetc(c, input); /* put back the first byte */
nspecial++;
- if ((c = getalphatoken(input, line, sizeof(line))) == 0) {
+ if ((c = getalphatoken(input, line, sizeof(line))) == 0)
+ {
if (quietflag == 0) showline(" Blank special", 1);
return 0; /* found nothing ! */
}
/* Use this while skipping pages *//* used just to keep track of color stack */
/* all other \specials are ignored *//* added 98/Feb/14 */
-void prereadspecial (FILE *input, unsigned long ns) {
+void prereadspecial (FILE *input, unsigned long ns)
+{
int c;
if (bIgnoreSpecials != 0) { /* ignore \specials ? */
/* em:point n --- remember current coordinates for point n */
/* em:line a[h|v|p],b[h|v|p][,w] draw line thickness w from point a to b */
-void reademtex (FILE *output, FILE *input) {
+void reademtex (FILE *output, FILE *input)
+{
double linewidth, multiple;
long emline = 26214; /* default 0.4pt * 65536 */
char *s;
\r
double textred=0.0; /* color of text */\r
double textgreen=0.0;\r
-double textblue=0.0; \r
+double textblue=0.0;\r
\r
int bRuleColor=0;\r
\r
double rulered=0.0; /* color of rules */\r
double rulegreen=0.0;\r
-double ruleblue=0.0; \r
+double ruleblue=0.0;\r
\r
int bFigureColor=0; /* figure color has been specified */\r
\r
double figurered=0.0; /* foreground of figure */\r
double figuregreen=0.0;\r
-double figureblue=0.0; \r
+double figureblue=0.0;\r
\r
double backred=1.0; /* background of figure */\r
double backgreen=1.0;\r
-double backblue=1.0; \r
+double backblue=1.0;\r
\r
int bReverseVideo=0;\r
\r
unsigned int IFDCount; /* number of items image file directory */\r
unsigned long IFDPosition; /* position of image file directory */\r
\r
-#pragma optimize ("lge", off)\r
+//#pragma optimize ("lge", off)\r
\r
/* static unsigned short int ureadtwo(FILE *input) {\r
unsigned short int c, d;\r
int c;\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) showline("Now reading TIFF images fields\n", 0); \r
+ if (traceflag) showline("Now reading TIFF images fields\n", 0);\r
#endif\r
\r
if (fseek(input, (long) ifdpos + TIFFOffset, SEEK_SET) != 0)\r
xresden = yresden = 1;\r
ResolutionUnit = 2; \r
\r
- for (k = 0; k < IFDCount; k++) {\r
+ for (k = 0; k < IFDCount; k++)\r
+ {\r
tag = ureadtwo(input); /* tag - key */\r
type = ureadtwo(input); /* value type */\r
if (tag == 0 && type == 0) { /* invalid */\r
if (length == 1) {\r
if (type == TYPE_LONG) offset = ureadfour(input);\r
else if (type == TYPE_SHORT) {\r
- offset = ureadtwo(input); \r
+ offset = ureadtwo(input);\r
(void) ureadtwo(input); /* should be zero */\r
}\r
else if (type == TYPE_BYTE) {\r
\r
/* do we need to use unsigned short for NT ? */\r
\r
-int ReadColorMap (FILE *input, long ColorMapPtr, int BitsPerSample) {\r
+int ReadColorMap (FILE *input, long ColorMapPtr, int BitsPerSample)\r
+{\r
long present;\r
int k, n, nint;\r
\r
\r
#ifdef DEBUGTIFF\r
#ifdef USESHORTINT\r
- unsigned short int *PaletteRed; \r
+ unsigned short int *PaletteRed;\r
unsigned short int *PaletteGreen;\r
- unsigned short int *PaletteBlue; \r
+ unsigned short int *PaletteBlue;\r
#else\r
- unsigned int *PaletteRed; \r
- unsigned int *PaletteGreen; \r
- unsigned int *PaletteBlue; \r
+ unsigned int *PaletteRed;\r
+ unsigned int *PaletteGreen;\r
+ unsigned int *PaletteBlue;\r
#endif\r
#endif\r
\r
PaletteSize = n; /* remember for later */\r
nint = n * 3; /* total number of integers */\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "Reading Color Map of size %d\n", n);\r
showline(logline, 1);\r
}\r
malloc(nint * sizeof(unsigned short int));\r
#else\r
/* Palette = (unsigned int *) malloc(nint * 2); */ /* bytes */\r
- Palette = (unsigned int *) malloc(nint * sizeof(unsigned int)); \r
+ Palette = (unsigned int *) malloc(nint * sizeof(unsigned int));\r
#endif\r
- if (Palette == NULL) {\r
+ if (Palette == NULL)\r
+ {\r
showline(" ERROR: Unable to allocate memory\n", 1);\r
checkexit(1);\r
// or more serious exit(1) ???\r
}\r
present = ftell(input);\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "Going to ColorMap at %ld + %lu\n",\r
ColorMapPtr, TIFFOffset);\r
showline(logline, 1);\r
}\r
#endif\r
- if (fseek (input, (long) ColorMapPtr + TIFFOffset, SEEK_SET) != 0) {\r
+ if (fseek (input, (long) ColorMapPtr + TIFFOffset, SEEK_SET) != 0)\r
+ {\r
sprintf(logline, " Error in seek %s\n", " to ColorMap");\r
showline(logline, 1);\r
}\r
PaletteBlue = PaletteGreen + PaletteSize;\r
\r
bGrayFlag = 1; // non-zero if palette is all grays\r
- for (k = 0; k < n; k++) {\r
+ for (k = 0; k < n; k++)\r
+ {\r
if (PaletteRed[k] != PaletteGreen[k] ||\r
- PaletteGreen[k] != PaletteBlue[k]) {\r
+ PaletteGreen[k] != PaletteBlue[k])\r
+ {\r
bGrayFlag = 0;\r
break;\r
}\r
} // bGrayFlag presently not used\r
\r
- bLinearFlag = 0; // non-zero if Palette is simply linear \r
+ bLinearFlag = 0; // non-zero if Palette is simply linear\r
if (bGrayFlag) {\r
bLinearFlag = 1;\r
- for (k = 0; k < n; k++) {\r
+ for (k = 0; k < n; k++)\r
+ {\r
if (PaletteRed[k] != (unsigned int) (k * 255 / (n-1))) {\r
bLinearFlag = 0;\r
break;\r
// bGrayFlag and bLinearFlag could be used to produce smaller output files\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
PaletteRed = Palette;\r
PaletteGreen = PaletteRed + PaletteSize;\r
PaletteBlue = PaletteGreen + PaletteSize;\r
/* write out a row of image */\r
\r
int ProcessRow (FILE *output, unsigned char *lpBuffer, long InRowLengthX,\r
- long BufferLength, long OutRowLength) {\r
+ long BufferLength, long OutRowLength)\r
+{\r
/* if (traceflag)\r
printf("ProcessRow InRowLengthX %d\n", InRowLengthX); */ /* DEBUGGING */\r
/* if (traceflag)\r
if (bCompressColor) compresscolor(lpBuffer, BufferLength);\r
#ifdef DEBUGTIFF\r
if (traceflag) { /* DEBUGGING */\r
- sprintf(logline, "ProcessRow OutRowLength %d\n", OutRowLength); \r
+ sprintf(logline, "ProcessRow OutRowLength %d\n", OutRowLength);\r
showline(logline, 0);\r
}\r
#endif\r
/* Throw out ExtraSamples in SamplesPerPixel */\r
/* IMPORTANT NOTE: assume for the moment samples are one byte */\r
\r
-int RemoveExtraSamples (unsigned char *lpBuffer, int InRowLength) {\r
+int RemoveExtraSamples (unsigned char *lpBuffer, int InRowLength)\r
+{\r
unsigned char *s = lpBuffer;\r
unsigned char *t = lpBuffer;\r
int i, k, n = InRowLength / SamplesPerPixel;\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "RemoveExtraSamples InRowLength %d\n", InRowLength);\r
showline(logline, 1);\r
}\r
/* readflag != 0 when reading file only to get tag fields */\r
\r
int readTIFFfile (FILE *output, FILE *input,\r
- long dwidth, long dheight, int nifd, int readflag) {\r
+ long dwidth, long dheight, int nifd, int readflag)\r
+{\r
/* int i, j, flag; */\r
int i, flag;\r
/* long present; */\r
int nLen;\r
\r
TIFFVersion = ureadtwo(input);\r
- if (TIFFVersion != TIFF_VERSION) {\r
+ if (TIFFVersion != TIFF_VERSION)\r
+ {\r
sprintf(logline, " Incorrect TIFF version code %d\n", TIFFVersion);\r
showline(logline, 1);\r
return -1; /* bad version number for TIFF file */\r
\r
IFDPosition = ureadfour(input); /* get first IFD offset in file */\r
while (nifd-- > 1) {\r
- if (skipthisimage(input, IFDPosition) < 0) {\r
+ if (skipthisimage(input, IFDPosition) < 0)\r
+ {\r
sprintf(logline, " ERROR: Subimage %d not found", nifd);\r
showline(logline, 1);\r
return -1;\r
}\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "Width %ld, Height %ld, BitsPerSample %d, SamplesPerPixel %d\n", \r
ImageWidth, ImageLength, BitsPerSample, SamplesPerPixel);\r
showline(logline, 1);\r
#endif\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "Compression %u PhotometricInterpretation %d\n",\r
compression, PhotometricInterpretation);\r
showline(logline, 1);\r
#endif\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag && Predictor != 1) {\r
+ if (traceflag && Predictor != 1)\r
+ {\r
sprintf(logline, "Predictor %d\n", Predictor);\r
showline(logline, 1);\r
}\r
/* if (bitsperpixel == 24 && bCompressFlag != 0 && forceice == 0) */\r
/* if (BitsPerPixel == 24 && bCompressFlag != 0) */\r
/* if ((BitsPerPixel == 24 || bExpandColor) && bAllowColor == 0) */\r
- if ((BitsPerPixelX == 24 || bExpandColor) && ! bAllowColor) {\r
+ if ((BitsPerPixelX == 24 || bExpandColor) && ! bAllowColor)\r
+ {\r
sprintf(logline, " color image (bits %d expand %d): use `*c' flag?",\r
BitsPerPixelX, bExpandColor); /* 96/Aug/15 */\r
// showline(logline, 1);\r
OutRowLength = BufferLength / 3;\r
}\r
else OutRowLength = BufferLength;\r
- \r
+\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "InRowLength %ld BufferLength %ld OutRowLength %ld\n",\r
InRowLength, BufferLength, OutRowLength);\r
showline(logline, 1);\r
/* deal with GhostScript TIFF file format with gaps */ /* 94/Dec/16 */\r
/* shouldn't this only kick in if we are not using (LZW) compression ? */\r
if (bGhostHackFlag) { /* made conditional 95/Nov/10 */\r
- if (InRowLength + 1 == StripByteCount) {\r
+ if (InRowLength + 1 == StripByteCount)\r
+ {\r
InRowLength++; /* a hack */\r
}\r
}\r
#ifdef LZWCOMPRESSION\r
bLZWFlag = 0;\r
/* Use LZW if runlength encoding not chosen */\r
- if (bRunLengthFlag == 0) {\r
+ if (bRunLengthFlag == 0)\r
+ {\r
// if (compression == LZW_COMPRESSION) bLZWFlag = 1;\r
// else; bLZWFlag = 1 /* otherwise use LZW */\r
bLZWFlag = 1;\r
/* following should already be taken care of in `computeheader' */\r
/* if (compression > 1 && compression != PACK_BITS) */\r
if (compression > TIFF_CCITT && compression != LZW_COMPRESSION &&\r
- compression != PACK_BITS) { \r
+ compression != PACK_BITS)\r
+ {\r
sprintf(logline, " ERROR: Unknown compression scheme (%d)", compression);\r
showline(logline, 1);\r
- return -1; \r
+ return -1;\r
}\r
- \r
+\r
/* ImageSize = (unsigned long) InRowLength * ImageLength; */\r
ImageSize = (unsigned long) InRowLengthX * ImageLength;\r
-/* check whether values reasonable */ \r
- if (ImageSize == 0) {\r
+/* check whether values reasonable */\r
+ if (ImageSize == 0)\r
+ {\r
sprintf(logline, " ERROR: Zero image size, %d %d (%s)",\r
InRowLengthX, ImageLength, "readTIFFfile");\r
showline(logline, 1);\r
if (ImageWidth > MAXIMAGE || ImageLength > MAXIMAGE || /* bad data ? */\r
ImageSize > 67108864) { /* arbitrary limits (to catch bad files) */\r
sprintf(logline,\r
- " ERROR: image file too large\n(%ld x %ld (%d) => %ld bytes)", \r
+ " ERROR: image file too large\n(%ld x %ld (%d) => %ld bytes)",\r
ImageWidth, ImageLength, BitsPerPixel, ImageSize);\r
showline(logline, 1);\r
return -1;\r
StripOffset < 0) { /* missing fields */\r
showline(" ERROR: TIFF file missing required tags", 1);\r
return -1;\r
- } \r
+ }\r
\r
- if (fseek(input, (long) StripOffset + TIFFOffset, SEEK_SET) != 0) {\r
+ if (fseek(input, (long) StripOffset + TIFFOffset, SEEK_SET) != 0)\r
+ {\r
sprintf(logline, " Error in seek %s\n", " to StripOffset\n");\r
showline(logline, 1);\r
return -1;\r
/* Accomodate GhostScript gap bug work around ... just in case 95/Nov/10 */\r
/* nLen = BufferLength + 1; */\r
nLen = (int) ((BufferLength + 3) / 4) * 4;\r
- if ((lpBuffer = malloc(nLen)) == NULL) { \r
- sprintf(logline, " ERROR: Unable to allocate %d bytes\n", nLen); \r
+ if ((lpBuffer = malloc(nLen)) == NULL)\r
+ {\r
+ sprintf(logline, " ERROR: Unable to allocate %d bytes\n", nLen);\r
showline(logline, 1);\r
checkexit(1); /* 1995/July/15 ? */\r
// or more serious exit(1) ???\r
/* following should already be taken care of in `computeheader' */\r
\r
if (compression > TIFF_CCITT && compression != LZW_COMPRESSION &&\r
- compression != PACK_BITS) { \r
+ compression != PACK_BITS)\r
+ {\r
sprintf(logline, " ERROR: Unknown compression scheme (%d)", compression);\r
showline(logline, 1);\r
return -1;\r
}\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
if (compression == PACK_BITS) sprintf(logline, "Using PACK_BITS\n");\r
else if (compression == TIFF_CCITT) sprintf(logline, "Using TIFF_CCITT\n");\r
else if (compression == LZW_COMPRESSION) sprintf(logline, "Using LZW\n");\r
showline(logline, 1);\r
- } \r
+ }\r
#endif\r
\r
flag = 0; /* flag gets set if EOF hit */\r
\r
#ifdef PSLEVEL2\r
- if (bLevel2) {\r
+ if (bLevel2)\r
+ {\r
ASCIIinitfilter(output); /* 96/Dec/20 */\r
if (bRunLengthFlag) RUNinitfilter(output); /* 96/Dec/24 */\r
#ifdef LZWCOMPRESSION\r
\r
/* LZW needs to be done by strips, the others can be done by row */\r
\r
- if (compression == LZW_COMPRESSION) DecodeLZW(output, input, lpBuffer); \r
+ if (compression == LZW_COMPRESSION) DecodeLZW(output, input, lpBuffer);\r
\r
else { /* else not LZW compression */\r
\r
} \r
}\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
- sprintf(logline, "readTIFFFile InRowLength %d\n", InRowLength); \r
- showline(logline, 1); \r
+ if (traceflag)\r
+ {\r
+ sprintf(logline, "readTIFFFile InRowLength %d\n", InRowLength);\r
+ showline(logline, 1);\r
}\r
#endif\r
if (ExtraSamples > 0)\r
(void) RemoveExtraSamples(lpBuffer, InRowLength); /* 99/May/10 */\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "readTIFFFile OutRowLength %d BufferLength %d\n",\r
OutRowLength, BufferLength);\r
showline(logline, 1);\r
\r
/* if (ProcessRow (output, lpBuffer, InRowLength, BufferLength, */\r
if (ProcessRow (output, lpBuffer, InRowLengthX, BufferLength,\r
- OutRowLength) != 0) {\r
+ OutRowLength) != 0)\r
+ {\r
showline("\n", 0);\r
showline("ERROR: Output error ", 1);\r
perrormod((outputfile != NULL) ? outputfile : "");\r
\r
// Have to flush filters in reverse order\r
#ifdef PSLEVEL2\r
- if (bLevel2) {\r
+ if (bLevel2)\r
+ {\r
if (bRunLengthFlag) RUNflushfilter(output); /* 96/Dec/24 */\r
#ifdef LZWCOMPRESSION\r
else if (bLZWFlag) LZWflushfilter(output); /* 96/Dec/28 */\r
} BITMAPFILEHEADER, FAR *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER;\r
#include <poppack.h>\r
\r
-typedef struct tagBITMAPINFOHEADER{\r
+typedef struct tagBITMAPINFOHEADER {\r
DWORD biSize;\r
LONG biWidth;\r
LONG biHeight;\r
\r
/* RGBQUAD colortable[256]; */\r
\r
-int dpifrom(int res) {\r
+int dpifrom(int res)\r
+{\r
double dres = (double) res * 25.4 / 1000.0;\r
dres = (double) ((int) (dres * 10.0 + 0.5)) / 10.0;\r
return (int) (dres + 0.5);\r
\r
/* readflag is non-zero in prescan */\r
\r
-int readBMPfields (FILE *input, int readflag) { \r
+int readBMPfields (FILE *input, int readflag)\r
+{\r
long nLen;\r
double dw, dh;\r
\r
OffBits = bmfh.bfOffBits;\r
/* "Offset to image %lu\n", bmih.bfOffBits */\r
#ifdef DEBUGBMP\r
- if (traceflag && sreadflag) {\r
+ if (traceflag && sreadflag)\r
+ {\r
sprintf(logline, "\nnLen %ld bfSize %ld bfOffBits %ld ",\r
nLen, bmfh.bfSize, bmfh.bfOffBits);\r
showline(logline, 1);\r
if (bmih.biSizeImage > 0) ImageSize = bmih.biSizeImage;\r
else ImageSize = nLen - OffBits;\r
#ifdef DEBUGBMP\r
- if (traceflag && readflag) {\r
+ if (traceflag && readflag)\r
+ {\r
sprintf(logline, "\nImage at %ld size %ld bytes ", OffBits, ImageSize);\r
showline(logline, 1);\r
}\r
return 0;\r
}\r
\r
-int readBMPPalette (FILE *input, long ColorMapPtr, int BitsPerSample) {\r
+int readBMPPalette (FILE *input, long ColorMapPtr, int BitsPerSample)\r
+{\r
long present;\r
int k, n, nint;\r
RGBQUAD rgb;\r
/* should make all these unsigned short int instead for NT */\r
\r
#ifdef USESHORTINT\r
- unsigned short int *PaletteRed; \r
+ unsigned short int *PaletteRed;\r
unsigned short int *PaletteGreen;\r
- unsigned short int *PaletteBlue; \r
+ unsigned short int *PaletteBlue;\r
#else\r
- unsigned int *PaletteRed; \r
- unsigned int *PaletteGreen; \r
- unsigned int *PaletteBlue; \r
+ unsigned int *PaletteRed;\r
+ unsigned int *PaletteGreen;\r
+ unsigned int *PaletteBlue;\r
#endif\r
\r
/* need three tables each of 2 ^ BitsPerSample integers */\r
showline(logline, 1);\r
}\r
#endif\r
- if (fseek (input, (long) ColorMapPtr, SEEK_SET) != 0) {\r
+ if (fseek (input, (long) ColorMapPtr, SEEK_SET) != 0)\r
+ {\r
sprintf(logline, " Error in seek %s\n", " to ColorMap\n");\r
showline(logline, 1);\r
}\r
/* readflag != 0 when prescanning to get fields */\r
\r
int readBMPfile (FILE *output, FILE *input,\r
- long dwidth, long dheight, int readflag) {\r
+ long dwidth, long dheight, int readflag)\r
+{\r
unsigned char *lpBuffer=NULL;\r
int i, flag;\r
int nLen;\r
else OutRowLength = BufferLength;\r
\r
#ifdef DEBUGBMP\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "InRowLength %ld BufferLength %ld OutRowLength %ld\n",\r
InRowLength, BufferLength, OutRowLength);\r
showline(logline, 1);\r
}\r
\r
#ifdef DEBUGBMP\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "Seeking to %ld\n", OffBits);\r
showline(logline, 1);\r
}\r
#endif\r
- if (fseek(input, (long) OffBits, SEEK_SET) != 0) {\r
+ if (fseek(input, (long) OffBits, SEEK_SET) != 0)\r
+ {\r
sprintf(logline, " Error in seek %s\n", " to OffBits\n");\r
showline(logline, 1);\r
return -1;\r
}\r
nLen = (int) ((BufferLength + 3) / 4) * 4;\r
lpBuffer = malloc(nLen);\r
- if (lpBuffer == NULL) { \r
+ if (lpBuffer == NULL)\r
+ {\r
sprintf(logline, " ERROR: Unable to allocate %d bytes\n", nLen);\r
showline(logline, 1);\r
checkexit(1);\r
flag = 0; /* flag gets set if EOF hit */\r
\r
#ifdef PSLEVEL2\r
- if (bLevel2) {\r
+ if (bLevel2)\r
+ {\r
ASCIIinitfilter(output); /* 96/Dec/20 */\r
if (bRunLengthFlag) RUNinitfilter(output); /* 96/Dec/24 */\r
#ifdef LZWCOMPRESSION\r
/* fills in TIFFOffset and PSOffset and MetaOffset and lengths */\r
/* returns zero if not an EPSF file */ /* file position is end of EPSF head */\r
\r
-int readepsfhead (FILE *special) {\r
+int readepsfhead (FILE *special)\r
+{\r
int c, d, e, f;\r
\r
PSOffset = 0; /* redundant */\r
int BMPflag=0; /* non-zero while processing BMP image */\r
\r
int readimagefilesub (FILE *output, FILE *special,\r
- long dwidth, long dheight, int nifd, int readflag) {\r
+ long dwidth, long dheight, int nifd, int readflag)\r
+{\r
/* long present; */\r
int c, d; \r
\r
showline(" ERROR: Zero TIFF offset or length\n", 1);\r
return -1;\r
}\r
- if (fseek(special, TIFFOffset, SEEK_SET) != 0) {\r
+ if (fseek(special, TIFFOffset, SEEK_SET) != 0)\r
+ {\r
sprintf(logline, " Error in seek %s\n", "to TIFFOffset\n");\r
showline(logline, 1);\r
return -1;\r
}\r
}\r
else {\r
- showline(" ERROR: Not a valid EPSF or TIFF file\n", 1); \r
+ showline(" ERROR: Not a valid EPSF or TIFF file\n", 1);\r
return -1;\r
}\r
} /* end of c > 128 (EPSF file) */\r
else if (c == 'M' && d == 'M') bLeastFirst = 0; /* Mac style TIFF file */\r
else if (c == 'B' && d == 'M') BMPflag = 1; /* BMP 98/Jun/28 */\r
else {\r
- showline(" ERROR: Not a valid EPSF, TIFF or BMP file\n", 1); \r
+ showline(" ERROR: Not a valid EPSF, TIFF or BMP file\n", 1);\r
return -1; /* not a TIFF subfile !!! */\r
}\r
\r
/* now have decided that this is a TIFF file (or TIFF preview) or BMP */\r
if (BMPflag)\r
(void) readBMPfile(output, special, dwidth, dheight, readflag);\r
- else \r
+ else\r
(void) readTIFFfile(output, special, dwidth, dheight, nifd, readflag);\r
return 0;\r
}\r
/* Returns -1 if file not found */\r
\r
int readimagefile (FILE *output, char *filename,\r
- long dwidth, long dheight, int nifd, int readflag) {\r
+ long dwidth, long dheight, int nifd, int readflag)\r
+{\r
/* char infilename[FILENAME_MAX]; */ /* make global */\r
FILE *special;\r
/* long present; */\r
return -1; \r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
- sprintf(logline, "\nManaged to open file %s\n", infilename); \r
+ if (traceflag)\r
+ {\r
+ sprintf(logline, "\nManaged to open file %s\n", infilename);\r
showline(logline, 0);\r
}\r
#endif\r
/* Expand palette color image into full RGB color image */\r
/* Presently only set up for 8 bit palettes ... !!! */\r
\r
-void expandcolor (unsigned char *lpBuffer, long width) {\r
+void expandcolor (unsigned char *lpBuffer, long width)\r
+{\r
int k, n, ns;\r
#ifdef USESHORTINT\r
unsigned short int *PaletteRed;\r
/* if (traceflag) printf("Palette Color => Color "); */\r
#endif\r
\r
- if (Palette == NULL) {\r
+ if (Palette == NULL)\r
+ {\r
showline(" ERROR: missing palette information\n", 1);\r
return;\r
}\r
/* This is called for BMP image when palette is used, but it is gray */\r
/* (i.e. R=G=B) and it is *not* linear (i.e. Palette[k] == k) */\r
\r
-void expandgray (unsigned char *lpBuffer, long width) {\r
+void expandgray (unsigned char *lpBuffer, long width)\r
+{\r
int k, n, ns;\r
#ifdef USESHORTINT\r
unsigned short int *PaletteRed;\r
/* if (traceflag) printf("Palette Gray => Gray "); */\r
#endif\r
\r
- if (Palette == NULL) {\r
+ if (Palette == NULL)\r
+ {\r
showline(" ERROR: missing palette information\n", 1);\r
return;\r
}\r
ns = (int) ImageWidth; /* samples per row */\r
\r
/* if (BufferLength <= InRowLength) */\r
- if (BufferLength <= InRowLengthX) {\r
+ if (BufferLength <= InRowLengthX)\r
+ {\r
showline(" ERROR: buffer overflow\n", 1);\r
return;\r
}\r
\r
/* gray = 0.3 * red + 0.59 * green + 0.11 * blue */\r
\r
- void compresscolor (unsigned char *lpBuffer, long width) {\r
+void compresscolor (unsigned char *lpBuffer, long width)\r
+{\r
int k, n;\r
unsigned char *s;\r
unsigned char *t;\r
\r
#ifdef PSLEVEL2\r
\r
-#pragma optimize ("lge", on) /* 2000 June 17 */\r
+//#pragma optimize ("lge", on) /* 2000 June 17 */\r
\r
/* use ASCII85Encode if bLevel2 enabled */\r
\r
/* nbytes is number of bytes accumulated, which is 4 until the last time */\r
/* Move this inline for speed ? */\r
\r
-void ASCIIlong (FILE *output, unsigned long n, int nbytes) {\r
+void ASCIIlong (FILE *output, unsigned long n, int nbytes)\r
+{\r
unsigned int c[5];\r
int k;\r
\r
/* Output single byte (accumulate until four seen, then call ASCIIlong) */\r
/* Move this inline for speed ? */\r
\r
-void ASCIIout (FILE *output, unsigned int x) {\r
+void ASCIIout (FILE *output, unsigned int x)\r
+{\r
// sprintf(logline, "ASCII %d ", x);\r
// showline(logline, 0); // debugging only\r
if (x > 255) x = x & 255; // sanity check ???\r
\r
/* initialize ASCII85 filter */\r
\r
-void ASCIIinitfilter (FILE *output) { /* 96/Dec/20 */\r
+void ASCIIinitfilter (FILE *output) /* 96/Dec/20 */\r
+{\r
// showline("ASCIIinitfilter ", 0); // debugging only\r
asciinum = 0;\r
asciicount = 0;\r
column = 0; /* ??? */\r
}\r
\r
-void RUNinitfilter (FILE *output) { /* 95/Dec/24 */\r
+void RUNinitfilter (FILE *output) /* 95/Dec/24 */\r
+{\r
/* apparently nothing special to do */\r
}\r
\r
/* flush out anything left in ASCII85 filter */\r
\r
-void ASCIIflushfilter (FILE *output) { /* 96/Dec/20 */\r
+void ASCIIflushfilter (FILE *output) /* 96/Dec/20 */\r
+{\r
int k;\r
// showline("ASCIIflushfilter ", 0); // debugging only\r
for (k = asciicount; k < 4; k++) {\r
asciicount = 0;\r
}\r
\r
-void RUNflushfilter (FILE *output) {\r
+void RUNflushfilter (FILE *output)\r
+{\r
ASCIIout(output, 128); /* EOD */\r
}\r
\r
\r
/* write a row in ASCII85 format */\r
\r
-void writearowASCII (FILE *output, unsigned char *s, unsigned long width) {\r
+void writearowASCII (FILE *output, unsigned char *s, unsigned long width)\r
+{\r
unsigned int c;\r
int k, n, i;\r
unsigned long num;\r
\r
/* Do run encoding per row (rather than image) --- easier, if not optimal */\r
\r
-void dumprun(FILE *output, int nlen, int previous) {\r
+void dumprun(FILE *output, int nlen, int previous)\r
+{\r
#ifdef DEBUGRUNLENGTH\r
int i;\r
if (nlen <= 0) {\r
ASCIIout(output, previous);\r
}\r
\r
-void dumpnonrun(FILE *output, int nlen, unsigned char *buffer) {\r
+void dumpnonrun(FILE *output, int nlen, unsigned char *buffer)\r
+{\r
int i;\r
unsigned char *s;\r
\r
/* Here (1) is the starting state */\r
/* Dumps out when (i) state changes (ii) 128 bytes seen (iii) end input */\r
\r
-void writearowrun (FILE *output, unsigned char *s, unsigned long width) {\r
+void writearowrun (FILE *output, unsigned char *s, unsigned long width)\r
+{\r
int runflag; /* non-zero if in accumulating run state */\r
int previous; /* character that appears to be repeating */\r
int repeat; /* how many times we have seen previous */\r
int nextnode; // code of next node to be used\r
int codelength; // how many bits needed for code at this stage 9, 10, 11, 12\r
\r
-void DeAllocStringsOut (void) { // called from dvibody() in dvipsone.c\r
+void DeAllocStringsOut (void) // called from dvibody() in dvipsone.c\r
+{\r
if (node != NULL) {\r
free(node);\r
node = NULL;\r
}\r
}\r
\r
-void CleanOut (FILE *output, int n) {\r
+void CleanOut (FILE *output, int n)\r
+{\r
int k;\r
\r
// sprintf(logline, "CLEANOUT %d\n", n);\r
codelength = 9; // reset code length now\r
}\r
\r
-int SetupNodes (FILE *output) {\r
+int SetupNodes (FILE *output)\r
+{\r
int nlen;\r
\r
if (node == NULL) {\r
\r
#ifdef IGNORED\r
// We are at node n and adding a new branch for byte chr -- NOT USED\r
-void AddaNode (FILE *output, int n, int chr, int previous) {\r
+void AddaNode (FILE *output, int n, int chr, int previous)\r
+{\r
int k, klast;\r
// if (nextnode < 0 || nextnode >= MAXCODES) showline("TABLE OVERFLOW", 1);\r
// Is there already a node at the next level ?\r
}\r
\r
#ifdef IGNORED\r
-void DoCleanup (FILE *output) { // not used - see LZWflushfilter\r
+void DoCleanup (FILE *output) // not used - see LZWflushfilter\r
+{\r
if (currentnode >= 0) LZWput(currentnode, output);\r
// LZWput(CLEAR, output);\r
// nextnode = FIRSTCODE;\r
/* may produce one or two bytes ready to spit out */\r
/* bitsused is always < 8 before and always < 8 after this */\r
\r
-void LZWput (int code, FILE *output) {\r
+void LZWput (int code, FILE *output)\r
+{\r
int c;\r
\r
// if (bitsused < 0 || bitsused >= 8) showline("ERROR ", 1);\r
#ifdef DEBUGLZWENCODE\r
- if (debugflag) {\r
+ if (debugflag)\r
+ {\r
if (code >= (1 << codelength))\r
sprintf(logline, "code %d too long for code length %d\n",\r
code, codelength);\r
bitsused = 0;\r
}\r
\r
-void LZWputflush (FILE *output) {\r
+void LZWputflush (FILE *output)\r
+{\r
int c;\r
// showline("LZWputflush ", 0); // debugging only\r
if (bitsused == 0) return; /* nothing left to push out */\r
/* bitsused = 0; */\r
}\r
\r
-void LZWinitfilter (FILE *output) { /* initialization */\r
+void LZWinitfilter (FILE *output) /* initialization */\r
+{\r
// showline("LZWinitfilter ", 0); // debugging only\r
LZWputinit(output);\r
// LZWput(CLEAR, output); /* write CLEAR */\r
/* codelength = 9; */\r
}\r
\r
-void LZWflushfilter (FILE *output) { /* termination */\r
+void LZWflushfilter (FILE *output) /* termination */\r
+{\r
// showline("LZWflushfilter ", 0); // debugging only\r
if (currentnode >= 0) {\r
LZWput(currentnode, output);\r
/* int code; */ /* code of the string matched so far to input */\r
/* int last; */ /* last character of input string */\r
\r
-int writearowLZW (FILE *output, unsigned char *s, unsigned long width) {\r
+int writearowLZW (FILE *output, unsigned char *s, unsigned long width)\r
+{\r
unsigned char *send = s + width;\r
\r
/* This picks up unfinished business --- currentnode >= 0 */\r
\r
/*************************************************************************/\r
\r
-#pragma optimize ("lge", off)\r
+//#pragma optimize ("lge", off)\r
\r
#endif /* end of ifdef PSLEVEL2 */\r
\r
/* write row in hex format */\r
\r
-void writearowhex (FILE *output, unsigned char *s, unsigned long width) {\r
+void writearowhex (FILE *output, unsigned char *s, unsigned long width)\r
+{\r
unsigned int c, d;\r
int k, n;\r
\r
\r
/* returns -1 if output error */ /* write a row of data in hex */\r
\r
-int writearow (FILE *output, unsigned char *s, unsigned long width) {\r
+int writearow (FILE *output, unsigned char *s, unsigned long width)\r
+{\r
#ifdef PSLEVEL2\r
if (bLevel2) {\r
if (bRunLengthFlag) writearowrun(output, s, width);\r
#endif\r
\r
// if (ferror(output)) \r
- if (output != NULL && ferror(output)) {\r
+ if (output != NULL && ferror(output))\r
+ {\r
showline(" ERROR: Output error\n", 1);\r
perrormod((outputfile != NULL) ? outputfile : "");\r
return -1;\r
}\r
}\r
/* if (verboseflag && PhotometricInterpretation > 3) {\r
- printf("Photometricinterpretation %d\n", PhotometricInterpretation); \r
+ printf("Photometricinterpretation %d\n", PhotometricInterpretation);\r
} */\r
/* 0 => 0 will be white and 2^n-1 black */\r
/* 1 => 0 will be black and 2^n-1 white (default) */\r
showline(" ERROR: Palette Color Image must have Palette!\n", 1);\r
return -1;\r
}\r
- if (PhotometricInterpretation == 2) {\r
+ if (PhotometricInterpretation == 2)\r
+ {\r
/* if (SamplesPerPixel == 1) */\r
- if (SamplesPerPixelX == 1) {\r
+ if (SamplesPerPixelX == 1)\r
+ {\r
sprintf(logline, " %s, but not more than one sample per pixel?\n", "RGB");\r
showline(logline, 1);\r
}\r
- if (! bAllowColor) {\r
+ if (! bAllowColor)\r
+ {\r
sprintf(logline, " WARNING: %s color image (%d) use `*c' flag?", "RGB", SamplesPerPixel);\r
// showline(logline, 1);\r
showline(logline, 0);\r
}\r
if (PhotometricInterpretation == 5) { // 2000 May 27\r
/* if (SamplesPerPixel == 1) */\r
- if (SamplesPerPixelX == 1) {\r
+ if (SamplesPerPixelX == 1)\r
+ {\r
sprintf(logline, " %s, but not more than one sample per pixel?\n", "CMYK");\r
showline(logline, 1);\r
}\r
- if (! bAllowColor) {\r
+ if (! bAllowColor)\r
+ {\r
sprintf(logline, " WARNING: %s color image (%d) use `*c' flag?", "CMYK", SamplesPerPixel);\r
// showline(logline, 1);\r
showline(logline, 0);\r
/* 0 => 0 will be white and 2^n-1 black */\r
/* 1 => 0 will be black and 2^n-1 white (default) */\r
\r
- if (PhotometricInterpretation == 0) {\r
+ if (PhotometricInterpretation == 0)\r
+ {\r
#ifdef DEBUGTIFF\r
if (traceflag) showline("Image grey levels will be inverted\n", 0); \r
#endif\r
else bInvertImage = 0;\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "ExpandColor %d CompressColor %d InvertImage %d\n",\r
bExpandColor, bCompressColor, bInvertImage);\r
showline(logline, 0);\r
bytes = (int) OutRowLength; /* ever used ? */\r
#ifdef DEBUGTIFF\r
if (traceflag) {\r
- sprintf(logline, "%d bytes per row\n", bytes); \r
+ sprintf(logline, "%d bytes per row\n", bytes);\r
showline(logline, 0);\r
}\r
#endif\r
\r
/* compress some of this code into DVIPREAM.PS ? */\r
\r
-void writepsheader (FILE *output, long dwidth, long dheight) {\r
+void writepsheader (FILE *output, long dwidth, long dheight)\r
+{\r
int bits=1; /* bits per pixel in image */\r
int samples=3; /* samples per pixel 96/July/7 */\r
int bMonoChrome=0; /* if need to use image mask */\r
long YOffset;\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) showline("Now writing out header information\n", 0); \r
+ if (traceflag) showline("Now writing out header information\n", 0);\r
#endif\r
/* if (BitsPerSample == 1) bMonoChrome = 1; */ /* use image mask */\r
\r
if (bExpandColor) samples = 3;\r
else if (bExpandGray) samples = 1;\r
/* else samples = SamplesPerPixel; */ /* 96/July/7 */\r
- else samples = SamplesPerPixelX; \r
+ else samples = SamplesPerPixelX;\r
\r
// fprintf(output, "\nsave\n");\r
// putc('\n', output);\r
/* image data must follow right away */\r
}\r
\r
-void writepstrailer (FILE *output) {\r
+void writepstrailer (FILE *output)\r
+{\r
#ifdef DEBUGTIFF\r
- if (traceflag) showline("Now writing trailer\n", 0); \r
+ if (traceflag) showline("Now writing trailer\n", 0);\r
#endif\r
-/* if (BitsPerSample == 1) { \r
+/* if (BitsPerSample == 1) {\r
if (bTextColor) fprintf(output, "%lg %lg %lg rgb\n",\r
Textred, Textgreen, Textblue);\r
else if(bFigureColor) fputs("black\n");\r
/* Read a row using PACK_BITS compression scheme */\r
/* returns non-zero if problems encountered */\r
\r
-int readpackbits (unsigned char *lpBuffer, FILE *input, int RowLength) {\r
+int readpackbits (unsigned char *lpBuffer, FILE *input, int RowLength)\r
+{\r
unsigned char *u=lpBuffer;\r
int c, k, n, total=0, flag=0;\r
\r
\r
int bytex, bitsleft; /* input buffering in splitting bits */\r
\r
-int getbit (FILE *input) {\r
+int getbit (FILE *input)\r
+{\r
if (bitsleft-- <= 0) {\r
if ((bytex = getc(input)) == EOF) {\r
sprintf(logline, " Unexpected EOF (%s)\n", "getbit TIFF");\r
else return 0;\r
}\r
\r
-#pragma optimize ("lge", on)\r
+//#pragma optimize ("lge", on)\r
\r
/* It's the Huffman code stuff that wants to be not optimized */\r
\r
-#pragma optimize ("lge", off) \r
+//#pragma optimize ("lge", off)\r
\r
/* Actually commonmake may be OK with compiler optimizations ON */\r
\r
-int commonmake (FILE *input) { /* common black/white make up codes (7 zeros) */\r
+int commonmake (FILE *input) /* common black/white make up codes (7 zeros) */\r
+{\r
#ifdef DEBUGTIFF\r
if (traceflag) {\r
showline("commonmake entry ", 0);\r
\r
/* Compiler screws up the following code if optimizations turned on */\r
\r
-int whiterun (FILE *input) {\r
+int whiterun (FILE *input)\r
+{\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
showline("whiterun entry ", 0);\r
}\r
#endif\r
\r
/* Compiler screws up the following code if optimizations turned on */\r
\r
-int blackzero (FILE *input) { /* black run code starts with four zeros */\r
+int blackzero (FILE *input) /* black run code starts with four zeros */\r
+{\r
#ifdef DEBUGTIFF\r
- if (traceflag) showline (" blackzero entry ", 0); \r
+ if (traceflag) showline (" blackzero entry ", 0);\r
#endif\r
if (getbit(input)) { /* 00001 */\r
if (getbit(input)) { /* 000011 */\r
\r
/* blackrun may actually be OK with compiler optimizations turned on */\r
\r
-int blackrun (FILE *input) {\r
+int blackrun (FILE *input)\r
+{\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
showline ("blackrun entry ", 0);\r
}\r
#endif\r
return -1; /* error */\r
}\r
\r
-#pragma optimize ("lge", on) \r
+//#pragma optimize ("lge", on)\r
\r
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */\r
\r
/* FOLLOWING IS EXPERIMENT 97/OCT/21 */\r
\r
-#pragma optimize ("lge", off) \r
+//#pragma optimize ("lge", off)\r
\r
int index, bitinx; /* index into row of bytes and bits within them */\r
\r
\r
/* Following could be speeded up some ... */\r
\r
-int writewhite (unsigned char *lpBuffer, int run, int width) {\r
+int writewhite (unsigned char *lpBuffer, int run, int width)\r
+{\r
if (run == 0) return 0; /* nothing to do */\r
if (run < 0) return -1; /* hit invalid run */\r
total += run;\r
else return 0;\r
}\r
\r
-int writeblack (unsigned char *lpBuffer, int run, int width) {\r
+int writeblack (unsigned char *lpBuffer, int run, int width)\r
+{\r
if (run == 0) return 0; /* nothing to do */\r
if (run < 0) return -1; /* hit invalid run */\r
total += run;\r
\r
/* make width long ? */\r
\r
-int huffmanrow (unsigned char *lpBuffer, FILE *input, int width) { \r
+int huffmanrow (unsigned char *lpBuffer, FILE *input, int width)\r
+{\r
int k, bytes;\r
int run;\r
/* int total = 0; */ /* long total ? */\r
\r
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */\r
\r
-#pragma optimize ("lge", on) /* experiment 2000 June 17 */\r
+//#pragma optimize ("lge", on) /* experiment 2000 June 17 */\r
\r
/* Here is the code for LZW (compression scheme number 5) input side */\r
\r
\r
/* following is never called ? now called from dvipsone.c when exiting */\r
\r
-void DeAllocStringsIn (void) { /* remember to do this at end */\r
+void DeAllocStringsIn (void) /* remember to do this at end */\r
+{\r
/* if (Memory != NULL) {\r
free(Memory); Memory = NULL;\r
} */\r
\r
/* worry here about allocation in NT ? sizeof(int) */\r
\r
-int AllocStringsIn (void) { \r
-/* if (Memory == NULL) { \r
+int AllocStringsIn (void)\r
+{\r
+/* if (Memory == NULL) {\r
Memory = (char *) malloc(INIMEMORY);\r
- MemorySize = INIMEMORY; \r
+ MemorySize = INIMEMORY;\r
} */ /* memory for strings in string table */\r
if (StringByte == NULL) { /* allocate string table indeces */\r
StringByte = (char *) malloc(MAXCODES * sizeof(char));\r
return 0;\r
}\r
\r
-void InitializeStringTable (void) { /* set up string table initially */\r
+void InitializeStringTable (void) /* set up string table initially */\r
+{\r
int k;\r
\r
AllocStringsIn(); /* grab memory for tables if needed */\r
CodeLength = 9; /* initial code length */\r
}\r
\r
-void ResetStringTable (int quietflag) { /* clear string table */\r
+void ResetStringTable (int quietflag) /* clear string table */\r
+{\r
/* int k; */\r
\r
#ifdef DEBUGTIFF\r
- if (!quietflag) {\r
+ if (!quietflag)\r
+ {\r
if (traceflag) showline("CLEAR ", 0);\r
- if (traceflag) showline("\n", 0); \r
- if (traceflag && TableIndex > FIRSTCODE) {\r
+ if (traceflag) showline("\n", 0);\r
+ if (traceflag && TableIndex > FIRSTCODE)\r
+ {\r
/* printf("TableIndex %d FreeIndex %u CodeLength %d\n",\r
TableIndex, FreeIndex, CodeLength); */\r
sprintf(logline, "TableIndex %d CodeLength %d\n", TableIndex, CodeLength);\r
} \r
#endif\r
/* following not really needed */\r
-/* for (k = FIRSTCODE; k < TableIndex; k++) { \r
+/* for (k = FIRSTCODE; k < TableIndex; k++) {\r
StringTable[k] = 0;\r
StringLength[k] = 0;\r
} */\r
}\r
\r
#ifdef USESHORTINT\r
-void AddNewEntry (short int OldCode, short int Code) {\r
+void AddNewEntry (short int OldCode, short int Code)\r
+{\r
#else\r
-void AddNewEntry (int OldCode, int Code) {\r
+void AddNewEntry (int OldCode, int Code)\r
+{\r
#endif\r
/* char *s; */\r
/* char *t; */\r
/* int k; */\r
\r
#ifdef DEBUGLZW\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "Add string TableIndex %4d (%d)\n",\r
TableIndex, StringLength[OldCode] + 1);\r
showline(logline, 0);\r
StringPrevious[TableIndex] = OldCode;\r
#ifdef USESHORTINT\r
StringLength[TableIndex] =\r
- (unsigned short int) (StringLength[OldCode] + 1); \r
+ (unsigned short int) (StringLength[OldCode] + 1);\r
#else\r
StringLength[TableIndex] = StringLength[OldCode] + 1;\r
#endif\r
/* *s = *t; */ /* last byte comes from next code string */\r
/* FreeIndex += len; */\r
\r
- if (TableIndex == 511 || TableIndex == 1023 || TableIndex == 2047) {\r
+ if (TableIndex == 511 || TableIndex == 1023 || TableIndex == 2047)\r
+ {\r
CodeLength++;\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "LENGTH %d (%d)\n", TableIndex, CodeLength);\r
showline(logline, 0);\r
}\r
#endif\r
}\r
\r
- if (TableIndex > MAXCODES) {\r
+ if (TableIndex > MAXCODES)\r
+ {\r
showline(" ERROR: Table overflow\n", 1);\r
- checkexit(1); \r
+ checkexit(1);\r
}\r
-} \r
+}\r
\r
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */\r
\r
-int IsInTable (int Code) { /* is code already in table ? */\r
+int IsInTable (int Code) /* is code already in table ? */\r
+{\r
return (Code >= 0 && Code < TableIndex);\r
}\r
\r
/* copy string from table by code number */\r
\r
-unsigned char *WriteString (unsigned char *buffer, int Code) { \r
+unsigned char *WriteString (unsigned char *buffer, int Code)\r
+{\r
/* int k; */\r
int n, len=0;\r
unsigned char *s;\r
/* s = buffer; */\r
/* t = Memory + StringTable[Code]; */\r
// if (Code < TableIndex)\r
- len = StringLength[Code]; \r
+ len = StringLength[Code];\r
t = buffer + len; /* byte after last one to copy */\r
if (t > StripData + StripDataLen) {\r
/* special case kludge if terminates right after code length switch */\r
sprintf(logline, "Off by %d (len %d Code %d)\n", err, len, Code);\r
showline(logline, 1);\r
}\r
-/* s = buffer; \r
+/* s = buffer;\r
while (s < t) {\r
if (*s++ != 0) putc('1', stdout);\r
else putc('0', stdout);\r
int OldBitsLeft=0; /* how many bits left in OldByte */\r
\r
#ifdef USESHORTINT\r
-short int GetNextCode (FILE *input) { /* get next LZW code number from input */\r
+short int GetNextCode (FILE *input) /* get next LZW code number from input */\r
+{\r
#else\r
-int GetNextCode (FILE *input) { /* get next LZW code number from input */\r
+int GetNextCode (FILE *input) /* get next LZW code number from input */\r
+{\r
#endif\r
int bits;\r
int c;\r
\r
bits = OldBitsLeft; /* how many bits do we have */\r
k = OldByte; /* start with old bits */\r
- \r
+\r
while (bits < CodeLength) { /* need more bits ? */\r
if (InStripLen-- <= 0) { /* treat as EOD 96/Nov/17 */\r
if (traceflag) {\r
}\r
return EOD;\r
}\r
- if ((c = getc(input)) == EOF) { \r
+ if ((c = getc(input)) == EOF)\r
+ {\r
sprintf(logline, " Unexpected EOF (%s)\n", "getnextcode");\r
showline(logline, 1);\r
checkexit(1);\r
#endif\r
}\r
\r
-void LZWdecompress (unsigned char *StripData, FILE *input) {\r
+void LZWdecompress (unsigned char *StripData, FILE *input)\r
+{\r
#ifdef USESHORTINT\r
short int Code, OldCode;\r
#else\r
/* reset table for next one */\r
ResetStringTable(0);\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, "Now at byte %ld in file\n", ftell(input));\r
showline(logline, 0);\r
}\r
/* First one was already set up - don't disturb in case not indirect */\r
/* In practice, strips are usually contiguous, but no guarantee... */\r
\r
-long SetupStrip (FILE *input, int k) { /* 96/Nov/17 */\r
+long SetupStrip (FILE *input, int k) /* 96/Nov/17 */\r
+{\r
if (k > 0) {\r
StripOffset = indirectvalue(StripOffsetsType, 1,\r
StripOffsetsPtr + k * typesize[StripOffsetsType], input);\r
showline(logline, 0);\r
}\r
#endif\r
- if (fseek (input, StripOffset, SEEK_SET)) {\r
+ if (fseek (input, StripOffset, SEEK_SET))\r
+ {\r
showline("Error in seek to StripOffset", 1); /* ??? */\r
finish = -1;\r
return -1;\r
/* Copy a row from far space used by LZW to near space used for output */\r
\r
void CopyRow (unsigned char *lpBuffer, unsigned char *StripData,\r
- long InRowLength) { \r
+ long InRowLength)\r
+{\r
int k, n;\r
unsigned char *s=lpBuffer;\r
unsigned char *t=StripData;\r
/* A whole strip is treated as one unit for LZW encoding ... */\r
/* So need to do once per strip and need memory for strip output */\r
\r
-int DecodeLZW (FILE *output, FILE *input, unsigned char *lpBuffer) { \r
+int DecodeLZW (FILE *output, FILE *input, unsigned char *lpBuffer)\r
+{\r
int k, row = 0, i, j, n, m, flag = 0;\r
/* unsigned char *StripData; */\r
long nlen;\r
/* x * (numer / denom) 1995/Oct/12 */\r
/* or use MulDiv ??? */\r
\r
-long MulRatio (long x, unsigned long numer, unsigned long denom) {\r
+long MulRatio (long x, unsigned long numer, unsigned long denom)\r
+{\r
long result;\r
if (denom == 0 || numer == 0) return 0;\r
if ((numer % denom) == 0) {\r
/* if dheight == 0 => calculate dheight from dwidth based on aspect ratio */\r
\r
int showtiffhere (FILE *output, char *filename, long dwidth, long dheight,\r
- double xscale, double yscale, int nifd) {\r
+ double xscale, double yscale, int nifd)\r
+{\r
int flag;\r
if (bTIFFAllow != 0) {\r
/* if (dheight == 0) { */ /* need aspect ratio from TIFF file */\r
\r
/* made common to save string space */\r
\r
-void dontunderline (void) {\r
+void dontunderline (void)\r
+{\r
// showline(" ERROR: don't understand ", 1);\r
// showline(line, 1);\r
sprintf(logline, " ERROR: don't understand: %s", line);\r
/* char *badcharinname=" \t\n\r\f()<>[]{}/%"; */\r
char *badcharinname=" \b\t\n\f\r()<>[]{}/%";\r
\r
-void cleanupname (char *name) {\r
+void cleanupname (char *name)\r
+{\r
char *s;\r
#ifdef DEBUGCLEANUP\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, " CLEANUPNAME: %s", name); /* debugging */\r
showline(logline, 0);\r
}\r
#endif\r
- if (*name == '\0') {\r
+ if (*name == '\0')\r
+ {\r
showline(" ERROR: empty mark or button", 1);\r
}\r
s = name;\r
strcpy(s, s+1);\r
if (strlen(name) > MAXPSNAME) *(name+MAXPSNAME) = '\0'; /* 96/Aug/12 */\r
#ifdef DEBUGCLEANUP\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, " CLEANEXIT: %s", name); /* debugging */\r
showline(logline, 0);\r
}\r
\r
/* support for old textcolor / rulecolor specials */\r
\r
-int oldcolor (FILE *output, FILE *input) {\r
+int oldcolor (FILE *output, FILE *input)\r
+{\r
char *s;\r
int n;\r
/* old text color support */\r
\r
/* new to allow quoted file names with spaces 98/Jul/9 */\r
\r
-char *scaninsert(char *line, char *filename) {\r
+char *scaninsert(char *line, char *filename)\r
+{\r
char *s = line;\r
char *t = filename;\r
\r
\r
/* returns zero if *not* one of our DVIWindo \specials */\r
\r
-int newspecials (FILE *output, FILE *input) {\r
+int newspecials (FILE *output, FILE *input)\r
+{\r
int nifd=1;\r
long dheight, dwidth;\r
char filename[FILENAME_MAX];\r
double xscale, yscale;\r
\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, " %s:", line);\r
showline(logline, 0);\r
}\r
#endif\r
\r
/* insert TIFF or BMP image */\r
- if (strcmp(line, "insertimage") == 0) {\r
+ if (strcmp(line, "insertimage") == 0)\r
+ {\r
/* (void) scanspecial (input, line, MAXLINE); */\r
(void) scanspecialraw (input, line, MAXLINE);\r
#ifdef DEBUGTIFF\r
- if (traceflag) {\r
+ if (traceflag)\r
+ {\r
sprintf(logline, " %s ", line);\r
showline(logline, 0);\r
}\r
#endif\r
nifd = 1; /* n-th (sub-)image in TIFF file */\r
- dwidth = dheight = 0; /* NEW - use all info from file */ \r
+ dwidth = dheight = 0; /* NEW - use all info from file */\r
xscale = yscale = 0.0; /* 99/July/2 */\r
/* if (sscanf(line, "%s %ld %ld %d", filename, &dwidth, &dheight, &nifd) */\r
s = scaninsert(line, filename);\r
- if ((t = strstr(s, "scaled")) == NULL) {\r
+ if ((t = strstr(s, "scaled")) == NULL)\r
+ {\r
sscanf(s, "%ld %ld %d", &dwidth, &dheight, &nifd); /* normal */\r
}\r
else { /* new case 99/July/2 */\r
return 1; /* we recognize it, but ignore it */\r
}\r
#ifdef DEBUGTIFF\r
- else if (traceflag) showline(line, 1); \r
+ else if (traceflag) showline(line, 1);\r
#endif\r
return 0; /* not a DVIWindo special */\r
}\r
rclip=0.000000 tclip=0.000000 nostrip */\r
/* New stuff for HPTAG */ /* 95/Oct/12 */\r
\r
-int dohptag (FILE *output, FILE *input) {\r
+int dohptag (FILE *output, FILE *input)\r
+{\r
/* double bclip=0, lclip=0, rclip=0, tclip=0; */\r
/* int hleft=1, hright=0, vhigh=1, vlow=0; */\r
/* double xmag=1, ymag=1; */\r
/* int nostrip=1; */\r
char *s, *t;\r
- char filename[FILENAME_MAX]; \r
+ char filename[FILENAME_MAX];\r
\r
(void) scanspecial (input, line, MAXLINE);\r
if ((s = strchr(line, ' ')) != NULL) *s = '\0';\r
# Copyright 2007 TeX Users Group
+# Copyright 2014 Clerk Ma
# You may freely use, modify and/or distribute this file.
# Makefile for DVIPSONE
# Copyright 2007 TeX Users Group
+# Copyright 2014 Clerk Ma
# You may freely use, modify and/or distribute this file.
# Makefile for DVIPSONE