aboutsummaryrefslogtreecommitdiff
path: root/table.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-06-09 14:28:14 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-06-09 14:28:14 -0300
commitdd22ea4da550c3a158e0f11b928c349336184f85 (patch)
treeb73e2ae0498c4efa30dee04f710fb1a349f164ed /table.c
parent5fdcfeb353d726a9bcd6d4db5dd0b62b9b8e4b02 (diff)
downloadlua-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 'table.c')
-rw-r--r--table.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/table.c b/table.c
index 1f65b411..b8b2ced7 100644
--- a/table.c
+++ b/table.c
@@ -3,7 +3,7 @@
3** Module to control static tables 3** Module to control static tables
4*/ 4*/
5 5
6char *rcs_table="$Id: table.c,v 2.69 1997/05/14 18:38:29 roberto Exp roberto $"; 6char *rcs_table="$Id: table.c,v 2.70 1997/05/26 14:42:51 roberto Exp roberto $";
7 7
8#include "luamem.h" 8#include "luamem.h"
9#include "auxlib.h" 9#include "auxlib.h"
@@ -59,17 +59,17 @@ void luaI_initconstant (void)
59*/ 59*/
60Word luaI_findsymbol (TaggedString *t) 60Word luaI_findsymbol (TaggedString *t)
61{ 61{
62 if (t->varindex == NOT_USED) 62 if (t->u.s.varindex == NOT_USED)
63 { 63 {
64 if (lua_ntable == lua_maxsymbol) 64 if (lua_ntable == lua_maxsymbol)
65 lua_maxsymbol = growvector(&lua_table, lua_maxsymbol, Symbol, 65 lua_maxsymbol = growvector(&lua_table, lua_maxsymbol, Symbol,
66 symbolEM, MAX_WORD); 66 symbolEM, MAX_WORD);
67 t->varindex = lua_ntable; 67 t->u.s.varindex = lua_ntable;
68 lua_table[lua_ntable].varname = t; 68 lua_table[lua_ntable].varname = t;
69 s_ttype(lua_ntable) = LUA_T_NIL; 69 s_ttype(lua_ntable) = LUA_T_NIL;
70 lua_ntable++; 70 lua_ntable++;
71 } 71 }
72 return t->varindex; 72 return t->u.s.varindex;
73} 73}
74 74
75 75
@@ -85,16 +85,16 @@ Word luaI_findsymbolbyname (char *name)
85*/ 85*/
86Word luaI_findconstant (TaggedString *t) 86Word luaI_findconstant (TaggedString *t)
87{ 87{
88 if (t->constindex == NOT_USED) 88 if (t->u.s.constindex == NOT_USED)
89 { 89 {
90 if (lua_nconstant == lua_maxconstant) 90 if (lua_nconstant == lua_maxconstant)
91 lua_maxconstant = growvector(&lua_constant, lua_maxconstant, TaggedString *, 91 lua_maxconstant = growvector(&lua_constant, lua_maxconstant, TaggedString *,
92 constantEM, MAX_WORD); 92 constantEM, MAX_WORD);
93 t->constindex = lua_nconstant; 93 t->u.s.constindex = lua_nconstant;
94 lua_constant[lua_nconstant] = t; 94 lua_constant[lua_nconstant] = t;
95 lua_nconstant++; 95 lua_nconstant++;
96 } 96 }
97 return t->constindex; 97 return t->u.s.constindex;
98} 98}
99 99
100 100
@@ -154,7 +154,7 @@ int luaI_ismarked (TObject *o)
154{ 154{
155 switch (o->ttype) 155 switch (o->ttype)
156 { 156 {
157 case LUA_T_STRING: 157 case LUA_T_STRING: case LUA_T_USERDATA:
158 return o->value.ts->marked; 158 return o->value.ts->marked;
159 case LUA_T_FUNCTION: 159 case LUA_T_FUNCTION:
160 return o->value.tf->marked; 160 return o->value.tf->marked;
@@ -196,6 +196,7 @@ long lua_collectgarbage (long limit)
196 TaggedString *freestr; 196 TaggedString *freestr;
197 TFunc *freefunc; 197 TFunc *freefunc;
198 markall(); 198 markall();
199 luaI_invalidaterefs();
199 freetable = luaI_hashcollector(&recovered); 200 freetable = luaI_hashcollector(&recovered);
200 freestr = luaI_strcollector(&recovered); 201 freestr = luaI_strcollector(&recovered);
201 freefunc = luaI_funccollector(&recovered); 202 freefunc = luaI_funccollector(&recovered);