diff options
Diffstat (limited to 'table.c')
-rw-r--r-- | table.c | 36 |
1 files changed, 17 insertions, 19 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** Module to control static tables | 3 | ** Module to control static tables |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_table="$Id: table.c,v 2.46 1996/02/14 13:35:51 roberto Exp roberto $"; | 6 | char *rcs_table="$Id: table.c,v 2.47 1996/02/14 18:25:04 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include "mem.h" | 8 | #include "mem.h" |
9 | #include "opcode.h" | 9 | #include "opcode.h" |
@@ -39,19 +39,19 @@ static struct { | |||
39 | char *name; | 39 | char *name; |
40 | lua_CFunction func; | 40 | lua_CFunction func; |
41 | } int_funcs[] = { | 41 | } int_funcs[] = { |
42 | {"nextvar", lua_nextvar}, | 42 | {"assert", luaI_assert}, |
43 | {"dofile", lua_internaldofile}, | ||
44 | {"dostring", lua_internaldostring}, | ||
43 | {"error", luaI_error}, | 45 | {"error", luaI_error}, |
44 | {"tonumber", lua_obj2number}, | 46 | {"getglobal", luaI_getglobal}, |
45 | {"setfallback", luaI_setfallback}, | ||
46 | {"next", lua_next}, | 47 | {"next", lua_next}, |
47 | {"dofile", lua_internaldofile}, | 48 | {"nextvar", lua_nextvar}, |
49 | {"print", luaI_print}, | ||
50 | {"setfallback", luaI_setfallback}, | ||
48 | {"setglobal", luaI_setglobal}, | 51 | {"setglobal", luaI_setglobal}, |
49 | {"getglobal", luaI_getglobal}, | 52 | {"tonumber", lua_obj2number}, |
50 | {"type", luaI_type}, | ||
51 | {"tostring", luaI_tostring}, | 53 | {"tostring", luaI_tostring}, |
52 | {"print", luaI_print}, | 54 | {"type", luaI_type} |
53 | {"dostring", lua_internaldostring}, | ||
54 | {"assert", luaI_assert} | ||
55 | }; | 55 | }; |
56 | 56 | ||
57 | #define INTFUNCSIZE (sizeof(int_funcs)/sizeof(int_funcs[0])) | 57 | #define INTFUNCSIZE (sizeof(int_funcs)/sizeof(int_funcs[0])) |
@@ -100,8 +100,6 @@ Word luaI_findsymbol (TaggedString *t) | |||
100 | lua_table[lua_ntable].varname = t; | 100 | lua_table[lua_ntable].varname = t; |
101 | s_tag(lua_ntable) = LUA_T_NIL; | 101 | s_tag(lua_ntable) = LUA_T_NIL; |
102 | lua_ntable++; | 102 | lua_ntable++; |
103 | if (!t->marked) | ||
104 | t->marked = 2; /* avoid GC */ | ||
105 | } | 103 | } |
106 | return t->varindex; | 104 | return t->varindex; |
107 | } | 105 | } |
@@ -109,7 +107,7 @@ Word luaI_findsymbol (TaggedString *t) | |||
109 | 107 | ||
110 | Word luaI_findsymbolbyname (char *name) | 108 | Word luaI_findsymbolbyname (char *name) |
111 | { | 109 | { |
112 | return luaI_findsymbol(lua_createstring(name)); | 110 | return luaI_findsymbol(luaI_createfixedstring(name)); |
113 | } | 111 | } |
114 | 112 | ||
115 | 113 | ||
@@ -133,8 +131,6 @@ Word luaI_findconstant (TaggedString *t) | |||
133 | t->constindex = lua_nconstant; | 131 | t->constindex = lua_nconstant; |
134 | lua_constant[lua_nconstant] = t; | 132 | lua_constant[lua_nconstant] = t; |
135 | lua_nconstant++; | 133 | lua_nconstant++; |
136 | if (!t->marked) | ||
137 | t->marked = 2; /* avoid GC */ | ||
138 | } | 134 | } |
139 | return t->constindex; | 135 | return t->constindex; |
140 | } | 136 | } |
@@ -142,13 +138,15 @@ Word luaI_findconstant (TaggedString *t) | |||
142 | 138 | ||
143 | Word luaI_findconstantbyname (char *name) | 139 | Word luaI_findconstantbyname (char *name) |
144 | { | 140 | { |
145 | return luaI_findconstant(lua_createstring(name)); | 141 | return luaI_findconstant(luaI_createfixedstring(name)); |
146 | } | 142 | } |
147 | 143 | ||
148 | TaggedString *lua_constcreate(char *name) | 144 | TaggedString *luaI_createfixedstring (char *name) |
149 | { | 145 | { |
150 | int i = luaI_findconstantbyname(name); | 146 | TaggedString *ts = lua_createstring(name); |
151 | return lua_constant[i]; | 147 | if (!ts->marked) |
148 | ts->marked = 2; /* avoid GC */ | ||
149 | return ts; | ||
152 | } | 150 | } |
153 | 151 | ||
154 | 152 | ||