new implementation for udata (again they are just void *);

new implementation for the API: most operations now do not disturb
structures lua2C and C2lua.
This commit is contained in:
Roberto Ierusalimschy
1997-06-09 14:28:14 -03:00
parent 5fdcfeb353
commit dd22ea4da5
7 changed files with 163 additions and 136 deletions

16
tree.h
View File

@@ -1,7 +1,7 @@
/*
** tree.h
** TecCGraf - PUC-Rio
** $Id: tree.h,v 1.16 1997/03/19 19:41:10 roberto Exp roberto $
** $Id: tree.h,v 1.17 1997/05/14 18:38:29 roberto Exp roberto $
*/
#ifndef tree_h
@@ -16,17 +16,21 @@ typedef struct TaggedString
{
int tag; /* if != LUA_T_STRING, this is a userdata */
struct TaggedString *next;
long size;
Word varindex; /* != NOT_USED if this is a symbol */
Word constindex; /* != NOT_USED if this is a constant */
union {
struct {
Word varindex; /* != NOT_USED if this is a symbol */
Word constindex; /* != NOT_USED if this is a constant */
} s;
void *v; /* if this is a userdata, here is its value */
} u;
unsigned long hash; /* 0 if not initialized */
int marked; /* for garbage collection; never collect (nor change) if > 1 */
char str[1]; /* \0 byte already reserved; MAY BE NOT 0 TERMINATED!! */
char str[1]; /* \0 byte already reserved */
} TaggedString;
TaggedString *lua_createstring (char *str);
TaggedString *luaI_createuserdata (char *buff, long size, int tag);
TaggedString *luaI_createudata (void *udata, int tag);
TaggedString *luaI_strcollector (long *cont);
void luaI_strfree (TaggedString *l);
void luaI_strcallIM (TaggedString *l);