aboutsummaryrefslogtreecommitdiff
path: root/fallback.c
diff options
context:
space:
mode:
Diffstat (limited to 'fallback.c')
-rw-r--r--fallback.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/fallback.c b/fallback.c
index 3e4d6c3b..32ff53d8 100644
--- a/fallback.c
+++ b/fallback.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_fallback="$Id: fallback.c,v 1.32 1997/03/21 18:37:28 roberto Exp roberto $"; 6char *rcs_fallback="$Id: fallback.c,v 1.33 1997/03/24 17:13:22 roberto Exp roberto $";
7 7
8#include <stdio.h> 8#include <stdio.h>
9#include <string.h> 9#include <string.h>
@@ -39,12 +39,12 @@ void luaI_type (void)
39*/ 39*/
40 40
41static struct ref { 41static struct ref {
42 Object o; 42 TObject o;
43 enum {LOCK, HOLD, FREE, COLLECTED} status; 43 enum {LOCK, HOLD, FREE, COLLECTED} status;
44} *refArray = NULL; 44} *refArray = NULL;
45static int refSize = 0; 45static int refSize = 0;
46 46
47int luaI_ref (Object *object, int lock) 47int luaI_ref (TObject *object, int lock)
48{ 48{
49 int i; 49 int i;
50 int oldSize; 50 int oldSize;
@@ -73,9 +73,9 @@ void lua_unref (int ref)
73} 73}
74 74
75 75
76Object *luaI_getref (int ref) 76TObject *luaI_getref (int ref)
77{ 77{
78 static Object nul = {LUA_T_NIL, {0}}; 78 static TObject nul = {LUA_T_NIL, {0}};
79 if (ref == -1) 79 if (ref == -1)
80 return &nul; 80 return &nul;
81 if (ref >= 0 && ref < refSize && 81 if (ref >= 0 && ref < refSize &&
@@ -86,7 +86,7 @@ Object *luaI_getref (int ref)
86} 86}
87 87
88 88
89void luaI_travlock (int (*fn)(Object *)) 89void luaI_travlock (int (*fn)(TObject *))
90{ 90{
91 int i; 91 int i;
92 for (i=0; i<refSize; i++) 92 for (i=0; i<refSize; i++)
@@ -140,7 +140,7 @@ static int luaI_checkevent (char *name, char *list[])
140 140
141static struct IM { 141static struct IM {
142 lua_Type tp; 142 lua_Type tp;
143 Object int_method[IM_N]; 143 TObject int_method[IM_N];
144} *luaI_IMtable = NULL; 144} *luaI_IMtable = NULL;
145 145
146static int IMtable_size = 0; 146static int IMtable_size = 0;
@@ -219,7 +219,7 @@ lua_Type luaI_typetag (int tag)
219 } 219 }
220} 220}
221 221
222void luaI_settag (int tag, Object *o) 222void luaI_settag (int tag, TObject *o)
223{ 223{
224 if (ttype(o) != luaI_typetag(tag)) 224 if (ttype(o) != luaI_typetag(tag))
225 lua_error("Tag is not compatible with this type"); 225 lua_error("Tag is not compatible with this type");
@@ -230,7 +230,7 @@ void luaI_settag (int tag, Object *o)
230} 230}
231 231
232 232
233int luaI_tag (Object *o) 233int luaI_tag (TObject *o)
234{ 234{
235 lua_Type t = ttype(o); 235 lua_Type t = ttype(o);
236 if (t == LUA_T_USERDATA) 236 if (t == LUA_T_USERDATA)
@@ -241,7 +241,7 @@ int luaI_tag (Object *o)
241} 241}
242 242
243 243
244Object *luaI_getim (int tag, IMS event) 244TObject *luaI_getim (int tag, IMS event)
245{ 245{
246 if (tag > LUA_T_USERDATA) 246 if (tag > LUA_T_USERDATA)
247 tag = LUA_T_USERDATA; /* default for non-registered tags */ 247 tag = LUA_T_USERDATA; /* default for non-registered tags */
@@ -263,11 +263,11 @@ void luaI_setintmethod (void)
263 luaI_IMtable[-t].int_method[e] = *luaI_Address(func); 263 luaI_IMtable[-t].int_method[e] = *luaI_Address(func);
264} 264}
265 265
266static Object gmethod[GIM_N] = { 266static TObject gmethod[GIM_N] = {
267 {LUA_T_NIL, {NULL}}, {LUA_T_NIL, {NULL}}, {LUA_T_NIL, {NULL}} 267 {LUA_T_NIL, {NULL}}, {LUA_T_NIL, {NULL}}, {LUA_T_NIL, {NULL}}
268}; 268};
269 269
270Object *luaI_getgim (IMGS event) 270TObject *luaI_getgim (IMGS event)
271{ 271{
272 return &gmethod[event]; 272 return &gmethod[event];
273} 273}
@@ -282,7 +282,7 @@ void luaI_setglobalmethod (void)
282 gmethod[e] = *luaI_Address(func); 282 gmethod[e] = *luaI_Address(func);
283} 283}
284 284
285char *luaI_travfallbacks (int (*fn)(Object *)) 285char *luaI_travfallbacks (int (*fn)(TObject *))
286{ 286{
287 int e; 287 int e;
288 for (e=GIM_ERROR; e<=GIM_SETGLOBAL; e++) { /* ORDER GIM */ 288 for (e=GIM_ERROR; e<=GIM_SETGLOBAL; e++) { /* ORDER GIM */
@@ -324,7 +324,7 @@ static void typeFB (void)
324} 324}
325 325
326 326
327static void fillvalids (IMS e, Object *func) 327static void fillvalids (IMS e, TObject *func)
328{ 328{
329 int t; 329 int t;
330 for (t=LUA_T_NIL; t<=LUA_T_USERDATA; t++) 330 for (t=LUA_T_NIL; t<=LUA_T_USERDATA; t++)
@@ -335,7 +335,7 @@ static void fillvalids (IMS e, Object *func)
335void luaI_setfallback (void) 335void luaI_setfallback (void)
336{ 336{
337 int e; 337 int e;
338 Object oldfunc; 338 TObject oldfunc;
339 lua_CFunction replace; 339 lua_CFunction replace;
340 char *name = luaL_check_string(1, "setfallback"); 340 char *name = luaL_check_string(1, "setfallback");
341 lua_Object func = lua_getparam(2); 341 lua_Object func = lua_getparam(2);