diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-06 15:00:19 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-06 15:00:19 -0300 |
commit | d5b83ead90fba27faa344c72406d85987d2460a4 (patch) | |
tree | 96d73c1b872b6b01a28c0586b871d37185034ba9 /lstring.h | |
parent | da673d31aaa05e8dff60c0b601b9f15c4f9182a8 (diff) | |
download | lua-d5b83ead90fba27faa344c72406d85987d2460a4.tar.gz lua-d5b83ead90fba27faa344c72406d85987d2460a4.tar.bz2 lua-d5b83ead90fba27faa344c72406d85987d2460a4.zip |
new implementation for userdatas, without `keys'
Diffstat (limited to 'lstring.h')
-rw-r--r-- | lstring.h | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.h,v 1.30 2001/02/20 18:15:33 roberto Exp roberto $ | 2 | ** $Id: lstring.h,v 1.31 2001/02/23 17:17:25 roberto Exp roberto $ |
3 | ** String table (keep all strings handled by Lua) | 3 | ** String table (keep all strings handled by Lua) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -14,6 +14,16 @@ | |||
14 | 14 | ||
15 | 15 | ||
16 | /* | 16 | /* |
17 | ** type equivalent to Udata, but with maximum alignment requirements | ||
18 | */ | ||
19 | union L_UUdata { | ||
20 | Udata u; | ||
21 | union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ | ||
22 | }; | ||
23 | |||
24 | |||
25 | |||
26 | /* | ||
17 | ** any TString with mark>=FIXMARK is never collected. | 27 | ** any TString with mark>=FIXMARK is never collected. |
18 | ** Marks>=RESERVEDMARK are used to identify reserved words. | 28 | ** Marks>=RESERVEDMARK are used to identify reserved words. |
19 | */ | 29 | */ |
@@ -24,16 +34,14 @@ | |||
24 | #define sizestring(l) ((lu_mem)sizeof(union L_UTString)+ \ | 34 | #define sizestring(l) ((lu_mem)sizeof(union L_UTString)+ \ |
25 | ((lu_mem)(l)+1)*sizeof(l_char)) | 35 | ((lu_mem)(l)+1)*sizeof(l_char)) |
26 | 36 | ||
27 | #define sizeudata(l) ((lu_mem)sizeof(union L_UTString)+(l)) | 37 | #define sizeudata(l) ((lu_mem)sizeof(union L_UUdata)+(l)) |
28 | 38 | ||
29 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) | 39 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) |
30 | #define luaS_newliteral(L, s) (luaS_newlstr(L, l_s("") s, \ | 40 | #define luaS_newliteral(L, s) (luaS_newlstr(L, l_s("") s, \ |
31 | (sizeof(s)/sizeof(l_char))-1)) | 41 | (sizeof(s)/sizeof(l_char))-1)) |
32 | 42 | ||
33 | void luaS_init (lua_State *L); | 43 | void luaS_resize (lua_State *L, int newsize); |
34 | void luaS_resize (lua_State *L, stringtable *tb, int newsize); | 44 | Udata *luaS_newudata (lua_State *L, size_t s); |
35 | TString *luaS_newudata (lua_State *L, size_t s, void *udata); | ||
36 | int luaS_createudata (lua_State *L, void *udata, TObject *o); | ||
37 | void luaS_freeall (lua_State *L); | 45 | void luaS_freeall (lua_State *L); |
38 | TString *luaS_newlstr (lua_State *L, const l_char *str, size_t l); | 46 | TString *luaS_newlstr (lua_State *L, const l_char *str, size_t l); |
39 | 47 | ||