Back to index

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

Go to the source code of this file.

Functions

int add_name P2C (char *, s, struct header_list **, what)
void checkhmem P1C (char *, s)
char *get_name P1C (struct header_list **, what)
void send_headers P1H (void)

Variables

struct header_listheader_head
char errbuf []
integer fontmem
integer swmem
char * headerpath
char * infont
int headersready
integer debug_flag

Function Documentation

void checkhmem P1C ( char *  ,
s   
)

Definition at line 64 of file header.c.

{
   FILE *f = search(headerpath, s, READBIN) ;

   if (f==0) {
      (void)sprintf(errbuf, "! Couldn't find header file %s", s) ;
      error(errbuf) ;
   } else {
      int len, i, j ;
      long mem = -1 ;
      char buf[1024] ;

      len = fread(buf, sizeof(char), 1024, f) ;
      for (i=0; i<len-20; i++)
         if (buf[i]=='%' && strncmp(buf+i, "%%VMusage:", 10)==0) {
            if (sscanf(buf+i+10, "%d %ld", &j, &mem) != 2)
               mem = -1 ;
            break ;
         }
      if (mem == -1) {
         mem = 0 ;
         while (len > 0) {
            mem += len ;
            len = fread(buf, sizeof(char), 1024, f) ;
         }
      }
      if (mem < 0)
         mem = DNFONTCOST ;
      (*close_file) (f) ;
#ifdef DEBUG
      if (dd(D_HEADER))
         (void)fprintf(stderr, "Adding header file \"%s\" %ld\n",
                                s, mem) ;
#endif
      fontmem -= mem ;
      if (fontmem > 0) /* so we don't count it twice. */
         swmem -= mem ;
   }
}

Here is the call graph for this function:

char* get_name P1C ( struct header_list **  ,
what   
)

Definition at line 133 of file header.c.

{
   if (what && *what) {
      char *p = (*what)->name ;
      infont = (*what)->Hname ;
      *what =  (*what)->next ;
      return p ;
   } else
      return 0 ;
}
void send_headers P1H ( void  ) [read]

Definition at line 147 of file header.c.

                       {
   struct header_list *p = header_head ;
   char *q ;

   while (0 != (q=get_name(&p))) {
#ifdef DEBUG
      if (dd(D_HEADER))
         (void)fprintf(stderr, "Sending header file \"%s\"\n", q) ;
#endif
#ifdef HPS
     if (HPS_FLAG) {
            if (strcmp(q,"target.dct")==0) noprocset = 1 ;
       }
#endif
      copyfile(q) ;
   }
   infont = 0 ;
}

Here is the call graph for this function:

int add_name P2C ( char *  ,
s  ,
struct header_list **  ,
what   
)

Definition at line 39 of file header.c.

{
   struct header_list *p, *q ;

   for (p = *what ; p != NULL; p = p->next)
      if (strcmp(p->name, s)==0)
         return 0 ;
   q = (struct header_list *)mymalloc((integer)(sizeof(struct header_list)
                                          + strlen(s))) ;
   q->Hname = infont ;
   q->next = NULL ;
   strcpy(q->name, s) ;
   if (*what == NULL)
      *what = q ;
   else {
      for (p = *what; p->next != NULL; p = p->next) ;
      p->next = q ;
   }
   return 1 ;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 199 of file dvips.c.

char errbuf[]

Definition at line 42 of file loadfont.c.

Definition at line 109 of file dvips.c.

Definition at line 15 of file header.c.

char* headerpath

Definition at line 139 of file dvips.c.

Definition at line 193 of file dvips.c.

char* infont

Definition at line 125 of file dvips.c.

Definition at line 157 of file dvips.c.