diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-02-11 09:40:01 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-02-11 09:40:01 -0200 |
| commit | 205ee1ec84c0f0e9c2df923fdcfa29207e8e72b3 (patch) | |
| tree | 1e2683e673e5fbf2230343df4faac3b252eee38c /tree.h | |
| parent | b48847c5fac055f0d6120029f6fe1a50c852a8ac (diff) | |
| download | lua-205ee1ec84c0f0e9c2df923fdcfa29207e8e72b3.tar.gz lua-205ee1ec84c0f0e9c2df923fdcfa29207e8e72b3.tar.bz2 lua-205ee1ec84c0f0e9c2df923fdcfa29207e8e72b3.zip | |
userdata can handle arbitrary binary data;
user tag is stored with data;
Diffstat (limited to 'tree.h')
| -rw-r--r-- | tree.h | 7 |
1 files changed, 5 insertions, 2 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.13 1996/02/14 13:35:51 roberto Exp roberto $ | 4 | ** $Id: tree.h,v 1.14 1996/02/26 17:07:49 roberto Exp roberto $ |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef tree_h | 7 | #ifndef tree_h |
| @@ -14,15 +14,18 @@ | |||
| 14 | 14 | ||
| 15 | typedef struct TaggedString | 15 | typedef struct TaggedString |
| 16 | { | 16 | { |
| 17 | int tag; /* if != LUA_T_STRING, this is a userdata */ | ||
| 18 | long size; | ||
| 17 | Word varindex; /* != NOT_USED if this is a symbol */ | 19 | Word varindex; /* != NOT_USED if this is a symbol */ |
| 18 | Word constindex; /* != NOT_USED if this is a constant */ | 20 | Word constindex; /* != NOT_USED if this is a constant */ |
| 19 | unsigned long hash; /* 0 if not initialized */ | 21 | unsigned long hash; /* 0 if not initialized */ |
| 20 | int marked; /* for garbage collection; never collect (nor change) if > 1 */ | 22 | int marked; /* for garbage collection; never collect (nor change) if > 1 */ |
| 21 | char str[1]; /* \0 byte already reserved */ | 23 | char str[1]; /* \0 byte already reserved; MAY BE NOT 0 TERMINATED!! */ |
| 22 | } TaggedString; | 24 | } TaggedString; |
| 23 | 25 | ||
| 24 | 26 | ||
| 25 | TaggedString *lua_createstring (char *str); | 27 | TaggedString *lua_createstring (char *str); |
| 28 | TaggedString *luaI_createuserdata (char *buff, long size, int tag); | ||
| 26 | Long lua_strcollector (void); | 29 | Long lua_strcollector (void); |
| 27 | 30 | ||
| 28 | #endif | 31 | #endif |
