Back to index

tetex-bin  3.0
Defines | Functions | Variables
resident.c File Reference
#include "dvips.h"
#include "paths.h"
#include "protos.h"

Go to the source code of this file.

Defines

#define FONTPATH   "TEXFONTS"
#define INLINE_SIZE   (2000)

Functions

int hash P1C (char *, s)
void revpslists P1H (void)
struct resfont *lookup P1C (char *, name)
void add_entry P6C (char *, TeXname, char *, PSname, char *, Fontfile, char *, Vectfile, char *, specinfo, char *, downloadinfo)
int residentfont P1C (register fontdesctype *, curfnt)
void bad_config P1C (char *, err)
static char *getpath P2C (char *, who, char *, what)
char *configstring P2C (char *, s, int, nullok)
void checkenv P1C (int, which)

Variables

struct resfontreshash [RESHASHPRIME]
char * realnameoffile
integer debug_flag
integer pagecopies
int overridemag
long bytesleft
quarterwordraster
FILEpkfile
char * oname
integer swmem
integer fontmem
char * tfmpath
char * pictpath
char * pkpath
char * vfpath
char * figpath
char * configpath
char * headerpath
Boolean noenv
Boolean downloadpspk
char * paperfmt
char * nextstring
char * maxstring
char * warningmsg
Boolean disablecomments
Boolean compressed
Boolean partialdownload
int quiet
int filter
Boolean reverse
Boolean usesPSfonts
Boolean nosmallchars
Boolean removecomments
Boolean safetyenclose
Boolean dopprescan
integer maxsecsize
double mag
Boolean sepfiles
int actualdpi
int vactualdpi
int maxdrift
int vmaxdrift
char * printer
char * mfmode
char * mflandmode
int mfmode_option
int oname_option
Boolean sendcontrolD
unsigned lastresortsizes []
integer hoff
integer voff
struct papsizpapsizes
Boolean secure
integer hpapersize
integer vpapersize
int landscape
struct header_listps_fonts_used
char * infont
static char was_inline [INLINE_SIZE]
static unsigned c_lineno
char * psmapfile = PSMAPFILE

Define Documentation

#define FONTPATH   "TEXFONTS"

Definition at line 4 of file resident.c.

#define INLINE_SIZE   (2000)

Definition at line 280 of file resident.c.


Function Documentation

int hash P1C ( char *  ,
s   
)

Definition at line 106 of file resident.c.

{
   int h = 12 ;

   while (*s != 0)
      h = (h + h + *s++) % RESHASHPRIME ;
   return(h) ;
}
void getpsinfo P1C ( char *  ,
name   
) [read]

Definition at line 141 of file resident.c.

{
   struct resfont *p ;

   for (p=reshash[hash(name)]; p!=NULL; p=p->next)
      if (strcmp(p->Keyname, name)==0)
         return(p) ;
   return(NULL) ;
}

Here is the call graph for this function:

int residentfont P1C ( register fontdesctype ,
curfnt   
)

Definition at line 197 of file resident.c.

{
   register shalfword i ;
   struct resfont *p ;

/*
 *   First we determine if we can find this font in the resident list.
 */
   if (*curfnt->area)
      return 0 ; /* resident fonts never have a nonstandard font area */
   if ((p=lookup(curfnt->name))==NULL)
      return 0 ;
/*
 *   This is not yet the correct way to do things, but it is useful as it
 *   is so we leave it in.  The problem:  if resident Times-Roman is
 *   re-encoded, then it will be downloaded as bitmaps; this is not
 *   right.  The solution will be to introduce two types of `<'
 *   directives, one that downloads fonts and one that downloads
 *   short headers that are innocuous.
 */
   if (p->Fontfile && downloadpspk) {
#ifdef DEBUG
      if (dd(D_FONTS))
         (void)fprintf(stderr,"Using PK font %s for <%s>.\n",
                                     curfnt->name, p->PSname) ;
#endif  /* DEBUG */
      return 0 ;
   }
/*
 *   We clear out some pointers:
 */
#ifdef DEBUG
   if (dd(D_FONTS))
        (void)fprintf(stderr,"Font %s <%s> is resident.\n",
                                     curfnt->name, p->PSname) ;
#endif  /* DEBUG */
   curfnt->resfont = p ;
   curfnt->name = p->TeXname ;
   for (i=0; i<256; i++) {
      curfnt->chardesc[i].TFMwidth = 0 ;
      curfnt->chardesc[i].packptr = NULL ;
      curfnt->chardesc[i].pixelwidth = 0 ;
      curfnt->chardesc[i].flags = 0 ;
      curfnt->chardesc[i].flags2 = 0 ;
   }
   add_name(p->PSname, &ps_fonts_used) ;
/*
 *   We include the font here.  But we only should need to include the
 *   font if we have a stupid spooler; smart spoolers should be able
 *   to supply it automatically.
 */
   if (p->downloadheader) {
      char *cp = p->downloadheader ;
      char *q ;

      infont = p->PSname ;
      while (1) {
         q = cp ;
         while (*cp && *cp != ' ')
            cp++ ;
         if (*cp) {
            *cp = 0 ;
            add_header(q) ;
            *cp++ = ' ' ;
         } else {
/*          if (strstr(q,".pfa")||strstr(q,".pfb")||
                strstr(q,".PFA")||strstr(q,".PFB"))
               break ;
            else */ {
              add_header(q) ;
              break;
            }
         }
         infont = 0 ;
      }
      infont = 0 ;
   }
   i = tfmload(curfnt) ;
   if (i < 0)
      i = 1 ;
   usesPSfonts = 1 ;
   return(i) ;
}

Here is the call graph for this function:

void bad_config P1C ( char *  ,
err   
)

Definition at line 284 of file resident.c.

{
   fprintf (stderr, "%s:%d:", realnameoffile, c_lineno);
   error (err);
   fprintf(stderr, " (%s)\n", was_inline) ;
}

Here is the call graph for this function:

void checkenv P1C ( int  ,
which   
)

Definition at line 969 of file resident.c.

{
#ifndef KPATHSEA
   if (which) {
      tfmpath = getenvup(FONTPATH, tfmpath) ;
      vfpath = getenvup("VFFONTS", vfpath) ;
      pictpath = getenvup("TEXPICTS", pictpath) ;
      figpath = getenvup("TEXINPUTS", figpath) ;
      headerpath = getenvup("DVIPSHEADERS", headerpath) ;
      if (getenv("TEXPKS"))
         pkpath = getenvup("TEXPKS", pkpath) ;
      else if (getenv("TEXPACKED"))
         pkpath = getenvup("TEXPACKED", pkpath) ;
      else if (getenv("PKFONTS"))
         pkpath = getenvup("PKFONTS", pkpath) ;
#ifdef SEARCH_SUBDIRECTORIES
      else if (getenv(FONTPATH))
         pkpath = getenvup(FONTPATH, pkpath) ;
      if (getenv ("TEXFONTS_SUBDIR"))
         fontsubdirpath = getenvup ("TEXFONTS_SUBDIR", fontsubdirpath);
      {
         char pathsep[2] ;
         char *do_subdir_path();
         char *dirs = do_subdir_path (fontsubdirpath);
         /* If the paths were in dynamic storage before, that memory is
            wasted now.  */
         pathsep[0] = PATHSEP ;
         pathsep[1] = '\0' ;
         tfmpath = concat3 (tfmpath, pathsep, dirs);
         pkpath = concat3 (pkpath, pathsep, dirs);
      }
#endif
   } else
      configpath = getenvup("TEXCONFIG", configpath) ;
#endif
}
void revpslists P1H ( void  ) [read]

Definition at line 118 of file resident.c.

                     {
   register int i ;
   for (i=0; i<RESHASHPRIME; i++)
      reshash[i] = (struct resfont *)revlist(reshash[i]) ;
}
static char *getenvup P2C ( char *  ,
who  ,
char *  ,
what   
) [static]

Definition at line 297 of file resident.c.

{
   if (who) {
      register char *pp, *qq ;
      int lastsep = 1 ;

      for (pp=nextstring, qq=who; *qq;) {
         if (*qq == PATHSEP) {
            if (lastsep) {
               strcpy(pp, what) ;
               pp = pp + strlen(pp) ;
            }
            lastsep = 1 ;
         } else
            lastsep = 0 ;
         *pp++ = *qq++ ;
      }
      if (lastsep) {
         strcpy(pp, what) ;
         pp = pp + strlen(pp) ;
      }
      *pp = 0 ;
      qq = nextstring ;
      nextstring = pp + 1 ;
      return qq ;
   } else
      return what ;
}

Here is the call graph for this function:

char* configstring P2C ( char *  ,
s  ,
int  ,
nullok   
)

Definition at line 331 of file resident.c.

{
   char tstr[INLINE_SIZE] ;
   char *p = tstr ;

   while (*s && *s <= ' ')
      s++ ;
   if (*s == '"') {
      s++ ;
      while (*s != 10 && *s != 0 && *s != '"' && p < tstr+290)
         *p++ = *s++ ;
   } else {
      while (*s && p < tstr+290)
         *p++ = *s++ ;
      while (*(p-1) <= ' ' && p > tstr)
         p-- ;
   }
   *p = 0 ;
   if (p == tstr && ! nullok)
      bad_config("bad string") ;
   return newstring(tstr) ;
}
void add_entry P6C ( char *  ,
TeXname  ,
char *  ,
PSname  ,
char *  ,
Fontfile  ,
char *  ,
Vectfile  ,
char *  ,
specinfo  ,
char *  ,
downloadinfo   
)

Definition at line 168 of file resident.c.

{
   struct resfont *p ;
   int h ;
   if (PSname == NULL)
      PSname = TeXname ;
   p = (struct resfont *)mymalloc((integer)sizeof(struct resfont)) ;
   p->Keyname = TeXname ;
   p->PSname = PSname ;
   p->Fontfile = Fontfile;
   p->Vectfile = Vectfile;
   p->TeXname = TeXname ;
   p->specialinstructions = specinfo ;
   if (downloadinfo && *downloadinfo)
      p->downloadheader = downloadinfo ;
   else
      p->downloadheader = 0 ;
   h = hash(TeXname) ;
   p->next = reshash[h] ;
   p->sent = 0 ;
   reshash[h] = p ;
}

Variable Documentation

Definition at line 103 of file dvips.c.

long bytesleft

Definition at line 112 of file dvips.c.

unsigned c_lineno [static]

Definition at line 282 of file resident.c.

Definition at line 58 of file dvips.c.

char* configpath

Definition at line 140 of file dvips.c.

Definition at line 199 of file dvips.c.

Definition at line 173 of file dvips.c.

Definition at line 190 of file dvips.c.

Definition at line 59 of file dvips.c.

char* figpath

Definition at line 138 of file dvips.c.

Definition at line 159 of file dvips.c.

Definition at line 109 of file dvips.c.

char* headerpath

Definition at line 139 of file dvips.c.

Definition at line 83 of file dvips.c.

Definition at line 82 of file dvips.c.

char* infont

Definition at line 125 of file dvips.c.

Definition at line 108 of file dvips.c.

unsigned lastresortsizes[]

Definition at line 43 of file loadfont.c.

double mag

Definition at line 598 of file dvi2xx.h.

Definition at line 105 of file dvips.c.

Definition at line 84 of file dvips.c.

char* maxstring

Definition at line 92 of file dvips.c.

char * mflandmode

Definition at line 176 of file dvips.c.

char* mfmode

Definition at line 175 of file dvips.c.

Definition at line 177 of file dvips.c.

char* nextstring

Definition at line 92 of file dvips.c.

Definition at line 189 of file dvips.c.

Definition at line 63 of file dvips.c.

char* oname

Definition at line 88 of file dvips.c.

Definition at line 178 of file dvips.c.

Definition at line 102 of file dvips.c.

Definition at line 70 of file dvips.c.

char* paperfmt

Definition at line 107 of file dvips.c.

struct papsiz* papsizes

Definition at line 192 of file dvips.c.

Definition at line 56 of file dvips.c.

char * pictpath

Definition at line 148 of file dvips.c.

Definition at line 55 of file loadfont.c.

char* pkpath

Definition at line 136 of file dvips.c.

char* printer

Definition at line 174 of file dvips.c.

Definition at line 101 of file resident.c.

Definition at line 362 of file resident.c.

Definition at line 158 of file dvips.c.

Definition at line 113 of file dvips.c.

Definition at line 157 of file search.c.

Definition at line 62 of file dvips.c.

Definition at line 26 of file resident.c.

Definition at line 165 of file dvips.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 157 of file dvips.c.

char* tfmpath

Definition at line 135 of file dvips.c.

Definition at line 166 of file dvips.c.

Definition at line 104 of file dvips.c.

char* vfpath

Definition at line 137 of file dvips.c.

Definition at line 106 of file dvips.c.

Definition at line 83 of file dvips.c.

Definition at line 82 of file dvips.c.

char* warningmsg

Definition at line 171 of file dvips.c.

char was_inline[INLINE_SIZE] [static]

Definition at line 281 of file resident.c.