Back to index

tetex-bin  3.0
Functions | Variables
util.c File Reference
#include "types.h"
#include <stdio.h>
#include <stdlib.h>
#include "util.h"
#include "fontmisc.h"

Go to the source code of this file.

Functions

boolean vm_init ()
char * vm_alloc (unsigned int bytes)
void objFormatInteger (psobj *objP, int value)
void objFormatReal (psobj *objP, float value)
void objFormatBoolean (psobj *objP, boolean value)
void objFormatEncoding (psobj *objP, int length, psobj *valueP)
void objFormatArray (psobj *objP, int length, psobj *valueP)
void objFormatString (psobj *objP, int length, char *valueP)
void objFormatName (psobj *objP, int length, char *valueP)
void objFormatFile (psobj *objP, FILE *valueP)

Variables

static char * vm_base = NULL
char * vm_next = NULL
LONG vm_free = 0
LONG vm_size = 0
int vm_init_count
int vm_init_amount
char * tokenMaxP

Function Documentation

void objFormatArray ( psobj objP,
int  length,
psobj valueP 
)

Definition at line 159 of file util.c.

{
  if (objP != NULL) {
    objP->type        = OBJ_ARRAY;
    objP->len         = length;
    objP->data.arrayP = valueP;
  }
}
void objFormatBoolean ( psobj objP,
boolean  value 
)

Definition at line 135 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_BOOLEAN;
    objP->len          = 0;
    objP->data.boolean = value;
  }
}
void objFormatEncoding ( psobj objP,
int  length,
psobj valueP 
)

Definition at line 147 of file util.c.

{
  if (objP != NULL) {
    objP->type        = OBJ_ENCODING;
    objP->len         = length;
    objP->data.arrayP = valueP;
  }
}
void objFormatFile ( psobj objP,
FILE valueP 
)

Definition at line 196 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_FILE;
    objP->len          = 0;
    objP->data.fileP   = valueP;
  }
}
void objFormatInteger ( psobj objP,
int  value 
)

Definition at line 111 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_INTEGER;
    objP->len          = 0;
    objP->data.integer = value;
  }
}
void objFormatName ( psobj objP,
int  length,
char *  valueP 
)

Definition at line 184 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_NAME;
    objP->len          = length;
    objP->data.nameP   = valueP;
  }
}
void objFormatReal ( psobj objP,
float  value 
)

Definition at line 123 of file util.c.

{
  if (objP != NULL) {
    objP->type       = OBJ_REAL;
    objP->len        = 0;
    objP->data.real  = value;
  }
}
void objFormatString ( psobj objP,
int  length,
char *  valueP 
)

Definition at line 172 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_STRING;
    objP->len          = length;
    objP->data.valueP  = valueP;
  }
}
char* vm_alloc ( unsigned int  bytes)

Definition at line 83 of file util.c.

{
  char *answer;
 
  /* Align returned bytes to 64-bit boundary */
  bytes = (bytes + 7) & ~7;
  
  
  /* take space from what is left otherwise allocate another CHUNK */
  if (bytes > vm_free){
    if (!vm_init()) return NULL;
  }
  else{
    answer = vm_next;
    vm_free -= bytes;
    vm_next += bytes;
    return answer;
  }

  /* Never reached, but compiler is happy: */
  return NULL;
  
}

Here is the caller graph for this function:

Definition at line 58 of file util.c.

{
  /* Check whether it is the first piece of memory for the
     current font or not. If so, simulate lacking memory to
     indicate that the font should be tried to load with a
     vitual memory twice as large!
     */
  if (vm_init_count>0){
    vm_init_count++;
    return(FALSE);
  }
  vm_init_count++;
  
  vm_next = vm_base = (char *) calloc( vm_init_amount, sizeof(char));

  if (vm_base != NULL) {
    vm_free = vm_init_amount;
    vm_size = vm_init_amount;
    tokenMaxP = vm_next_byte() + vm_init_amount;
    return(TRUE);
  }
  else
    return(FALSE);
}

Here is the caller graph for this function:


Variable Documentation

char* tokenMaxP

Definition at line 49 of file token.c.

char* vm_base = NULL [static]

Definition at line 38 of file util.c.

Definition at line 40 of file util.c.

Definition at line 49 of file util.c.

Definition at line 47 of file util.c.

char* vm_next = NULL

Definition at line 39 of file util.c.

Definition at line 41 of file util.c.