home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
gondwana.ecr.mu.oz.au/pub/
/
Graphics.tar
/
Graphics
/
fermiVogle.tar.Z
/
fermiVogle.tar
/
devel
/
src
/
newtokens.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-07
|
814b
|
44 lines
#include <stdio.h>
#include "vogle.h"
static TokList *current;
/*
* newtokens
*
* returns the space for num tokens
*/
Token *
newtokens(int num)
{
TokList *tl;
Token *addr;
int size;
if (vdevice.tokens == (TokList *)NULL || num >= MAXTOKS - current->count) {
if ((tl = (TokList *)malloc(sizeof(TokList))) == (TokList *)NULL)
verror("newtokens: malloc returns NULL");
if (vdevice.tokens != (TokList *)NULL)
current->next = tl;
else
vdevice.tokens = tl;
tl->count = 0;
tl->next = (TokList *)NULL;
if (num > MAXTOKS)
size = num;
else
size = MAXTOKS;
if ((tl->toks = (Token *)malloc(size * sizeof(Token))) == (Token *)NULL)
verror("newtokens: malloc returns NULL");
current = tl;
}
addr = ¤t->toks[current->count];
current->count += num;
return(addr);
}