diff options
Diffstat (limited to 'fallback.c')
-rw-r--r-- | fallback.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_fallback="$Id: fallback.c,v 1.32 1997/03/21 18:37:28 roberto Exp roberto $"; | 6 | char *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 | ||
41 | static struct ref { | 41 | static 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; |
45 | static int refSize = 0; | 45 | static int refSize = 0; |
46 | 46 | ||
47 | int luaI_ref (Object *object, int lock) | 47 | int 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 | ||
76 | Object *luaI_getref (int ref) | 76 | TObject *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 | ||
89 | void luaI_travlock (int (*fn)(Object *)) | 89 | void 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 | ||
141 | static struct IM { | 141 | static 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 | ||
146 | static int IMtable_size = 0; | 146 | static int IMtable_size = 0; |
@@ -219,7 +219,7 @@ lua_Type luaI_typetag (int tag) | |||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | void luaI_settag (int tag, Object *o) | 222 | void 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 | ||
233 | int luaI_tag (Object *o) | 233 | int 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 | ||
244 | Object *luaI_getim (int tag, IMS event) | 244 | TObject *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 | ||
266 | static Object gmethod[GIM_N] = { | 266 | static 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 | ||
270 | Object *luaI_getgim (IMGS event) | 270 | TObject *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 | ||
285 | char *luaI_travfallbacks (int (*fn)(Object *)) | 285 | char *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 | ||
327 | static void fillvalids (IMS e, Object *func) | 327 | static 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) | |||
335 | void luaI_setfallback (void) | 335 | void 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); |