Back to index

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

Go to the source code of this file.

Functions

char * Xalloc ()
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
char * tokenMaxP

Function Documentation

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

Definition at line 155 of file util.c.

{
  if (objP != NULL) {
    objP->type        = OBJ_ARRAY;
    objP->len         = length;
    objP->data.arrayP = valueP;
  }
}

Here is the caller graph for this function:

void objFormatBoolean ( psobj objP,
boolean  value 
)

Definition at line 126 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_BOOLEAN;
    objP->len          = 0;
    objP->data.boolean = value;
  }
}

Here is the caller graph for this function:

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

Definition at line 140 of file util.c.

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

Here is the caller graph for this function:

void objFormatFile ( psobj objP,
FILE valueP 
)

Definition at line 201 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_FILE;
    objP->len          = 0;
    objP->data.fileP   = valueP;
  }
}

Here is the caller graph for this function:

void objFormatInteger ( psobj objP,
int  value 
)

Definition at line 94 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_INTEGER;
    objP->len          = 0;
    objP->data.integer = value;
  }
}

Here is the caller graph for this function:

void objFormatName ( psobj objP,
int  length,
char *  valueP 
)

Definition at line 186 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_NAME;
    objP->len          = length;
    objP->data.nameP   = valueP;
  }
}

Here is the caller graph for this function:

void objFormatReal ( psobj objP,
float  value 
)

Definition at line 113 of file util.c.

{
  if (objP != NULL) {
    objP->type       = OBJ_REAL;
    objP->len        = 0;
    objP->data.real  = value;
  }
}

Here is the caller graph for this function:

void objFormatString ( psobj objP,
int  length,
char *  valueP 
)

Definition at line 171 of file util.c.

{
  if (objP != NULL) {
    objP->type         = OBJ_STRING;
    objP->len          = length;
    objP->data.valueP  = valueP;
  }
}

Here is the caller graph for this function:

char* vm_alloc ( unsigned int  bytes)

Definition at line 64 of file util.c.

{
  char *answer;
 
  /* Round to next LONG multiple (32-bit) */
#if defined(sun) || defined(__hpux) || defined(__alpha)
  bytes = (bytes + 7) & ~7;
#else
  bytes = (bytes + 3) & ~3;
#endif
 
  /* take space from what is left otherwise allocate another CHUNK */
  if (bytes > vm_free)
    if (!vm_init()) return NULL;
  if (bytes <= vm_free) {
    answer = vm_next;
    vm_free -= bytes;
    vm_next += bytes;
    return answer;
  }
  else {
    printf("Trying to allocate %d bytes (%d maximum)\n", bytes, MAX_STRING_LEN);
    return NULL; 
  }
}

Here is the call graph for this function:

Definition at line 50 of file util.c.

Here is the call graph for this function:

char* Xalloc ( )

Variable Documentation

char* tokenMaxP

Definition at line 49 of file token.c.

char* vm_base = NULL [static]

Definition at line 39 of file util.c.

Definition at line 41 of file util.c.

char* vm_next = NULL

Definition at line 40 of file util.c.

Definition at line 42 of file util.c.