OSDN Git Service

code cleaned.
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Thu, 3 Apr 2014 17:22:36 +0000 (01:22 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Thu, 3 Apr 2014 17:22:36 +0000 (01:22 +0800)
src/dvisourc/dviextra.c
src/dvisourc/dvipslog.c
src/dvisourc/dvipsone.c
src/dvisourc/dvispeci.c
src/dvisourc/dvitiff.c
src/dvisourc/makedll
src/dvisourc/makefile

index 8ff3c00..043d4f9 100644 (file)
@@ -4802,8 +4802,9 @@ int fontremapsub (char *font)
 /* 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];
@@ -4811,7 +4812,8 @@ int fontremap (char *font) {  /* expects lower case fontname  */
   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 &&
@@ -4827,19 +4829,21 @@ int fontremap (char *font) {  /* expects lower case fontname  */
 //    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 */
@@ -4858,8 +4862,9 @@ int forcedsubstitute (char *font) { /* expects lower case fontname  */
 } 
 
 /*  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;
@@ -4875,8 +4880,9 @@ int checksynthetic (char *font) { /* expects lower case fontname  */
 } 
 
 /*  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];
@@ -4912,8 +4918,9 @@ void replacealias (void) {    /* replace aliases with real names */
 }
 
 /*  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;
@@ -4954,7 +4961,8 @@ void replacetexfontsmap (void) {    /* replace aliases with real names */
 
 /* 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;
 
@@ -4985,7 +4993,8 @@ int readaline (char *line, FILE *input) {
 
 /* 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 */
@@ -5093,7 +5102,9 @@ int FindMMBaseFile (int k) {
 /* 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 */
@@ -5109,7 +5120,8 @@ int AddMMBase (int m) {     /* add the corresponding MM base 94/Dec/6 */
   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) { 
@@ -5161,7 +5173,8 @@ int AddMMBase (int m) {     /* add the corresponding MM base 94/Dec/6 */
   }   
 
 #ifdef DEBUG
-  if (traceflag) {
+  if (traceflag)
+  {
     sprintf(logline, "Need to construct new MM base entry %s\n", psfontname);
     showline(logline, 0);
   }
@@ -5183,12 +5196,13 @@ int AddMMBase (int m) {     /* add the corresponding MM base 94/Dec/6 */
 /*  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 ... */
@@ -5215,7 +5229,8 @@ int AddMMBase (int m) {     /* add the corresponding MM base 94/Dec/6 */
   }
   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);
@@ -5231,10 +5246,12 @@ int AddMMBase (int m) {     /* add the corresponding MM base 94/Dec/6 */
 /* 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);
   }
@@ -5265,16 +5282,17 @@ definefont pop */
 /* 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 */
@@ -5282,7 +5300,8 @@ int AddMMFontName (FILE *input, int k, int pssflag, char *FileName, int nlen) {
     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;
@@ -5341,7 +5360,8 @@ int notvalidPSS (int pssflag) { /* PSS or PFM file */
 
 /* 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];
@@ -5611,7 +5631,8 @@ void checksubstitute (void) {
 /* 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 */
@@ -5672,7 +5693,9 @@ FILE *OpenFontsub (char *subfile) {
   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 */
@@ -5687,7 +5710,9 @@ int charneeded (char *wantchrs) {   /* see whether font actually used */
 
 /* 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 */
@@ -5704,7 +5729,8 @@ int GetSubstitutes (void) {       /* return value not used ? */
 /*      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 */
@@ -5713,7 +5739,8 @@ int GetSubstitutes (void) {       /* return value not used ? */
 /*        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",
@@ -5740,14 +5767,16 @@ int GetSubstitutes (void) {       /* return value not used ? */
 /*    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",
@@ -5761,19 +5790,23 @@ int GetSubstitutes (void) {       /* return value not used ? */
 /*    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 */
@@ -5782,14 +5815,16 @@ int markunusedfonts0 (void) {     /* separated out 94/Oct/5 */
       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];
@@ -5829,8 +5864,10 @@ void preextract (void) { /* get font tables straightened out first */
 
 /*  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 */
@@ -5860,7 +5897,8 @@ void preextract (void) { /* get font tables straightened out first */
         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);
@@ -5883,25 +5921,31 @@ void preextract (void) { /* get font tables straightened out first */
 
 /* 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);
@@ -5920,7 +5964,8 @@ void constructvectors(FILE *fp_out) {
 
 /* 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) {
@@ -5938,7 +5983,8 @@ int fontreside (int f) {              /* 1995/July/5 */
 /* 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;
@@ -5947,12 +5993,12 @@ void dofont (FILE *fp_out, int f, int fn) {
   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]);
@@ -6139,7 +6185,8 @@ void dofont (FILE *fp_out, int f, int fn) {
 
 /* 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];
 
@@ -6163,8 +6210,8 @@ int replacename (char *line, char *fname) {
 
 /* 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]; */
@@ -6181,10 +6228,10 @@ int copyPSS_sub(FILE *output, FILE *input, char *fname, char *bname,
     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 */
@@ -6194,7 +6241,7 @@ int copyPSS_sub(FILE *output, FILE *input, char *fname, char *bname,
 /*  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);
@@ -6250,7 +6297,8 @@ int copyPSS_sub(FILE *output, FILE *input, char *fname, char *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;
@@ -6314,7 +6362,8 @@ int copyPSS(FILE *fp_out, FILE *fp_in, int k) {
   return flag;
 }
 
-int IsItUsed (char *wantchrs) {
+int IsItUsed (char *wantchrs)
+{
   int k;
   if (wantchrs == NULL) return 0;
 /*  test in decreasing order of expected use */
@@ -6329,7 +6378,8 @@ int IsItUsed (char *wantchrs) {
 
 /* 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];
@@ -6368,7 +6418,8 @@ int MarkUnusedFonts (void) {        /* an experiment 95/Mar/5 */
 
 /* 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 */
@@ -6475,7 +6526,8 @@ int extractafont (FILE *fp_out, int k) {
 /* 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; */
@@ -6515,7 +6567,8 @@ int extractfonts (FILE *fp_out) { /* was called by main */
   
 /*  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 ? */
@@ -6555,7 +6608,8 @@ int extractfonts (FILE *fp_out) { /* was called by main */
     
 /* 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;
@@ -6882,17 +6936,19 @@ void fontsetup (FILE *fp_out) {
 /*  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);
   }
@@ -6904,7 +6960,7 @@ int ResidentFont (char *FileName) {       /* 1994/Feb/10 */
   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
index 00c5a2b..ce295fe 100644 (file)
@@ -86,15 +86,16 @@ long pageno;  /* for convenience in error messages - may be logical page */
 
 /* 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); */
@@ -110,18 +111,21 @@ void check_stack(int pageno) {
   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);
@@ -139,7 +143,8 @@ static unsigned long ureadfour (FILE *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); */
@@ -150,10 +155,11 @@ static int sreadtwo (FILE *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;
 }
 
@@ -164,7 +170,8 @@ static int sreadtwo (FILE *input) {     /* experiment 98/Feb/7 */
   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);
@@ -181,7 +188,8 @@ COLORSPEC **ColorStacks=NULL; /* array of saved color stacks, one per page */
 /*  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 */
@@ -195,7 +203,8 @@ void RestoreColorStack (int page) {
   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);
@@ -204,7 +213,8 @@ void RestoreColorStack (int page) {
   }
   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);
@@ -223,7 +233,8 @@ void RestoreColorStack (int page) {
 /*  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; */
@@ -238,7 +249,8 @@ void SaveColorStack (int page, int colorindex) {
 /*    free(lpColor[page]); */
   }
 #ifdef DEBUGCOLORSTACK
-  if (traceflag) {
+  if (traceflag)
+  {
     sprintf(logline, " SaveColorStack page %d colorindex %d\n",
         page, colorindex);
     showline(logline, 0);
@@ -257,7 +269,8 @@ void SaveColorStack (int page, int colorindex) {
 
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
 
-void logdo_push(void) {
+void logdo_push(void)
+{
   if (skipflag == 0) {
     stinx++;
     if (stinx > maxstinx) maxstinx = stinx;
@@ -268,10 +281,13 @@ void logdo_push(void) {
   }
 }
 
-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 */
@@ -284,7 +300,8 @@ void logdo_pop(void) {
 
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
 
-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);
@@ -294,7 +311,8 @@ void invalidset(int c) {
 
 /* 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);
@@ -322,7 +340,8 @@ void logdo_setsub(unsigned long 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);
@@ -352,12 +371,14 @@ void logdo_set1(FILE *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) {
@@ -385,11 +406,13 @@ void logdo_set2(FILE *infile) {
 }
 #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));
 }
 
@@ -397,8 +420,10 @@ void logdo_set4(FILE *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) {
@@ -424,7 +449,8 @@ void logdo_putsub(unsigned long c) {
 
 /* 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);
@@ -454,12 +480,14 @@ void logdo_put1(FILE *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) {
@@ -487,20 +515,24 @@ void logdo_put2(FILE *infile) {
 }
 #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);
 }
@@ -514,7 +546,8 @@ int pagesequence;   /* count of ascending page sequence */
 
 /* 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; */
@@ -554,7 +587,8 @@ int skipthispage(long pageno) {
   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;       /* ??? */
 
@@ -622,121 +656,150 @@ void logdo_eop(FILE *infile) { /* end of page */
   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];
@@ -745,8 +808,7 @@ void logswitchfont(int fn, FILE *infile) { /* switching to other font */
     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; */
@@ -767,7 +829,8 @@ void logswitchfont(int fn, FILE *infile) { /* switching to other font */
   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);
@@ -775,7 +838,8 @@ void logdo_fnt1(FILE *infile) { /* switch fonts */
   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) */
@@ -783,19 +847,22 @@ void logdo_fnt2(FILE *infile) { /* switch fonts */
   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) */
@@ -805,7 +872,8 @@ void logdo_fnt4(FILE *infile) { /* switch fonts */
 
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
 
-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;
 
@@ -863,7 +931,8 @@ void getheadername (FILE *infile) { /* new version 95/Aug/30 */
 
 /* 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) {
@@ -883,7 +952,8 @@ void getcustomname (FILE *infile) {
 
 /* 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;
@@ -899,7 +969,7 @@ void getcustomname (FILE *infile) {
 /*    errcount(0); */
 /*    return; */
     checkexit(1);             /* 1995/July/15 */
-//    more serious exit(1) ??? 
+//    more serious exit(1) ???
   }
   headertext = headernew;
   u = headernew + headertextlen;
@@ -910,7 +980,8 @@ void getcustomname (FILE *infile) {
 
 /* 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;
@@ -931,7 +1002,8 @@ void getcommandspec (FILE *infile) {    // 99/Sept/6
 
 /* 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;
@@ -963,7 +1035,8 @@ void getcustomtext (FILE *infile) {     /* new 1995/July/15 */
   *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);
@@ -981,7 +1054,8 @@ void getbbox (FILE *infile) {   /* Use for CropBox pdfmark not tested */
 
 /* 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;
@@ -1019,7 +1093,8 @@ void getkeywords (FILE *infile) {     /* 1996/May/10 */
 }
 
 // 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) {
@@ -1035,42 +1110,48 @@ char *getcommonstring (FILE *infile) {
 
 // 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);
@@ -1079,7 +1160,8 @@ void getpagemode (FILE *infile) {
 
 /* 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));
@@ -1093,13 +1175,15 @@ int bComplainSpecial=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;
   }
@@ -1109,7 +1193,8 @@ void DoBackGround (FILE *infile, int c) {
   *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);
   }
@@ -1120,15 +1205,18 @@ void DoBackGround (FILE *infile, int c) {
   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;
     }
@@ -1181,7 +1269,8 @@ void DoBackGround (FILE *infile, int c) {
     return;
   }
 
-  if (traceflag) {
+  if (traceflag)
+  {
     sprintf(logline, " PAGENUMBER %d (%d %d) ", pagenumber, dvi_t, MaxColor);
     showline(logline, 0);
   }
@@ -1193,7 +1282,8 @@ void DoBackGround (FILE *infile, int c) {
     return;
   }
 
-  if (traceflag) {
+  if (traceflag)
+  {
     sprintf(logline, "\npage %d %g %g %g %g\n",
          pagenumber, CurrColor.A, CurrColor.B, CurrColor.C,
          CurrColor.D);
@@ -1226,11 +1316,13 @@ char *tpiccommands = "pa fp ip da dt sp pn ar ia sh wh bk tx";
 /* 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;
   }
@@ -1321,43 +1413,50 @@ void logdo_com (FILE *infile) {
   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) */
@@ -1445,32 +1544,37 @@ void logfnt_def(FILE *infile, unsigned int k) {
   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;
@@ -1479,19 +1583,22 @@ void logdo_fnt_def4(FILE *infile) { /* define font */
 
 /* 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);
@@ -1510,18 +1617,20 @@ void logdo_pre(FILE *infile) {
     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); */
   }
@@ -1536,14 +1645,16 @@ void logdo_pre(FILE *infile) {
 
 /* 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);
@@ -1566,7 +1677,8 @@ void logdo_post(FILE *infile) {
 
 /* 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;    */
 
@@ -1588,7 +1700,8 @@ void logdo_post_post(FILE *infile) { /* only in reverse ? */
 /* 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);
@@ -1615,7 +1728,8 @@ int readovertext(FILE *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; */
@@ -1628,15 +1742,18 @@ void resetpagerangehit (int flag) {
 
 /***************************************************************************/
 
-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);
   }
@@ -1652,7 +1769,8 @@ void alloccolorsave (int npages) {
   MaxColor = npages+1;      /* make note of size of allocation */
 }
 
-void freecolorsave (void) {
+void freecolorsave (void)
+{
   int k, npages = MaxColor;
   
   if (ColorStacks == NULL) return;
@@ -1672,11 +1790,13 @@ void freecolorsave (void) {
 }
 
 #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;
   }
@@ -1704,7 +1824,8 @@ void dumpcolorsave (void) {     /* debugging only */
 }
 #endif
 
-void allocbackground (int npages) {
+void allocbackground (int npages)
+{
   int k;
   if (BackColors != NULL) {
     showline(" ERROR: background allocation\n", 1);
@@ -1732,7 +1853,8 @@ void freebackground (void) {
 
 /***************************************************************************/
 
-int scanlogfileaux(FILE *fp_in) {
+int scanlogfileaux(FILE *fp_in)
+{
   int c, k, fn;
 /*  long filptr; */
 
@@ -1758,7 +1880,8 @@ int scanlogfileaux(FILE *fp_in) {
   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);
@@ -1925,7 +2048,8 @@ int scanlogfileaux(FILE *fp_in) {
 
 /* 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 */
 
@@ -1935,7 +2059,8 @@ int scanlogfile (FILE *fp_in) {
   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);
@@ -1970,23 +2095,26 @@ typedef struct map_element_struct {   /* list element key . value pair */
   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? */
@@ -1999,7 +2127,8 @@ static void *xrealloc (void *old_ptr, unsigned int size) {
   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);
 }
@@ -2013,7 +2142,8 @@ static char *xstrdup (char *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;
@@ -2059,7 +2189,8 @@ static void *xcalloc (unsigned int nelem, unsigned int elsize) {
 
 #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;
@@ -2093,7 +2224,8 @@ static char *read_line (FILE *f) {
 
 /* 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
@@ -2111,7 +2243,8 @@ static unsigned int map_hash (char *key) {
 
 /* 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;
   
@@ -2140,7 +2273,8 @@ static char *map_lookup_str (map_type map, char *key) {
 }
 
 #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;
   
@@ -2163,7 +2297,8 @@ static void map_show (map_type map) { /* debugging tool */
 /* 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; */
   
@@ -2184,12 +2319,13 @@ char *map_lookup (map_type map, char *key) {
 /* 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));
@@ -2210,7 +2346,8 @@ static void map_insert (map_type map, char *key, char *value) {
    `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;
@@ -2290,7 +2427,8 @@ static void map_file_parse (map_type map, char *map_filename) {
    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
@@ -2329,7 +2467,8 @@ void oursearchenv (char *mapname, char *searchpath, char *pathname) {
 /* 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;
       
@@ -2364,7 +2503,8 @@ map_type fontmap = NULL;      /* static - keep around once set */
 
 /*  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;
       
@@ -2402,7 +2542,8 @@ char *alias (char *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;
 
@@ -2478,7 +2619,8 @@ char *nextpathname(char *pathname, char *searchpath) {
 /*  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;
@@ -2622,8 +2764,9 @@ int findsubpath (char *filename, char *pathname, int recurse) {
 /* 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;
@@ -2734,8 +2877,8 @@ int searchalongpath (char *filename, char *pathlist, char *pathname, int current
 /*  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) {
@@ -2759,14 +2902,15 @@ FILE *findandopen (char *filename, char *pathlist, char *pathname,
 
 /* 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);
@@ -2803,7 +2947,8 @@ int readafm(char *font, FILE *fp_afm, long widths[]) {
 
 /* 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;
@@ -2839,7 +2984,7 @@ int readtfm(char *font, FILE *fp_tfm, long widths[]) {
   (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);
@@ -2879,7 +3024,8 @@ int readtfm(char *font, FILE *fp_tfm, long widths[]) {
 
 /* 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;
@@ -2887,7 +3033,8 @@ int readpfm(char *font, FILE *fp_pfm, long widths[]) {
 
 /*  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);
@@ -2945,7 +3092,8 @@ int readpfm(char *font, FILE *fp_pfm, long widths[]) {
 
 /* 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;
@@ -3115,7 +3263,8 @@ int NamesFromPFM (FILE *input, char *FaceName, int nface,
 
 /* 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);
@@ -3123,7 +3272,8 @@ unsigned int xreadtwo (FILE *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);
@@ -3142,7 +3292,8 @@ int bATM41=0;     // needs to be set based on ATMREG.ATM header
 /* 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;
@@ -3205,7 +3356,8 @@ char **DirPaths=NULL;
 
 int dirindex=0;
 
-void FreeDirs (void) {
+void FreeDirs (void)
+{
   int k;
   if (DirPaths == NULL) return;
   for (k = 0; k <= nDirs; k++) {
@@ -3217,7 +3369,8 @@ void FreeDirs (void) {
   DirPaths = NULL;
 }
 
-int AllocDirs (int nDirs) {
+int AllocDirs (int nDirs)
+{
   int k, nlen;
   if (DirPaths != NULL) FreeDirs();
   nlen = (nDirs + 1) * sizeof(char *);
@@ -3234,7 +3387,8 @@ int AllocDirs (int nDirs) {
   return 0;
 }
 
-void FreeFonts (void) {
+void FreeFonts (void)
+{
   int k;
   if (ATMFonts == NULL) return;
   for (k = 0; k < ATMfontindex; k++) {
@@ -3247,7 +3401,8 @@ void FreeFonts (void) {
   ATMFonts = NULL;
 }
 
-int AllocFonts (int nFonts) {
+int AllocFonts (int nFonts)
+{
   int nlen;
   if (ATMFonts != NULL) FreeFonts();
   nlen = nFonts * sizeof(struct ATMRegRec);
@@ -3265,7 +3420,8 @@ int AllocFonts (int nFonts) {
   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);
@@ -3289,7 +3445,8 @@ void ShowATMREG (void) {
 
 /**********************************************************************************/
 
-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;
@@ -3375,7 +3532,8 @@ int SetupDirs (FILE *input, unsigned long startdirlist, unsigned long enddirlist
 
 #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;
@@ -3502,7 +3660,8 @@ donext:     /* 1999/Mar/1 */
 /* 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) {
@@ -3517,7 +3676,8 @@ int SearchATMReg (char *szPSFontName, char *szPFBFileName) {
 
 /* 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;
@@ -3645,7 +3805,8 @@ donext:     /* 1999/Mar/1 */
 /* 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 */
@@ -3673,7 +3834,8 @@ unsigned long ReadPointers (FILE *input) {
   return endfontlist;
 }
 
-int SetupATMReg (void) {
+int SetupATMReg (void)
+{
   char szFullFileName[FNAMELEN]="";
 
   if (useatmreg == 0) return -1;    /* tried already and failed */
@@ -3694,7 +3856,8 @@ int SetupATMReg (void) {
 
 // LOAD information from ATMREG.ATM in convenient form 2000 July 6 
 
-int LoadATMREG (void) {
+int LoadATMREG (void)
+{
   FILE *input;
   int count;
 
@@ -3736,7 +3899,8 @@ int LoadATMREG (void) {
 /*  WRITES BACK INTO SECOND ARGUMENT */
 
 #ifdef IGNORED
-int LookupATMReg (char *szPSFontName, char *szPSFileName) {
+int LookupATMReg (char *szPSFontName, char *szPSFileName)
+{
   FILE *input;
   int n=0;
 
@@ -3764,7 +3928,8 @@ int LookupATMReg (char *szPSFontName, char *szPSFileName) {
 
 /* 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
index 39c2430..582ab5e 100644 (file)
@@ -897,7 +897,7 @@ char *zstrdup (char *s)    /* new central location 1996/Aug/28 */
 //  exit(1);        // pretty serious !
 #endif
   uexit(1);
-  return new;       // keep compiler happy
+//  return new;       // keep compiler happy
 }
 
 /*****************************************************************************/
@@ -1799,7 +1799,7 @@ int abortjob (void)
 #ifdef _WINDOWS
   showline("ABORTJOB", 1);  // debugging only - can't happen
 #endif
-  cleanup();  
+  cleanup();
   checkexit(3);
   return -1;
 }
@@ -1809,7 +1809,8 @@ void errcount (int flag)
 {
   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);
@@ -4534,12 +4535,13 @@ int dodefaults (void)     /* moved out 1994/May/23 */
   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 */
 
index 21d1fc1..76c53ca 100644 (file)
@@ -111,7 +111,8 @@ char moreline[MAXLINE];   // for tokens in special
 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);
@@ -124,7 +125,8 @@ char *showbeginning (char *s, char *t, int n) {
 /* 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;
 
@@ -181,7 +183,8 @@ int getalphatoken (FILE *input, char *token, int nmax) {
 
 /* 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--;
@@ -193,7 +196,8 @@ void flushspecial(FILE *input) {
 /* - 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;
 
@@ -259,7 +263,8 @@ int gettoken (FILE *input, char *buff, int nmax) {
 /* 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;
 
@@ -311,7 +316,8 @@ int scanspecial (FILE *input, char *buff, int nmax) {
 
 /* 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;
 
@@ -349,7 +355,8 @@ int scanspecialraw (FILE *input, char *buff, int nmax) {
 /* 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;
 
@@ -383,7 +390,8 @@ int getstring (FILE *input, char *buff, int nmax) {
 }
 
 /* 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;
@@ -393,7 +401,8 @@ void skiptocomma(FILE *input) {
 }
   
 /* 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;
@@ -415,7 +424,8 @@ void flushstring (FILE *input) {
 /* 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 */
@@ -505,7 +515,8 @@ void copystring (FILE *output, FILE *input) {
 /* 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--;
@@ -533,7 +544,8 @@ void stripbracket (FILE *output, FILE *input) {
 /* 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); */
@@ -572,7 +584,8 @@ int skiphpjunkathead (FILE *, int);
 
 /* 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;
 
@@ -649,8 +662,8 @@ int readbbox (FILE *special, char *fname, long pslength) {
 /* 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) {
@@ -676,7 +689,8 @@ void dealwithbbox (FILE *output, FILE *special, char *fname,
 /* 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;
@@ -727,7 +741,8 @@ int FindFileName (char *fontname, char *filename) { /* experiment 94/Aug/15 */
 /* 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; */
@@ -881,7 +896,8 @@ char *fopenfont_sub (FILE *atmfile, char *FontName, char *pfbname,
 /* 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 ? */
 
@@ -915,7 +931,8 @@ FILE *findpfbfile (char *pfbname, char *FileName) { /* 1994/Aug/18 */
 
 #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 ? */
@@ -959,7 +976,8 @@ FILE *findpfbfile (char *pfbname, char *FileName) {
 
 /* find the atmfonts.map file and get its full path */
 
-int setupatmfontsmap (void) {
+int setupatmfontsmap (void)
+{
   FILE *atmfile=NULL;
   char atmfilename[FNAMELEN];
 #ifndef SUBDIRSEARCH
@@ -1021,9 +1039,10 @@ int setupatmfontsmap (void) {
 /* 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;
@@ -1144,7 +1163,8 @@ FILE *fopenfont (char *FontName, char *FileName, int mmflag) {
 /* 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;
@@ -1193,26 +1213,26 @@ long checkpcform (FILE *special, char *fname) {
 
 /****************************************************************************
 *                                                                           *
-*   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.                            *
 *                                                                           *
@@ -1221,7 +1241,8 @@ long checkpcform (FILE *special, char *fname) {
 /* 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);
@@ -1232,7 +1253,8 @@ void warnnesting (int nesting) {
 /* 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) {
@@ -1267,7 +1289,8 @@ int copyepssimple (FILE *output, FILE *special) { /* 1993/Jan/24 */
   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);
@@ -1291,7 +1314,8 @@ void reincludefont (FILE *output, char *FontName) {
 
 /*  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;
   
@@ -1326,7 +1350,8 @@ int CopyBinary (FILE *output, FILE *special, long nbytes) {
 
 /* Skip %%BeginPreview: .... to %%EndPreview */
 
-long SkipEPSI (FILE *special) {     /* 97/June/5 */
+long SkipEPSI (FILE *special)    /* 97/June/5 */
+{
   long nbytes=0;
   int k;
   for (;;) {
@@ -1348,7 +1373,8 @@ long SkipEPSI (FILE *special) {     /* 97/June/5 */
 //  \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);      // %
@@ -1377,7 +1403,8 @@ int skiphpjunkathead (FILE *special, int flag) {  // 99/Oct/14
 
 /* 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
@@ -1761,7 +1788,8 @@ void copyepsfilesub (FILE *output, FILE *special, long pslength) {
 /* 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 */
@@ -1783,7 +1811,8 @@ int copyepsfilesimple (FILE *output, FILE *special, long pslength) {
 /*  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;
@@ -1822,7 +1851,8 @@ int islongname (char *name) {
 /* 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 ??? */
@@ -1953,14 +1983,15 @@ FILE *findepsfile (char *name, char *ext, int warnflag, int readflag) {
     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;
@@ -2059,7 +2090,8 @@ int setupbbox(char *epsfilename) {
 
 /*  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;
   
@@ -2082,7 +2114,8 @@ void copyepsfile (FILE *output, char *epsfilename, int inclflag, int needshift)
 
 /* 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;
@@ -2100,31 +2133,36 @@ void colontoslash (char *name, char *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; */
 
@@ -2165,7 +2203,8 @@ void complainspecial (FILE *input) { /* list contents and do flushspecial */
 /*  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);
@@ -2174,7 +2213,8 @@ void complainjflag (FILE *input) {          /* 1993/Oct/17 */
 
 /* 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;
@@ -2248,7 +2288,8 @@ void readtextures (FILE *output, FILE *input) { /* Texture style special ? */
 /* 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); */
@@ -2278,7 +2319,8 @@ void copypostscript (FILE *output, FILE *input, int rawflag) { /* 1994/July/4 */
 /* 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]="";
@@ -2326,7 +2368,8 @@ void readpostscript (FILE *output, FILE *input, int rawflag) { /* 1994/July/5 */
 /*  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]="";
 
@@ -2366,7 +2409,8 @@ int readandrew (FILE *output, FILE *input) {
 }
 
 /* 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 */
@@ -2523,7 +2567,7 @@ void doclip (FILE *output) {            /* 92/Nov/28 */
 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 */
@@ -2550,7 +2594,8 @@ void starttexfig(FILE *output, long pswidth, long psheight,
 /* ... 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;
@@ -2588,7 +2633,8 @@ void cantfind (FILE *input, char *s, char *line) { /* complain about missing fie
 /* 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;
@@ -2633,7 +2679,8 @@ void verbout (FILE *output, char *str) {
 /* 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 */
@@ -2928,7 +2975,8 @@ int readdvi2ps (FILE *output, FILE *input) {
 /* 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);
 }
 
@@ -2950,7 +2998,8 @@ COLORSPEC CurrColor;
 
 /* 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);
@@ -2966,7 +3015,8 @@ int doColorPop (int 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 */
@@ -2980,7 +3030,8 @@ int doColorPop (int pageno) {
   return flag;
 }
 
-int doColorPush (int pageno) {
+int doColorPush (int pageno)
+{
 /*  ColorA[colorindex] = CurrentA;
   ColorB[colorindex] = CurrentB;
   ColorC[colorindex] = CurrentC;
@@ -3005,15 +3056,18 @@ int doColorPush (int pageno) {
 /*  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);
@@ -3023,7 +3077,8 @@ void doColorSet (FILE *output, int popflag) {
     sprintf(logline, "%g gray ",  CurrColor.A);
     PSputs(logline, output);
   }
-  if (popflag && ! directprint) {
+  if (popflag && ! directprint)
+  {
     if (popflag == 1) {
       PSputs("% pop", output);
     }
@@ -3040,7 +3095,8 @@ void doColorSet (FILE *output, int popflag) {
   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;
@@ -3048,7 +3104,8 @@ int doColorPopAll (int pageno) {        /* 1996/Nov/3 */
 
 /* 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);
@@ -3068,7 +3125,8 @@ int checkColorStack (FILE *output) {    /* 96/Nov/3 */
 
 /* 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;
@@ -3203,7 +3261,8 @@ int CTMstackindex= 0;   /* try and avoid underflow at least */
 
 /* 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);
@@ -3223,14 +3282,16 @@ int popCTM (FILE *output, int flag) {
   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);
@@ -3238,7 +3299,8 @@ int checkCTM (FILE *output) {     /* CALL AT END OF PAGE */
   return -1;
 }
 
-int pushCTM (FILE *output, int flag) {
+int pushCTM (FILE *output, int flag)
+{
   CTMstackindex++;
 //  PSputs(" gsave\n", output);
   PSputs(saveCTM, output);
@@ -3249,7 +3311,8 @@ int pushCTM (FILE *output, int flag) {
 /* 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) {
@@ -3264,7 +3327,8 @@ void translateCTM (FILE *output, double dx, double dy, int flag) {
 
 /* 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) {
@@ -3286,7 +3350,8 @@ int scaleCTM (FILE *output, double sx, double sy, int flag) {
 /* 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) {
@@ -3305,7 +3370,8 @@ void rotateCTM (FILE *output, double theta, int flag) {
 
 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);
@@ -3338,7 +3404,8 @@ void concatCTM (FILE* 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;
@@ -3443,7 +3510,8 @@ void doCTM (FILE *output, FILE *input) {  /* \special{CTM: } 96/Oct/10 */
 
 /* 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 ?
@@ -3457,7 +3525,8 @@ void clipbox (FILE *output, long dwidth, long dheight, int flag) {
   } */
 }
 
-void doClipBoxPush (FILE *output) {
+void doClipBoxPush (FILE *output)
+{
 //  PSputc('\n', output);       // always on new line ?
 //  PSputs("gsave ", output);
 //  PSputs(" gsave\n", output); // saveCTM
@@ -3465,7 +3534,8 @@ void doClipBoxPush (FILE *output) {
   clipstackindex++;
 }
 
-void doClipBoxPop (FILE *output) {
+void doClipBoxPop (FILE *output)
+{
   if (clipstackindex <= 0) return;  /* avoid stack underflow */
   clipstackindex--;
 //  PSputc('\n', output);       // always on new line ?
@@ -3474,13 +3544,15 @@ void doClipBoxPop (FILE *output) {
   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; */
@@ -3558,13 +3630,15 @@ char *unitnames[] = {
 };
 
 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)
@@ -3577,7 +3651,8 @@ double decodeunits (char *units) {
 
 /* make common to save string space */
 
-void dvitopsmiss (void) {
+void dvitopsmiss (void)
+{
   showline(" File name missing in DVITPS, DVITOPS or PC-TeX special ", 1);
 }
 
@@ -3586,7 +3661,8 @@ void dvitopsmiss (void) {
 /*    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;
@@ -3754,7 +3830,8 @@ void reademtex(FILE *, FILE *);
 /* 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;
@@ -3762,11 +3839,13 @@ void reademtex (FILE *output, FILE *input) {
   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);
@@ -3821,7 +3900,8 @@ void reademtex (FILE *output, FILE *input) {
 /*    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;
@@ -3884,7 +3964,8 @@ int readdvitps (FILE *output, FILE *input) {
 /* 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;
@@ -4153,7 +4234,8 @@ int readdvips (FILE *output, FILE *input) {
 
 /* 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]="";
 
@@ -4171,12 +4253,13 @@ void DoScr (FILE *output, FILE *input) {      /* 98/Nov/4 */
 /* 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);
@@ -4227,13 +4310,15 @@ int readdvilaserps (FILE *output, FILE *input) {
 
 /*  * 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);
 }
@@ -4246,7 +4331,8 @@ long xold=0, yold=0;      /* last point placed in path */
 // 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;
@@ -4257,7 +4343,7 @@ int readtpic (FILE *output, FILE *input) {
   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 */
@@ -4452,7 +4538,8 @@ int readtpic (FILE *output, FILE *input) {
 
 /* 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 ? */
@@ -4503,7 +4590,8 @@ int readspecial (FILE *output, FILE *input, unsigned long ns) {
 
   (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 ! */
   }
@@ -4569,7 +4657,8 @@ int readspecial (FILE *output, FILE *input, unsigned long ns) {
 /* 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 ? */
@@ -4628,7 +4717,8 @@ void prereadspecial (FILE *input, unsigned long ns) {
 /* 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;
index 0903a46..beed5c3 100644 (file)
@@ -162,23 +162,23 @@ int bTextColor=0;
 \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
@@ -193,7 +193,7 @@ unsigned int bLeastFirst=1;     /* least significant first */
 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
@@ -394,7 +394,7 @@ int readfields (FILE *input, unsigned long ifdpos)
   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
@@ -420,7 +420,8 @@ int readfields (FILE *input, unsigned long ifdpos)
   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
@@ -445,7 +446,7 @@ int readfields (FILE *input, unsigned long ifdpos)
     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
@@ -572,7 +573,8 @@ void LZWput(int, FILE *);
 \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
@@ -585,13 +587,13 @@ int ReadColorMap (FILE *input, long ColorMapPtr, int BitsPerSample) {
 \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
@@ -600,7 +602,8 @@ int ReadColorMap (FILE *input, long ColorMapPtr, int BitsPerSample) {
   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
@@ -611,22 +614,25 @@ int ReadColorMap (FILE *input, long ColorMapPtr, int BitsPerSample) {
         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
@@ -641,18 +647,21 @@ int ReadColorMap (FILE *input, long ColorMapPtr, int BitsPerSample) {
   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
@@ -663,7 +672,8 @@ int ReadColorMap (FILE *input, long ColorMapPtr, int BitsPerSample) {
 //  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
@@ -685,7 +695,8 @@ int ReadColorMap (FILE *input, long ColorMapPtr, int BitsPerSample) {
 /* 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
@@ -699,7 +710,7 @@ int ProcessRow (FILE *output, unsigned char *lpBuffer, long InRowLengthX,
   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
@@ -710,13 +721,15 @@ int ProcessRow (FILE *output, unsigned char *lpBuffer, long InRowLengthX,
 /* 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
@@ -733,7 +746,8 @@ int RemoveExtraSamples (unsigned char *lpBuffer, int InRowLength) {
 /* 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
@@ -744,7 +758,8 @@ int readTIFFfile (FILE *output, FILE *input,
   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
@@ -754,7 +769,8 @@ int readTIFFfile (FILE *output, FILE *input,
 \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
@@ -780,7 +796,8 @@ int readTIFFfile (FILE *output, FILE *input,
   }\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
@@ -788,7 +805,8 @@ int readTIFFfile (FILE *output, FILE *input,
 #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
@@ -796,7 +814,8 @@ int readTIFFfile (FILE *output, FILE *input,
 #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
@@ -825,7 +844,8 @@ int readTIFFfile (FILE *output, FILE *input,
 /*  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
@@ -834,9 +854,10 @@ int readTIFFfile (FILE *output, FILE *input,
     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
@@ -846,7 +867,8 @@ int readTIFFfile (FILE *output, FILE *input,
 /*  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
@@ -863,7 +885,8 @@ int readTIFFfile (FILE *output, FILE *input,
 #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
@@ -879,16 +902,18 @@ int readTIFFfile (FILE *output, FILE *input,
 /*  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
@@ -897,7 +922,7 @@ int readTIFFfile (FILE *output, FILE *input,
   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
@@ -906,9 +931,10 @@ int readTIFFfile (FILE *output, FILE *input,
         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
@@ -921,8 +947,9 @@ int readTIFFfile (FILE *output, FILE *input,
 /*  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
@@ -939,24 +966,27 @@ int readTIFFfile (FILE *output, FILE *input,
 /*  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
@@ -967,7 +997,7 @@ int readTIFFfile (FILE *output, FILE *input,
 \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
@@ -994,16 +1024,18 @@ int readTIFFfile (FILE *output, FILE *input,
         } \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
@@ -1012,7 +1044,8 @@ int readTIFFfile (FILE *output, FILE *input,
 \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
@@ -1025,7 +1058,8 @@ int readTIFFfile (FILE *output, FILE *input,
 \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
@@ -1078,7 +1112,7 @@ typedef struct tagBITMAPFILEHEADER {
 } 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
@@ -1116,7 +1150,8 @@ BITMAPINFOHEADER bmih;
 \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
@@ -1130,7 +1165,8 @@ long ImageSize;     /* ??? */
 \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
@@ -1161,7 +1197,8 @@ int readBMPfields (FILE *input, int readflag) {
   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
@@ -1239,7 +1276,8 @@ int readBMPfields (FILE *input, int readflag) {
   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
@@ -1247,20 +1285,21 @@ int readBMPfields (FILE *input, int readflag) {
   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
@@ -1296,7 +1335,8 @@ int readBMPPalette (FILE *input, long ColorMapPtr, int BitsPerSample) {
     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
@@ -1351,7 +1391,8 @@ int readBMPPalette (FILE *input, long ColorMapPtr, int BitsPerSample) {
 /* 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
@@ -1434,7 +1475,8 @@ int readBMPfile (FILE *output, FILE *input,
   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
@@ -1484,19 +1526,22 @@ int readBMPfile (FILE *output, FILE *input,
   }\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
@@ -1506,7 +1551,8 @@ int readBMPfile (FILE *output, FILE *input,
   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
@@ -1797,7 +1843,8 @@ int readBMPfile (FILE *output, FILE *input,
 /* 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
@@ -1824,7 +1871,8 @@ int readepsfhead (FILE *special) {
 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
@@ -1842,14 +1890,15 @@ int readimagefilesub (FILE *output, FILE *special,
         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
@@ -1865,14 +1914,14 @@ int readimagefilesub (FILE *output, FILE *special,
   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
@@ -1883,7 +1932,8 @@ int readimagefilesub (FILE *output, FILE *special,
 /*  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
@@ -1897,8 +1947,9 @@ int readimagefile (FILE *output, char *filename,
     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
@@ -1917,7 +1968,8 @@ int column;
 /* 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
@@ -1938,7 +1990,8 @@ void expandcolor (unsigned char *lpBuffer, long width) {
 /*  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
@@ -2015,7 +2068,8 @@ void expandcolor (unsigned char *lpBuffer, long width) {
 /* 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
@@ -2036,7 +2090,8 @@ void expandgray (unsigned char *lpBuffer, long width) {
 /*  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
@@ -2051,7 +2106,8 @@ void expandgray (unsigned char *lpBuffer, long width) {
   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
@@ -2104,7 +2160,8 @@ void expandgray (unsigned char *lpBuffer, long width) {
 \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
@@ -2127,7 +2184,7 @@ void expandgray (unsigned char *lpBuffer, long width) {
 \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
@@ -2151,7 +2208,8 @@ int asciicount = 0;       /* how many bytes accumulated so far */
 /* 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
@@ -2193,7 +2251,8 @@ void ASCIIlong (FILE *output, unsigned long n, int nbytes) {
 /* 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
@@ -2208,20 +2267,23 @@ void ASCIIout (FILE *output, unsigned int x) {
 \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
@@ -2232,7 +2294,8 @@ void ASCIIflushfilter (FILE *output) {  /* 96/Dec/20 */
   asciicount = 0;\r
 }\r
 \r
-void RUNflushfilter (FILE *output) {\r
+void RUNflushfilter (FILE *output)\r
+{\r
   ASCIIout(output, 128);          /* EOD */\r
 }\r
 \r
@@ -2240,7 +2303,8 @@ void RUNflushfilter (FILE *output) {
 \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
@@ -2277,7 +2341,8 @@ int debugflag=1;      /* debugging output */
 \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
@@ -2302,7 +2367,8 @@ void dumprun(FILE *output, int nlen, int previous) {
   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
@@ -2339,7 +2405,8 @@ void dumpnonrun(FILE *output, int nlen, unsigned char *buffer) {
 /* 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
@@ -2443,14 +2510,16 @@ int currentnode;  // code of node currently at
 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
@@ -2468,7 +2537,8 @@ void CleanOut (FILE *output, int n) {
   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
@@ -2494,7 +2564,8 @@ int SetupNodes (FILE *output) {
 \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
@@ -2591,7 +2662,8 @@ void DoNextByte (FILE *output, int chr) { // called from  writearowLZW
 }\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
@@ -2612,12 +2684,14 @@ int bitsused;   /* bits used so far */
 /* 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
@@ -2645,7 +2719,8 @@ void LZWputinit (FILE *output) {  /* called from LZWinitfilter */
   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
@@ -2656,7 +2731,8 @@ void LZWputflush (FILE *output) {
 /*  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
@@ -2665,7 +2741,8 @@ void LZWinitfilter (FILE *output) { /*  initialization  */
 /*  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
@@ -2690,7 +2767,8 @@ void LZWflushfilter (FILE *output) { /* termination */
 /* 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
@@ -2705,13 +2783,14 @@ int writearowLZW (FILE *output, unsigned char *s, unsigned long width) {
 \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
@@ -2752,7 +2831,8 @@ void writearowhex (FILE *output, unsigned char *s, unsigned long width) {
 \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
@@ -2767,7 +2847,8 @@ int writearow (FILE *output, unsigned char *s, unsigned long width) {
 #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
@@ -2832,7 +2913,7 @@ int computeheader (void) {
     }\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
@@ -2846,13 +2927,16 @@ int computeheader (void) {
     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
@@ -2862,11 +2946,13 @@ int computeheader (void) {
   }\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
@@ -2877,7 +2963,8 @@ int computeheader (void) {
 /*  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
@@ -2886,7 +2973,8 @@ int computeheader (void) {
   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
@@ -2901,7 +2989,7 @@ int computeheader (void) {
   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
@@ -2917,7 +3005,8 @@ int computeheader (void) {
 \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
@@ -2926,7 +3015,7 @@ void writepsheader (FILE *output, long dwidth, long dheight) {
   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
@@ -2939,7 +3028,7 @@ void writepsheader (FILE *output, long dwidth, long dheight) {
   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
@@ -3124,11 +3213,12 @@ void writepsheader (FILE *output, long dwidth, long dheight) {
 /*  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
@@ -3142,7 +3232,8 @@ void writepstrailer (FILE *output) {
 /* 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
@@ -3182,7 +3273,8 @@ int readpackbits (unsigned char *lpBuffer, FILE *input, int RowLength) {
 \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
@@ -3202,15 +3294,16 @@ int getbit (FILE *input) {
   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
@@ -3298,9 +3391,11 @@ int commonmake (FILE *input) { /* common black/white make up codes (7 zeros) */
 \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
@@ -3766,9 +3861,10 @@ int whiterun (FILE *input) {
 \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
@@ -4189,9 +4285,11 @@ int blackzero (FILE *input) {   /* black run code starts with four zeros */
 \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
@@ -4246,13 +4344,13 @@ int blackrun (FILE *input) {
   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
@@ -4260,7 +4358,8 @@ int total;      /* maybe long ? */
 \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
@@ -4304,7 +4403,8 @@ int writewhite (unsigned char *lpBuffer, int run, int width) {
   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
@@ -4349,7 +4449,8 @@ int writeblack (unsigned char *lpBuffer, int run, int width) {
 \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
@@ -4436,7 +4537,7 @@ int huffmanrow (unsigned char *lpBuffer, FILE *input, int width) {
 \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
@@ -4464,7 +4565,8 @@ int CodeLength=9;           /* current code length INPUT */
 \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
@@ -4484,10 +4586,11 @@ void DeAllocStringsIn (void) {        /* remember to do this at end */
 \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
@@ -4523,7 +4626,8 @@ int AllocStringsIn (void) {
   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
@@ -4539,14 +4643,17 @@ void InitializeStringTable (void) {   /* set up string table initially */
   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
@@ -4555,7 +4662,7 @@ void ResetStringTable (int quietflag) {   /* clear string table */
   } \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
@@ -4565,16 +4672,19 @@ void ResetStringTable (int quietflag) {   /* clear string table */
 }\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
@@ -4589,7 +4699,7 @@ void AddNewEntry (int OldCode, int Code) {
   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
@@ -4601,31 +4711,36 @@ void AddNewEntry (int OldCode, int Code) {
 /*  *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
@@ -4634,7 +4749,7 @@ unsigned char *WriteString (unsigned char *buffer, int Code) {
 /*  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
@@ -4678,7 +4793,7 @@ unsigned char *WriteString (unsigned char *buffer, int Code) {
     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
@@ -4694,9 +4809,11 @@ unsigned long OldByte=0;    /* cadaver being eaten */
 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
@@ -4704,7 +4821,7 @@ int GetNextCode (FILE *input) { /* get next LZW code number from input  */
 \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
@@ -4713,7 +4830,8 @@ int GetNextCode (FILE *input) { /* get next LZW code number from input  */
       }\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
@@ -4741,7 +4859,8 @@ int GetNextCode (FILE *input) { /* get next LZW code number from input  */
 #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
@@ -4834,7 +4953,8 @@ void LZWdecompress (unsigned char *StripData, FILE *input) {
 /*  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
@@ -4848,7 +4968,8 @@ void LZWdecompress (unsigned char *StripData, FILE *input) {
 /* 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
@@ -4862,7 +4983,8 @@ long SetupStrip (FILE *input, int k) {      /* 96/Nov/17 */
     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
@@ -4875,7 +4997,8 @@ long SetupStrip (FILE *input, int k) {      /* 96/Nov/17 */
 /* 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
@@ -4894,7 +5017,8 @@ void CopyRow (unsigned char *lpBuffer, unsigned char *StripData,
 /* 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
@@ -5029,7 +5153,8 @@ BOOL bTIFFAllow=1;
 /* 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
@@ -5063,7 +5188,8 @@ long MulRatio (long x, unsigned long numer, unsigned long denom) {
 /* 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
@@ -5162,7 +5288,8 @@ int showtiffhere (FILE *output, char *filename, long dwidth, long dheight,
 \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
@@ -5217,15 +5344,18 @@ void platformindependent (char *buffer, char *name) { /* 96/Mar/3 */
 /* 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
@@ -5233,7 +5363,8 @@ void cleanupname (char *name) {
     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
@@ -5243,7 +5374,8 @@ void cleanupname (char *name) {
 \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
@@ -5398,7 +5530,8 @@ int oldcolor (FILE *output, FILE  *input) {
 \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
@@ -5430,7 +5563,8 @@ char *scaninsert(char *line, char *filename) {
 \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
@@ -5446,28 +5580,32 @@ int newspecials (FILE *output, FILE *input) {
   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
@@ -5754,7 +5892,7 @@ int newspecials (FILE *output, FILE *input) {
      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
@@ -5768,13 +5906,14 @@ int newspecials (FILE *output, FILE *input) {
    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
index 6cc56bb..926ed3b 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright 2007 TeX Users Group
+# Copyright 2014 Clerk Ma
 # You may freely use, modify and/or distribute this file.
 
 # Makefile for DVIPSONE
index 5e87c7f..4c2c4f6 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright 2007 TeX Users Group
+# Copyright 2014 Clerk Ma
 # You may freely use, modify and/or distribute this file.
 
 # Makefile for DVIPSONE