diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-09 14:28:14 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-09 14:28:14 -0300 |
| commit | dd22ea4da550c3a158e0f11b928c349336184f85 (patch) | |
| tree | b73e2ae0498c4efa30dee04f710fb1a349f164ed /tree.h | |
| parent | 5fdcfeb353d726a9bcd6d4db5dd0b62b9b8e4b02 (diff) | |
| download | lua-dd22ea4da550c3a158e0f11b928c349336184f85.tar.gz lua-dd22ea4da550c3a158e0f11b928c349336184f85.tar.bz2 lua-dd22ea4da550c3a158e0f11b928c349336184f85.zip | |
new implementation for udata (again they are just void *);
new implementation for the API: most operations now do not disturb
structures lua2C and C2lua.
Diffstat (limited to 'tree.h')
| -rw-r--r-- | tree.h | 16 |
1 files changed, 10 insertions, 6 deletions
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** tree.h | 2 | ** tree.h |
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | ** $Id: tree.h,v 1.16 1997/03/19 19:41:10 roberto Exp roberto $ | 4 | ** $Id: tree.h,v 1.17 1997/05/14 18:38:29 roberto Exp roberto $ |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef tree_h | 7 | #ifndef tree_h |
| @@ -16,17 +16,21 @@ typedef struct TaggedString | |||
| 16 | { | 16 | { |
| 17 | int tag; /* if != LUA_T_STRING, this is a userdata */ | 17 | int tag; /* if != LUA_T_STRING, this is a userdata */ |
| 18 | struct TaggedString *next; | 18 | struct TaggedString *next; |
| 19 | long size; | 19 | union { |
| 20 | Word varindex; /* != NOT_USED if this is a symbol */ | 20 | struct { |
| 21 | Word constindex; /* != NOT_USED if this is a constant */ | 21 | Word varindex; /* != NOT_USED if this is a symbol */ |
| 22 | Word constindex; /* != NOT_USED if this is a constant */ | ||
| 23 | } s; | ||
| 24 | void *v; /* if this is a userdata, here is its value */ | ||
| 25 | } u; | ||
| 22 | unsigned long hash; /* 0 if not initialized */ | 26 | unsigned long hash; /* 0 if not initialized */ |
| 23 | int marked; /* for garbage collection; never collect (nor change) if > 1 */ | 27 | int marked; /* for garbage collection; never collect (nor change) if > 1 */ |
| 24 | char str[1]; /* \0 byte already reserved; MAY BE NOT 0 TERMINATED!! */ | 28 | char str[1]; /* \0 byte already reserved */ |
| 25 | } TaggedString; | 29 | } TaggedString; |
| 26 | 30 | ||
| 27 | 31 | ||
| 28 | TaggedString *lua_createstring (char *str); | 32 | TaggedString *lua_createstring (char *str); |
| 29 | TaggedString *luaI_createuserdata (char *buff, long size, int tag); | 33 | TaggedString *luaI_createudata (void *udata, int tag); |
| 30 | TaggedString *luaI_strcollector (long *cont); | 34 | TaggedString *luaI_strcollector (long *cont); |
| 31 | void luaI_strfree (TaggedString *l); | 35 | void luaI_strfree (TaggedString *l); |
| 32 | void luaI_strcallIM (TaggedString *l); | 36 | void luaI_strcallIM (TaggedString *l); |
