Back to index

tetex-bin  3.0
Defines | Functions | Variables
output.c File Reference
#include "dvips.h"
#include <ctype.h>
#include <stdlib.h>
#include "protos.h"

Go to the source code of this file.

Defines

#define LINELENGTH   (72)

Functions

static void chrcmd P1H (char c)
void copyfile P1C (char *, s)
void figcopyfile P2C (char *, s, int, systemtype)
void specialout P1C (char, c)
void stringend P1H (void)
void scout P1C (unsigned char, c)
void scout2 P1C (int, c)
void floatout P1C (float, n)
void doubleout P1C (double, n)
void numout P1C (integer, n)
void mhexout P2C (register unsigned char *, p, register long, len)
static int indelta P1C (integer, i)
int ncstrcmp P2C (char *, a, char *, b)
void paperspec P2C (char *, s, int, hed)
char *epsftest P1C (integer, bop)
void initprinter P1C (sectiontype *, sect)
void drawrule P2C (integer, rw, integer, rh)
void drawchar P2C (chardesctype *, c, int, cc)

Variables

integer hh
integer vv
fontdesctypecurfnt
FILEbitfile
char * oname
Boolean secure
Boolean reverse
Boolean removecomments
Boolean sendcontrolD
Boolean disablecomments
Boolean multiplesects
Boolean shiftlowchars
Boolean usesPSfonts
Boolean headers_off
Boolean safetyenclose
Boolean cropmarks
Boolean tryepsf
Boolean compressed
Boolean sepfiles
int numcopies
int collatedcopies
integer pagecopies
int totalpages
integer pagenum
Boolean manualfeed
int landscape
int quiet
int prettycolumn
int actualdpi
int vactualdpi
char * iname
char * nextstring
char * paperfmt
char * headerpath
char * figpath
char errbuf []
shalfword linepos
struct header_listps_fonts_used
char banner []
char banner2 []
int gargc
char ** gargv
struct papsizpapsizes
integer hpapersize
integer vpapersize
char preamblecomment [256]
static integer rhh
static integer rvv
static int instring
static Boolean lastspecial = 1
static shalfword d
static Boolean popened = 0
int lastfont
static char strbuffer [LINELENGTH+20]
static char * strbp = strbuffer
static struct papsizfinpapsiz
static struct papsiz
static char * hxdata = "0123456789ABCDEF"
static int infigure
char * infont
static char possibleDSCLine [81]
static char * dscLinePointer = possibleDSCLine
static char * dscLineEnd = possibleDSCLine + 80
static char * isepsf = 0
static int endprologsent
static int thispage = 0
static integer rulex
static integer ruley

Define Documentation

#define LINELENGTH   (72)

Definition at line 8 of file output.c.


Function Documentation

void copyfile P1C ( char *  ,
s   
)

Definition at line 114 of file output.c.

{
   FILE *f = NULL ;
   int c, prevc = '\n' ;
   long len ;
   /* begin DOS EPS code */
   int doseps = 0;
   unsigned long dosepsbegin, dosepsend = 0;
   int removingBytes = 0 ;
   char *scanForEnd = 0 ;
   /* end DOS EPS code */
#ifdef VMCMS
   register char *lastdirsep ;
   register char *trunc_s ;
   trunc_s = s ;
#endif
#ifdef MVSXA
   register char *lastdirsep ;
   register char *trunc_s ;
   trunc_s = s ;
#endif
   dscLinePointer = possibleDSCLine ;

   switch (infigure) {
   case 1:
/*
 *   Look in headerpath too, just in case.  This allows common header
 *   or figure files to be installed in the .../ps directory.
 */
      f = search(figpath, s, READBIN) ;
      if (f == 0)
         f = search(headerpath, s, READBIN) ;
#ifdef VMCMS
      lastdirsep = strrchr(s, '/') ;
      if ( NULL != lastdirsep ) trunc_s = lastdirsep + 1 ;
      (void)sprintf(errbuf,
   "Couldn't find figure file %s with CMS name %s; continuing", s, trunc_s) ;
#else
#ifdef MVSXA
      lastdirsep = strrchr(s, '/') ;
      if ( NULL != lastdirsep ) trunc_s = lastdirsep + 1 ;
      (void)sprintf(errbuf,
    "Couldn't find figure file %s with MVS name %s; continuing", s, trunc_s) ;
#else
      (void)sprintf(errbuf, "Could not find figure file %s; continuing", s) ;
#endif
#endif
      break ;
#ifndef VMCMS
#ifndef MVSXA
#ifndef VMS
#if !defined(MSDOS) || defined(__DJGPP__)
#ifndef ATARIST
#ifndef __THINK__
   case 2:
#ifdef SECURE
      (void)sprintf(errbuf, "<%s>: Tick filename execution disabled", s) ;
#else
#ifdef OS2
      if (_osmode == OS2_MODE) {
#endif
      if (secure == 0) {
         (void)sprintf(errbuf, "Execution of  <%s> failed ", s) ;
         f = popen(s, "r") ;
         if (f != 0)
            SET_BINARY(fileno(f)) ;
       }
       else {
      (void)sprintf(errbuf,"Secure mode is %d so execute <%s> will not run", secure,s) ;
       }
#ifdef OS2
      }
#endif
#endif
      break;
#endif
#endif
#endif
#endif
#endif
#endif
   default:
      f = search(headerpath, s, READBIN) ;
      (void)sprintf(errbuf, "! Could not find header file %s", s) ;
      break ;
   }
   if (f==NULL)
      error(errbuf) ;
   else {
      if (! quiet) {
         if (strlen(s) + prettycolumn > STDOUTSIZE) {
            fprintf(stderr, "\n") ;
            prettycolumn = 0 ;
         }
#ifdef VMCMS
         (void)fprintf(stderr, "<%s>", trunc_s) ;
#else
#ifdef MVSXA
         (void)fprintf(stderr, "<%s>", trunc_s) ;
#else
         (void)fprintf(stderr, "<%s>", s) ;
#endif
#endif
         (void)fflush(stderr) ;
         prettycolumn += 2 + strlen(s) ;
      }
      if (linepos != 0)
         (void)putc('\n', bitfile) ;
/*
 *   Suggested by Andrew Trevorrow; don't ever BeginFont a file ending in .enc
 */
      if (infont && strstr(s,".enc"))
         infont = 0 ;
      if (! disablecomments) {
         if (infigure)
            (void)fprintf(bitfile, "%%%%BeginDocument: %s\n", s) ;
         else if (infont)
            (void)fprintf(bitfile, "%%%%BeginFont: %s\n", infont) ;
#ifdef HPS
         else if (noprocset) {}
#endif
         else
            (void)fprintf(bitfile, "%%%%BeginProcSet: %s 0 0\n", s) ;
      }
      c = getc(f) ;
      if (c == 0x80) {
         while (1) {
            c = getc(f) ;
            switch(c) {
case 1:
case 2:
               len = getc(f) ;
               len += getc(f) * 256L ;
               len += getc(f) * 65536L ;
               len += getc(f) * 256L * 65536 ;
               if (c == 1) {
                  while (len > 0) {
                     c = getc(f) ;
                     if (c == EOF) {
                        error("premature EOF in MS-DOS font file") ;
                        len = 0 ;
                     } else {
                      if (c == '\r') { /* Mac- or DOS-style text file */
                           (void)putc('\n', bitfile) ;
                        if ((c = getc(f)) == '\n') /* DOS-style text */
                           len--; /* consume, but don't generate NL */
                        else
                           ungetc(c, f);
                     }
                        else
                           (void)putc(c, bitfile) ;
                        len-- ;
                     }
                  }
               } else {
                  putc('\n', bitfile) ;
                  prevc = 0 ;
                  while (len > 0) {
                     c = getc(f) ;
                     if (c == EOF) {
                        error("premature EOF in MS-DOS font file") ;
                        len = 0 ;
                     } else {
                        (void)putc(hxdata[c >> 4], bitfile) ;
                        (void)putc(hxdata[c & 15], bitfile) ;
                        len-- ;
                        prevc += 2 ;
                        if (prevc >= 76) {
                           putc('\n', bitfile) ;
                           prevc = 0 ;
                        }
                     }
                  }
               }
               break ;
case 3:
               goto msdosdone ;
default:
               error("saw type other than 1, 2, or 3 in MS-DOS font file") ;
               break ;
            }
            c = getc(f) ;
            if (c == EOF)
               break ;
            if (c != 0x80) {
               error("saw non-MSDOS header in MSDOS font file") ;
               break ;
            }
         }
msdosdone:
         prevc = 0 ;
      } else {
/* begin DOS EPS code */
         if (c == 'E'+0x80) {
            if ((getc(f)=='P'+0x80) && (getc(f)=='S'+0x80)
                                   && (getc(f)=='F'+0x80)) {
               doseps = 1;
               dosepsbegin = getc(f) ;
               dosepsbegin += getc(f) * 256L ;
               dosepsbegin += getc(f) * 65536L ;
               dosepsbegin += getc(f) * 256L * 65536 ;
               dosepsend = getc(f) ;
               dosepsend += getc(f) * 256L ;
               dosepsend += getc(f) * 65536L ;
               dosepsend += getc(f) * 256L * 65536 ;
               fseek(f, dosepsbegin, 0);
               c = getc(f);
               dosepsend-- ;
            }
            else {
               rewind(f);
               c = getc(f);
            }
         }
/* end DOS EPS code */
         if (c != EOF) {
            while (1) {
               if (c == '\n') { /* end or beginning of line; check DSC */
                  *dscLinePointer = 0 ; /* make sure we terminate!
                                         * might be a new empty line! */
                  if (strncmp(possibleDSCLine, "%%BeginBinary:", 14) == 0 ||
                      strncmp(possibleDSCLine, "%%BeginData:", 12) == 0) {
                     integer size = 0 ;
                     char *p = possibleDSCLine ;
                     *dscLinePointer = 0 ;
                     *dscLineEnd = 0 ;
                     if (scanForEnd == 0 && removecomments)
                        (void)fputs(possibleDSCLine, bitfile) ;
                     scanForEnd = 0 ;
                     while (*p != ':')
                        p++ ;
                     p++ ;
                     while (*p && *p <= ' ')
                        p++ ;
                     if ('0' > *p || *p > '9') {
                        /*
                         *   No byte count!  We need to scan for end binary
                         *   or end data, and hope we get it right.  Really
                         *   the file is malformed.
                         */
                        scanForEnd = "Yes" ;
                     }
                     while ('0' <= *p && *p <= '9') {
                        size = size * 10 + *p - '0' ;
                        p++ ;
                     }
                     while (*p && *p <= ' ')
                        p++ ;
                     if (*p == 'h' || *p == 'H')
                        /*
                         *   Illustrator 8 and 9 have bogus byte counts
                         *   for hex data.  But if it is hex, we assume
                         *   that it is safe to use ASCII scanning, so
                         *   we do so.
                         */
                        scanForEnd = "Yes" ;
                     while (*p > ' ') /* ignore Hex/Binary/ASCII */
                        p++ ;
                     while (*p && *p <= ' ')
                        p++ ;
                     (void)putc(c, bitfile) ;
                     if (c == '\r') { /* maybe we have a DOS-style text file */
                        c = getc(f);
                        if (c == '\n') {
                           (void)putc(c, bitfile);
                           dosepsend-- ;
                        } else
                           ungetc(c, f);
                     }
                     if (scanForEnd != 0) {
                        if (strncmp(possibleDSCLine, "%%BeginBinary", 13) == 0)
                           scanForEnd = "%%EndBinary" ;
                        else
                           scanForEnd = "%%EndData" ;
                     }
                     if (scanForEnd == 0) {
                        if (strncmp(p, "lines", 5) != 0 &&
                            strncmp(p, "Lines", 5) != 0) {
                           for (; size>0; size--) {
                              c = getc(f) ;
                              dosepsend-- ;
                              if (c == EOF)
                                 error(
                                 "! premature end of file in binary section") ;
                              (void)putc(c, bitfile) ;
                           }
                        } else {
                           /*
                            *  Count both newlines and returns, and when either
                            *  goes over the count, we are done.
                            */
                           int newlines=0, returns=0 ;
                           while (newlines < size && returns < size) {
                              c = getc(f) ;
                              dosepsend-- ;
                              if (c == EOF)
                                 error(
                                    "! premature end of file in binary section") ;
                              (void)putc(c, bitfile) ;
                              if (c == '\n')
                                 newlines++ ;
                              else if (c == '\r')
                                 returns++ ;
                           }
                           /*
                            *   If we've seen precisely one too few newlines,
                            *   and the next char is a newline, include it too.
                            */
                           if (returns == newlines + 1) {
                              if ((c = getc(f)) == '\n') {
                                 putc(c, bitfile) ;
                                 dosepsend-- ;
                              } else {
                                 ungetc(c, f);
                              }
                           }
                        }
                        c = getc(f) ;
                        dosepsend-- ;
                        if (c == '\n' || c == '\r') {
                           (void)putc(c, bitfile) ;
                        if (c == '\r') { /* DOS-style text file? */
                           c = getc(f);
                              dosepsend-- ;
                           if (c == '\n') {
                              putc(c, bitfile);
                              c = getc(f);
                                 dosepsend-- ;
                           }
                        } else {
                           c = getc(f) ;
                              dosepsend-- ;
                           }
                        }
                        if (c != '%') {
                           /*   try to find %%EndBinary or %%EndData anywhere
                                in the rest of the file, and pretend it
                                worked; this works around various Illustrator
                                bugs.   -tgr, 14 June 2003                  */
                           char *m1 = "%%EndData" ;
                           char *m2 = "%%EndBinary" ;
                           char *p1 = m1 ;
                           char *p2 = m2 ;
                           error(
               " expected to see %%EndBinary at end of data; struggling on") ;
                           while (1) {
                              (void)putc(c, bitfile) ;
                              if (c == '\r' || c == '\n') {
                              if (c == '\r') { /* DOS-style text file? */
                                 c = getc(f);
                                 if (c != '\n')
                                   ungetc(c, f);
                                    else
                                       dosepsend-- ;
                              }
                                 break ;
                           }
                              c = getc(f) ;
                              dosepsend-- ;
                              if (c == EOF)
                                 error(
                                 "! premature end of file in binary section") ;
 /*
  *   By the way, this code can be fooled by things like %%%EndBinary
  *   or even %%EndBi%%EndBinary, but this isn't valid DSC anyway.
  *   This comment is mainly here to prevent anyone else from emulating
  *   this code when doing stream-based substring matching.
  */
                              if (c == *p1) {
                                 p1++ ;
                                 if (*p1 == 0)
                                    break ;
                              } else {
                                 p1 = m1 ;
                              }
                              if (c == *p2) {
                                 p2++ ;
                                 if (*p2 == 0)
                                    break ;
                              } else {
                                 p2 = m2 ;
                              }
                           }
                        }
                        while (1) {
                           (void)putc(c, bitfile) ;
                           if (c == '\r' || c == '\n') {
                           if (c == '\r') { /* DOS-style text file? */
                              c = getc(f);
                              if (c != '\n')
                                ungetc(c, f);
                                 else
                                    dosepsend-- ;
                           }
                              break ;
                        }
                           c = getc(f) ;
                           dosepsend-- ;
                           if (c == EOF)
                              error(
                                 "! premature end of file in binary section") ;
                        }
                        c = getc(f) ;
                        dosepsend-- ;
                     }
                  } else if (scanForEnd && strncmp(possibleDSCLine, scanForEnd,
                                                   strlen(scanForEnd))==0) {
                     scanForEnd = 0 ;
                  }
                  dscLinePointer = possibleDSCLine ;
               } else if (dscLinePointer < dscLineEnd) {
                  *dscLinePointer++ = c ;
                  if (removecomments && scanForEnd == 0 &&
                      c == '%' && dscLinePointer == possibleDSCLine + 1) {
                     /* % is first char */
                     c = getc(f) ;
                     if (c == '%' || c == '!')
                        removingBytes = 1 ;
                     if (c != EOF)
                        ungetc(c, f) ;
                     c = '%' ;
                  }
               }
#ifdef VMCMS
               if (c != 0x37 ) {
#else
#ifdef MVSXA
               if (c != 0x37 ) {
#else
               if (c != 4) {
#endif
#endif
                  if (!removingBytes)
                     (void)putc(c, bitfile) ;
               }
               prevc = c ;
/* begin DOS EPS code */
               if (doseps && (dosepsend <= 0))
                  break;      /* stop at end of DOS EPS PostScript section */
/* end DOS EPS code */
               c = getc(f) ;
               dosepsend-- ;
               if (c == EOF)
                  break ;
               else if (c == '\r') {
                c = getc(f);
                if (c == '\n') { /* DOS-style text file? */
                   if (!removingBytes) (void)putc('\r', bitfile);
                     dosepsend-- ;
                } else
                   ungetc(c, f);
                  c = '\n' ;
              }
               if (prevc == '\n')
                  removingBytes = 0 ;
            }
         }
      }
      if (prevc != '\n')
         (void)putc('\n', bitfile) ;
      linepos = 0 ;
#ifndef VMCMS
#ifndef MVSXA
#ifndef VMS
#if !defined(MSDOS) || defined(__DJGPP__)
#ifndef ATARIST
#ifndef __THINK__
      if (infigure == 2)
#ifdef OS2
         {
            if (_osmode == OS2_MODE)
               (void)pclose(f) ;
         }
#else
         (void)pclose(f) ;
#endif
      else
#endif
#endif
#endif
#endif
#endif
#endif
         (void)fclose(f) ;
      if (!disablecomments) {
         if (infigure)
            (void)fprintf(bitfile, "\n%%%%EndDocument\n") ;
         else if (infont)
            (void)fprintf(bitfile, "\n%%%%EndFont\n") ;
#ifdef HPS
         else if (noprocset) {}
#endif
         else
            (void)fprintf(bitfile, "\n%%%%EndProcSet\n") ;
      }
   }
}

Here is the call graph for this function:

static void chrcmd P1C ( char  ,
c   
)

Definition at line 628 of file output.c.

{
   if (linepos >= LINELENGTH) {
      (void)putc('\n', bitfile) ;
      linepos = 0 ;
   }
   (void)putc(c, bitfile) ;
   linepos++ ;
   lastspecial = 1 ;
}

Here is the call graph for this function:

void scout P1C ( unsigned  char,
c   
)

Definition at line 684 of file output.c.

{
/*
 *   Is there room in the buffer?  LINELENGTH-6 is used because we
 *   need room for (, ), and a possible four-byte string \000, for
 *   instance.  If it is too long, we send out the string.
 */
   if (instring > LINELENGTH-6) {
      stringend() ;
      chrcmd('p') ;
   }
#ifdef SHIFTLOWCHARS
   c=T1Char(c);
#endif
/*  changed next line to hex representation for VMCMS port
   if (c<' ' || c > 126 || c=='%' ) {
*/
   if ( c<0x20 || c>= 0x7F || c==0x25 ) {
      *strbp++ = '\\' ;
      *strbp++ = '0' + ((c >> 6) & 3) ;
      *strbp++ = '0' + ((c >> 3) & 7) ;
      *strbp++ = '0' + (c & 7) ;
      instring += 4 ;
   } else {
#ifdef VMCMS
     c = ascii2ebcdic[c];
#else
#ifdef MVSXA
     c = ascii2ebcdic[c];
#endif
#endif
     if (c == '(' || c == ')' || c == '\\') {
       *strbp++ = '\\' ;
       *strbp++ = c ;
       instring += 2 ;
     } else {
       *strbp++ = c ;
       instring++ ;
     }
   }
}
void scout2 P1C ( int  ,
c   
)

Definition at line 727 of file output.c.

{
   char s[64] ;

   sprintf(s, "<%04x>p", c) ;
   cmdout(s) ;
}

Here is the call graph for this function:

void floatout P1C ( float  ,
n   
)

Definition at line 779 of file output.c.

{
   char buf[20] ;

   (void)sprintf(buf, "%.2f", n) ;
   cmdout(buf) ;
}

Here is the call graph for this function:

void doubleout P1C ( double  ,
n   
)

Definition at line 787 of file output.c.

{
   char buf[40] ;

   (void)sprintf(buf, "%g", n) ;
   cmdout(buf) ;
}

Here is the call graph for this function:

void numout P1C ( integer  ,
n   
)

Definition at line 796 of file output.c.

{
   char buf[10] ;

#ifdef SHORTINT
   (void)sprintf(buf, "%ld", n) ;
#else
   (void)sprintf(buf, "%d", n) ;
#endif
   cmdout(buf) ;
}

Here is the call graph for this function:

static int indelta P1C ( integer  ,
i   
) [static]

Definition at line 925 of file output.c.

{
   if (i < 0)
      i = -i ;
   return (i <= 1184072) ;
}
char* epsftest P1C ( integer  ,
bop   
)

Definition at line 1131 of file output.c.

{
   if (tryepsf && paperfmt == 0 && *iname) {
      findbb(bop+44) ;
      return nextstring ;
   }
   return 0 ;
}
void initprinter P1C ( sectiontype ,
sect   
)

Definition at line 1226 of file output.c.

{
   void tell_needed_fonts() ;
   int n = sect->numpages * pagecopies * collatedcopies ;
#ifdef HPS
   if (!HPS_FLAG)
#endif
      open_output() ;

   findpapersize() ;
   if (disablecomments) {
      (void)fprintf(bitfile,
             "%%!PS (but not EPSF; comments have been disabled)\n") ;
      (void)fprintf(stderr, "Warning:  no %%%%Page comments generated.\n") ;
   } else {
      if (multiplesects) {
         (void)fprintf(bitfile,
             "%%!PS (but not EPSF because of memory limits)\n") ;
         (void)fprintf(stderr, "Warning:  no %%%%Page comments generated.\n") ;
      } else {
         isepsf = epsftest(sect->bos) ;
         if (isepsf)
            (void)fprintf(bitfile, "%%!PS-Adobe-2.0 EPSF-2.0\n") ;
         else
            (void)fprintf(bitfile, "%%!PS-Adobe-2.0\n") ;
      }
      if (tryepsf && isepsf == 0)
         error("We tried, but couldn't make it EPSF.") ;
      (void)fprintf(bitfile, "%%%%Creator: %s\n", banner + 8) ;
      if (*iname)
         (void)fprintf(bitfile, "%%%%Title: %s\n", iname) ;
#ifdef CREATIONDATE
      jobtime=time(0);
      (void)fprintf(bitfile, "%%%%CreationDate: %s",
                                 asctime(localtime(&jobtime))) ;
#endif
      if (! isepsf) {
/*
 *   Normally, we wouldn't want to add that second field
 *   indicating that the page order is reversed, as per page
 *   644 of the Red book.  But we have to, for many existing
 *   spoolers.
 */
        (void)fprintf(bitfile, "%%%%Pages: %d%s\n", (sepfiles ? n : totalpages),
                                                    (reverse?" -1":"")) ;
        (void)fprintf(bitfile, "%%%%PageOrder: %sscend\n", reverse?"De":"A");
      }
      if (landscape) {
         fprintf(bitfile, "%%%%Orientation: Landscape\n") ;
         fprintf(bitfile, "%%%%BoundingBox: 0 0 %d %d\n",
              topoints(finpapsiz->xsize), topoints(finpapsiz->ysize)) ;
      } else if (isepsf)
         fprintf(bitfile, "%%%%BoundingBox: %s\n", isepsf) ;
      else
         fprintf(bitfile, "%%%%BoundingBox: 0 0 %d %d\n",
              topoints(finpapsiz->xsize), topoints(finpapsiz->ysize)) ;
      tell_needed_fonts() ;
      paperspec(finpapsiz->specdat, 1) ;
      (void)fprintf(bitfile, "%%%%EndComments\n") ;
   }
   {
      int i, len ;
      char *p ;

/*
 *   Here, too, we have to be careful not to exceed the line length
 *   limitation, if possible.
 */
      (void)fprintf(bitfile, "%%DVIPSWebPage: %s\n", banner2) ;
      (void)fprintf(bitfile, "%%DVIPSCommandLine:") ;
      len = 18 ;
      for (i=0; i<gargc; i++) {
         p = gargv[i] ;
         while (*p > ' ')
            p++ ;
         if (*p)
            len += 2 ;
         len += strlen(gargv[i]) + 1 ;
         if (len > LINELENGTH) {
            (void)fprintf(bitfile, "\n%%+") ;
            len = strlen(gargv[i]) + 3 ;
            if (*p)
               len += 2 ;
         }
         (void)fprintf(bitfile, (*p ? " \"%s\"" : " %s"), gargv[i]) ;
      }
      (void)fprintf(bitfile, "\n%%DVIPSParameters: dpi=%d", actualdpi) ;
      if (actualdpi != vactualdpi)
         (void)fprintf(bitfile, "x%d", vactualdpi) ;
      if (compressed)
         (void)fprintf(bitfile, ", compressed") ;
      if (removecomments)
         (void)fprintf(bitfile, ", comments removed") ;
      (void)fputc('\n', bitfile) ;
   }
#ifdef VMCMS  /* convert preamblecomment to ebcdic so we can read it */
   {
      int i ;
      for ( i=0 ; preamblecomment[i] ; i++ )
          preamblecomment[i] = ascii2ebcdic[preamblecomment[i]] ;
   }
#else
#ifdef MVSXA   /* IBM: MVS/XA */
   {
      int i ;
      for ( i=0 ; preamblecomment[i] ; i++ )
          preamblecomment[i] = ascii2ebcdic[preamblecomment[i]] ;
   }
#endif  /* VMCMS */
#endif
   (void)fprintf(bitfile, "%%DVIPSSource: %s\n", preamblecomment) ;
   linepos = 0 ;
   endprologsent = 0 ;
   if (safetyenclose)
      (void)fprintf(bitfile, "/SafetyEnclosure save def\n") ;
   if (! headers_off)
      send_headers() ;
}

Here is the call graph for this function:

static void chrcmd P1H ( char  c) [static]
void stringend P1H ( void  ) [read]

Definition at line 640 of file output.c.

{
   if (linepos + instring >= LINELENGTH - 2) {
      (void)putc('\n', bitfile) ;
      linepos = 0 ;
   }
   (void)putc('(', bitfile) ;
   *strbp = 0 ;
   (void)fputs(strbuffer, bitfile) ;
   (void)putc(')', bitfile) ;
   linepos += instring + 2 ;
   lastspecial = 1 ;
   instring = 0 ;
   strbp = strbuffer ;
}

Here is the call graph for this function:

void figcopyfile P2C ( char *  ,
s  ,
int  ,
systemtype   
)

Definition at line 616 of file output.c.

{
   infigure = systemtype ? 2 : 1 ;
   copyfile(s) ;
   infigure = 0 ;
}
void mhexout P2C ( register unsigned char *  ,
p  ,
register  long,
len   
)

Definition at line 809 of file output.c.

{
   register char *hexchar = hxdata ;
   register int n, k ;

   while (len > 0) {
      if (linepos > LINELENGTH - 2) {
         (void)putc('\n', bitfile) ;
         linepos = 0 ;
      }
      k = (LINELENGTH - linepos) >> 1 ;
      if (k > len)
         k = len ;
      len -= k ;
      linepos += (k << 1) ;
      while (k--) {
         n = *p++ ;
         (void)putc(hexchar[n >> 4], bitfile) ;
         (void)putc(hexchar[n & 15], bitfile) ;
      }
   }
}

Here is the call graph for this function:

int ncstrcmp P2C ( char *  ,
a  ,
char *  ,
b   
)

Definition at line 941 of file output.c.

{
   while (*a && (*a == *b ||
                       mlower(*a) == mlower(*b)))
      a++, b++ ;
   if (*a == 0 && *b == 0)
      return 0 ;
   else
      return 1 ;
}
void paperspec P2C ( char *  ,
s  ,
int  ,
hed   
)

Definition at line 1107 of file output.c.

{
   int sendit ;

   while (*s) {
      s++ ;
      if (*s == '\0')
         return ;
      if (*s == '!') {
         s++ ;
         while (*s == ' ') s++ ;
         sendit = hed ;
      } else
         sendit = ! hed ;
      if (sendit) {
         while (*s && *s != '\n')
            (void)putc(*s++, bitfile) ;
         putc('\n', bitfile) ;
      } else {
         while (*s && *s != '\n')
            s++ ;
      }
   }
}

Here is the call graph for this function:

void drawrule P2C ( integer  ,
rw  ,
integer  ,
rh   
)

Definition at line 1508 of file output.c.

{
   numout((integer)hh) ;
   numout((integer)vv) ;
   if (rw == rulex && rh == ruley)
      chrcmd('V') ;
   else {
      numout((integer)rw) ;
      numout((integer)rh) ;
      chrcmd('v') ;
      rulex = rw ;
      ruley = rh ;
   }
}
void drawchar P2C ( chardesctype ,
c  ,
int  ,
cc   
)

Definition at line 1527 of file output.c.

{
   hvpos() ;
   if (lastfont != curfnt->psname) {
      fontout((int)curfnt->psname) ;
      lastfont = curfnt->psname ;
   }
   if (curfnt->codewidth==1) scout((unsigned char)cc) ;
   else scout2(cc) ;
   rhh = hh + c->pixelwidth ; /* rvv = rv */
}

Variable Documentation

Definition at line 103 of file dvips.c.

char banner[]

Definition at line 187 of file dvips.c.

char banner2[]

Definition at line 188 of file dvips.c.

Definition at line 93 of file dvips.c.

Definition at line 68 of file dvips.c.

Definition at line 58 of file dvips.c.

Definition at line 64 of file dvips.c.

Definition at line 54 of file dvips.c.

shalfword d [static]

Definition at line 81 of file output.c.

Definition at line 173 of file dvips.c.

char * dscLineEnd = possibleDSCLine + 80 [static]

Definition at line 112 of file output.c.

char * dscLinePointer = possibleDSCLine [static]

Definition at line 112 of file output.c.

int endprologsent [static]

Definition at line 1140 of file output.c.

char errbuf[]

Definition at line 42 of file loadfont.c.

char* figpath

Definition at line 138 of file dvips.c.

struct papsiz* finpapsiz [static]

Definition at line 86 of file output.c.

Definition at line 162 of file dvips.c.

char** gargv

Definition at line 163 of file dvips.c.

char* headerpath

Definition at line 139 of file dvips.c.

Definition at line 168 of file dvips.c.

Definition at line 595 of file dvi2xx.h.

Definition at line 82 of file dvips.c.

char* hxdata = "0123456789ABCDEF" [static]

Definition at line 108 of file output.c.

char* iname

Definition at line 89 of file dvips.c.

int infigure [static]

Definition at line 109 of file output.c.

char* infont

Definition at line 125 of file dvips.c.

int instring [static]

Definition at line 79 of file output.c.

char* isepsf = 0 [static]

Definition at line 1139 of file output.c.

Definition at line 108 of file dvips.c.

Definition at line 83 of file output.c.

Boolean lastspecial = 1 [static]

Definition at line 80 of file output.c.

Definition at line 71 of file dvips.c.

Definition at line 57 of file dvips.c.

Definition at line 172 of file dvips.c.

char * nextstring

Definition at line 92 of file dvips.c.

Definition at line 87 of file dvips.c.

char* oname

Definition at line 88 of file dvips.c.

Definition at line 70 of file dvips.c.

Definition at line 111 of file dvips.c.

char* paperfmt

Definition at line 107 of file dvips.c.

struct papsiz [static]
Initial value:
 {
   0, 40258437L, 52099154L, "letter", ""
}

Definition at line 87 of file output.c.

struct papsiz* papsizes

Definition at line 192 of file dvips.c.

Boolean popened = 0 [static]

Definition at line 82 of file output.c.

char possibleDSCLine[81] [static]

Definition at line 111 of file output.c.

char preamblecomment[256]

Definition at line 71 of file output.c.

Definition at line 161 of file dvips.c.

Definition at line 101 of file resident.c.

Definition at line 158 of file dvips.c.

Definition at line 62 of file dvips.c.

Definition at line 165 of file dvips.c.

integer rhh [static]

Definition at line 78 of file output.c.

integer rulex [static]

Definition at line 1439 of file output.c.

integer ruley [static]

Definition at line 1439 of file output.c.

integer rvv [static]

Definition at line 78 of file output.c.

Definition at line 60 of file dvips.c.

Definition at line 67 of file dvips.c.

Definition at line 76 of file dvips.c.

Definition at line 86 of file dvips.c.

Definition at line 77 of file dvips.c.

char * strbp = strbuffer [static]

Definition at line 85 of file output.c.

char strbuffer[LINELENGTH+20] [static]

Definition at line 85 of file output.c.

int thispage = 0 [static]

Definition at line 1438 of file output.c.

Definition at line 164 of file dvips.c.

Definition at line 66 of file dvips.c.

Definition at line 166 of file dvips.c.

Definition at line 104 of file dvips.c.

Definition at line 82 of file dvips.c.

Definition at line 597 of file dvi2xx.h.