home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
gondwana.ecr.mu.oz.au/pub/
/
Graphics.tar
/
Graphics
/
VOGLE.ZIP
/
SRC
/
NEWTOKEN.C
< prev
next >
Wrap
C/C++ Source or Header
|
2000-02-11
|
864b
|
45 lines
#include <stdio.h>
#include "vogle.h"
static TokList *current;
/*
* newtokens
*
* returns the space for num tokens
*/
Token *
newtokens(num)
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);
}