1994-11-16 20:39:16 +03:00
|
|
|
/*
|
|
|
|
** mem.c
|
|
|
|
** memory manager for lua
|
1996-05-24 18:31:10 +04:00
|
|
|
** $Id: mem.h,v 1.7 1996/04/22 18:00:37 roberto Exp roberto $
|
1994-11-16 20:39:16 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef mem_h
|
|
|
|
#define mem_h
|
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
#define NULL 0
|
|
|
|
#endif
|
|
|
|
|
1996-03-21 19:33:47 +03:00
|
|
|
|
|
|
|
/* memory error messages */
|
1996-03-21 21:55:02 +03:00
|
|
|
#define codeEM "code size overflow"
|
|
|
|
#define symbolEM "symbol table overflow"
|
|
|
|
#define constantEM "constant table overflow"
|
|
|
|
#define stackEM "stack size overflow"
|
|
|
|
#define lexEM "lex buffer overflow"
|
1996-04-22 22:00:37 +04:00
|
|
|
#define refEM "reference table overflow"
|
1996-03-21 21:55:02 +03:00
|
|
|
#define tableEM "table overflow"
|
|
|
|
#define memEM "not enough memory"
|
1996-03-21 19:33:47 +03:00
|
|
|
|
|
|
|
|
1994-11-16 20:39:16 +03:00
|
|
|
void luaI_free (void *block);
|
|
|
|
void *luaI_realloc (void *oldblock, unsigned long size);
|
1996-03-21 19:33:47 +03:00
|
|
|
void *luaI_buffer (unsigned long size);
|
|
|
|
int luaI_growvector (void **block, unsigned long nelems, int size,
|
1996-03-21 21:55:02 +03:00
|
|
|
char *errormsg, unsigned long limit);
|
1994-11-16 20:39:16 +03:00
|
|
|
|
1996-05-24 18:31:10 +04:00
|
|
|
#define luaI_malloc(s) luaI_realloc(NULL, (s))
|
1994-11-16 20:39:16 +03:00
|
|
|
#define new(s) ((s *)luaI_malloc(sizeof(s)))
|
|
|
|
#define newvector(n,s) ((s *)luaI_malloc((n)*sizeof(s)))
|
1996-03-21 19:33:47 +03:00
|
|
|
#define growvector(old,n,s,e,l) \
|
|
|
|
(luaI_growvector((void**)old,n,sizeof(s),e,l))
|
1994-11-16 20:39:16 +03:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|