diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-31 11:02:58 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-31 11:02:58 -0300 |
commit | ad5574c4c97af3ef863a6fb4b72142f3780103b2 (patch) | |
tree | 7ef70322749e3e433321edbea89d61087d820c55 | |
parent | 264f8c5e7bd168de2f0ca07399e6fc70d5a820d3 (diff) | |
download | lua-ad5574c4c97af3ef863a6fb4b72142f3780103b2.tar.gz lua-ad5574c4c97af3ef863a6fb4b72142f3780103b2.tar.bz2 lua-ad5574c4c97af3ef863a6fb4b72142f3780103b2.zip |
"Object" renamed to "TObject" (Tagged Object), to avoid conflicts with
pre-defined names in some C compilers.
-rw-r--r-- | fallback.c | 30 | ||||
-rw-r--r-- | fallback.h | 18 | ||||
-rw-r--r-- | func.c | 2 | ||||
-rw-r--r-- | hash.c | 14 | ||||
-rw-r--r-- | hash.h | 12 | ||||
-rw-r--r-- | opcode.c | 118 | ||||
-rw-r--r-- | opcode.h | 14 | ||||
-rw-r--r-- | table.c | 14 | ||||
-rw-r--r-- | table.h | 8 | ||||
-rw-r--r-- | tree.c | 4 |
10 files changed, 117 insertions, 117 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); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: fallback.h,v 1.16 1997/03/20 19:20:43 roberto Exp roberto $ | 2 | ** $Id: fallback.h,v 1.17 1997/03/24 17:13:22 roberto Exp roberto $ |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef fallback_h | 5 | #ifndef fallback_h |
@@ -49,19 +49,19 @@ typedef enum { | |||
49 | #define GIM_N 3 | 49 | #define GIM_N 3 |
50 | 50 | ||
51 | void luaI_setfallback (void); | 51 | void luaI_setfallback (void); |
52 | int luaI_ref (Object *object, int lock); | 52 | int luaI_ref (TObject *object, int lock); |
53 | Object *luaI_getref (int ref); | 53 | TObject *luaI_getref (int ref); |
54 | void luaI_travlock (int (*fn)(Object *)); | 54 | void luaI_travlock (int (*fn)(TObject *)); |
55 | void luaI_invalidaterefs (void); | 55 | void luaI_invalidaterefs (void); |
56 | char *luaI_travfallbacks (int (*fn)(Object *)); | 56 | char *luaI_travfallbacks (int (*fn)(TObject *)); |
57 | 57 | ||
58 | void luaI_type (void); | 58 | void luaI_type (void); |
59 | void luaI_settag (int tag, Object *o); | 59 | void luaI_settag (int tag, TObject *o); |
60 | lua_Type luaI_typetag (int tag); | 60 | lua_Type luaI_typetag (int tag); |
61 | Object *luaI_getim (int tag, IMS event); | 61 | TObject *luaI_getim (int tag, IMS event); |
62 | #define luaI_getimbyObj(o,e) (luaI_getim(luaI_tag(o),(e))) | 62 | #define luaI_getimbyObj(o,e) (luaI_getim(luaI_tag(o),(e))) |
63 | Object *luaI_getgim (IMGS event); | 63 | TObject *luaI_getgim (IMGS event); |
64 | int luaI_tag (Object *o); | 64 | int luaI_tag (TObject *o); |
65 | void luaI_setintmethod (void); | 65 | void luaI_setintmethod (void); |
66 | void luaI_setglobalmethod (void); | 66 | void luaI_setglobalmethod (void); |
67 | void luaI_initfallbacks (void); | 67 | void luaI_initfallbacks (void); |
@@ -83,7 +83,7 @@ Long luaI_funccollector (void) | |||
83 | 83 | ||
84 | void lua_funcinfo (lua_Object func, char **filename, int *linedefined) | 84 | void lua_funcinfo (lua_Object func, char **filename, int *linedefined) |
85 | { | 85 | { |
86 | Object *f = luaI_Address(func); | 86 | TObject *f = luaI_Address(func); |
87 | if (f->ttype == LUA_T_MARK || f->ttype == LUA_T_FUNCTION) | 87 | if (f->ttype == LUA_T_MARK || f->ttype == LUA_T_FUNCTION) |
88 | { | 88 | { |
89 | *filename = f->value.tf->fileName; | 89 | *filename = f->value.tf->fileName; |
@@ -3,7 +3,7 @@ | |||
3 | ** hash manager for lua | 3 | ** hash manager for lua |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_hash="$Id: hash.c,v 2.36 1997/03/19 19:41:10 roberto Exp roberto $"; | 6 | char *rcs_hash="$Id: hash.c,v 2.37 1997/03/21 18:52:37 roberto Exp roberto $"; |
7 | 7 | ||
8 | 8 | ||
9 | #include "mem.h" | 9 | #include "mem.h" |
@@ -48,7 +48,7 @@ int luaI_redimension (int nhash) | |||
48 | return 0; /* to avoid warnings */ | 48 | return 0; /* to avoid warnings */ |
49 | } | 49 | } |
50 | 50 | ||
51 | static int hashindex (Hash *t, Object *ref) /* hash function */ | 51 | static int hashindex (Hash *t, TObject *ref) /* hash function */ |
52 | { | 52 | { |
53 | long int h; | 53 | long int h; |
54 | switch (ttype(ref)) { | 54 | switch (ttype(ref)) { |
@@ -70,7 +70,7 @@ static int hashindex (Hash *t, Object *ref) /* hash function */ | |||
70 | return h%nhash(t); /* make it a valid index */ | 70 | return h%nhash(t); /* make it a valid index */ |
71 | } | 71 | } |
72 | 72 | ||
73 | int lua_equalObj (Object *t1, Object *t2) | 73 | int lua_equalObj (TObject *t1, TObject *t2) |
74 | { | 74 | { |
75 | if (ttype(t1) != ttype(t2)) return 0; | 75 | if (ttype(t1) != ttype(t2)) return 0; |
76 | switch (ttype(t1)) | 76 | switch (ttype(t1)) |
@@ -87,7 +87,7 @@ int lua_equalObj (Object *t1, Object *t2) | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | static int present (Hash *t, Object *ref) | 90 | static int present (Hash *t, TObject *ref) |
91 | { | 91 | { |
92 | int h = hashindex(t, ref); | 92 | int h = hashindex(t, ref); |
93 | while (ttype(ref(node(t, h))) != LUA_T_NIL) | 93 | while (ttype(ref(node(t, h))) != LUA_T_NIL) |
@@ -162,7 +162,7 @@ void lua_hashmark (Hash *h) | |||
162 | void luaI_hashcallIM (void) | 162 | void luaI_hashcallIM (void) |
163 | { | 163 | { |
164 | Hash *curr_array; | 164 | Hash *curr_array; |
165 | Object t; | 165 | TObject t; |
166 | ttype(&t) = LUA_T_ARRAY; | 166 | ttype(&t) = LUA_T_ARRAY; |
167 | for (curr_array = listhead; curr_array; curr_array = curr_array->next) | 167 | for (curr_array = listhead; curr_array; curr_array = curr_array->next) |
168 | if (markarray(curr_array) != 1) | 168 | if (markarray(curr_array) != 1) |
@@ -242,7 +242,7 @@ static void rehash (Hash *t) | |||
242 | ** If the hash node is present, return its pointer, otherwise return | 242 | ** If the hash node is present, return its pointer, otherwise return |
243 | ** null. | 243 | ** null. |
244 | */ | 244 | */ |
245 | Object *lua_hashget (Hash *t, Object *ref) | 245 | TObject *lua_hashget (Hash *t, TObject *ref) |
246 | { | 246 | { |
247 | int h = present(t, ref); | 247 | int h = present(t, ref); |
248 | if (ttype(ref(node(t, h))) != LUA_T_NIL) return val(node(t, h)); | 248 | if (ttype(ref(node(t, h))) != LUA_T_NIL) return val(node(t, h)); |
@@ -254,7 +254,7 @@ Object *lua_hashget (Hash *t, Object *ref) | |||
254 | ** If the hash node is present, return its pointer, otherwise create a new | 254 | ** If the hash node is present, return its pointer, otherwise create a new |
255 | ** node for the given reference and also return its pointer. | 255 | ** node for the given reference and also return its pointer. |
256 | */ | 256 | */ |
257 | Object *lua_hashdefine (Hash *t, Object *ref) | 257 | TObject *lua_hashdefine (Hash *t, TObject *ref) |
258 | { | 258 | { |
259 | int h; | 259 | int h; |
260 | Node *n; | 260 | Node *n; |
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | ** hash.h | 2 | ** hash.h |
3 | ** hash manager for lua | 3 | ** hash manager for lua |
4 | ** $Id: hash.h,v 2.13 1997/02/26 17:38:41 roberto Unstable roberto $ | 4 | ** $Id: hash.h,v 2.14 1997/03/19 19:41:10 roberto Exp roberto $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef hash_h | 7 | #ifndef hash_h |
@@ -11,8 +11,8 @@ | |||
11 | #include "opcode.h" | 11 | #include "opcode.h" |
12 | 12 | ||
13 | typedef struct node { | 13 | typedef struct node { |
14 | Object ref; | 14 | TObject ref; |
15 | Object val; | 15 | TObject val; |
16 | } Node; | 16 | } Node; |
17 | 17 | ||
18 | typedef struct Hash { | 18 | typedef struct Hash { |
@@ -25,14 +25,14 @@ typedef struct Hash { | |||
25 | } Hash; | 25 | } Hash; |
26 | 26 | ||
27 | 27 | ||
28 | int lua_equalObj (Object *t1, Object *t2); | 28 | int lua_equalObj (TObject *t1, TObject *t2); |
29 | int luaI_redimension (int nhash); | 29 | int luaI_redimension (int nhash); |
30 | Hash *lua_createarray (int nhash); | 30 | Hash *lua_createarray (int nhash); |
31 | void lua_hashmark (Hash *h); | 31 | void lua_hashmark (Hash *h); |
32 | Long lua_hashcollector (void); | 32 | Long lua_hashcollector (void); |
33 | void luaI_hashcallIM (void); | 33 | void luaI_hashcallIM (void); |
34 | Object *lua_hashget (Hash *t, Object *ref); | 34 | TObject *lua_hashget (Hash *t, TObject *ref); |
35 | Object *lua_hashdefine (Hash *t, Object *ref); | 35 | TObject *lua_hashdefine (Hash *t, TObject *ref); |
36 | void lua_next (void); | 36 | void lua_next (void); |
37 | 37 | ||
38 | #endif | 38 | #endif |
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_opcode="$Id: opcode.c,v 3.85 1997/03/19 19:41:10 roberto Exp roberto $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 3.86 1997/03/20 19:20:43 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
@@ -32,14 +32,14 @@ char *rcs_opcode="$Id: opcode.c,v 3.85 1997/03/19 19:41:10 roberto Exp roberto $ | |||
32 | 32 | ||
33 | typedef int StkId; /* index to stack elements */ | 33 | typedef int StkId; /* index to stack elements */ |
34 | 34 | ||
35 | static Object initial_stack; | 35 | static TObject initial_stack; |
36 | 36 | ||
37 | static Object *stackLimit = &initial_stack+1; | 37 | static TObject *stackLimit = &initial_stack+1; |
38 | static Object *stack = &initial_stack; | 38 | static TObject *stack = &initial_stack; |
39 | static Object *top = &initial_stack; | 39 | static TObject *top = &initial_stack; |
40 | 40 | ||
41 | 41 | ||
42 | /* macros to convert from lua_Object to (Object *) and back */ | 42 | /* macros to convert from lua_Object to (TObject *) and back */ |
43 | 43 | ||
44 | #define Address(lo) ((lo)+stack-1) | 44 | #define Address(lo) ((lo)+stack-1) |
45 | #define Ref(st) ((st)-stack+1) | 45 | #define Ref(st) ((st)-stack+1) |
@@ -72,7 +72,7 @@ static void do_call (StkId base, int nResults); | |||
72 | 72 | ||
73 | 73 | ||
74 | 74 | ||
75 | Object *luaI_Address (lua_Object o) | 75 | TObject *luaI_Address (lua_Object o) |
76 | { | 76 | { |
77 | return Address(o); | 77 | return Address(o); |
78 | } | 78 | } |
@@ -84,7 +84,7 @@ Object *luaI_Address (lua_Object o) | |||
84 | static void lua_initstack (void) | 84 | static void lua_initstack (void) |
85 | { | 85 | { |
86 | Long maxstack = STACK_SIZE; | 86 | Long maxstack = STACK_SIZE; |
87 | stack = newvector(maxstack, Object); | 87 | stack = newvector(maxstack, TObject); |
88 | stackLimit = stack+maxstack; | 88 | stackLimit = stack+maxstack; |
89 | top = stack; | 89 | top = stack; |
90 | *(top++) = initial_stack; | 90 | *(top++) = initial_stack; |
@@ -105,7 +105,7 @@ static void growstack (void) | |||
105 | static int limit = STACK_LIMIT; | 105 | static int limit = STACK_LIMIT; |
106 | StkId t = top-stack; | 106 | StkId t = top-stack; |
107 | Long stacksize = stackLimit - stack; | 107 | Long stacksize = stackLimit - stack; |
108 | stacksize = growvector(&stack, stacksize, Object, stackEM, limit+100); | 108 | stacksize = growvector(&stack, stacksize, TObject, stackEM, limit+100); |
109 | stackLimit = stack+stacksize; | 109 | stackLimit = stack+stacksize; |
110 | top = stack + t; | 110 | top = stack + t; |
111 | if (stacksize >= limit) | 111 | if (stacksize >= limit) |
@@ -134,7 +134,7 @@ static char *lua_strconc (char *l, char *r) | |||
134 | ** Convert, if possible, to a number object. | 134 | ** Convert, if possible, to a number object. |
135 | ** Return 0 if success, not 0 if error. | 135 | ** Return 0 if success, not 0 if error. |
136 | */ | 136 | */ |
137 | static int lua_tonumber (Object *obj) | 137 | static int lua_tonumber (TObject *obj) |
138 | { | 138 | { |
139 | float t; | 139 | float t; |
140 | char c; | 140 | char c; |
@@ -155,7 +155,7 @@ static int lua_tonumber (Object *obj) | |||
155 | ** Convert, if possible, to a string ttype | 155 | ** Convert, if possible, to a string ttype |
156 | ** Return 0 in success or not 0 on error. | 156 | ** Return 0 in success or not 0 on error. |
157 | */ | 157 | */ |
158 | static int lua_tostring (Object *obj) | 158 | static int lua_tostring (TObject *obj) |
159 | { | 159 | { |
160 | if (ttype(obj) != LUA_T_NUMBER) | 160 | if (ttype(obj) != LUA_T_NUMBER) |
161 | return 1; | 161 | return 1; |
@@ -179,7 +179,7 @@ static int lua_tostring (Object *obj) | |||
179 | */ | 179 | */ |
180 | static void adjust_top (StkId newtop) | 180 | static void adjust_top (StkId newtop) |
181 | { | 181 | { |
182 | Object *nt; | 182 | TObject *nt; |
183 | lua_checkstack(stack+newtop); | 183 | lua_checkstack(stack+newtop); |
184 | nt = stack+newtop; /* warning: previous call may change stack */ | 184 | nt = stack+newtop; /* warning: previous call may change stack */ |
185 | while (top < nt) ttype(top++) = LUA_T_NIL; | 185 | while (top < nt) ttype(top++) = LUA_T_NIL; |
@@ -228,7 +228,7 @@ static void callHook (StkId base, lua_Type type, int isreturn) | |||
228 | (*lua_callhook)(LUA_NOOBJECT, "(return)", 0); | 228 | (*lua_callhook)(LUA_NOOBJECT, "(return)", 0); |
229 | else | 229 | else |
230 | { | 230 | { |
231 | Object *f = stack+base-1; | 231 | TObject *f = stack+base-1; |
232 | if (type == LUA_T_MARK) | 232 | if (type == LUA_T_MARK) |
233 | (*lua_callhook)(Ref(f), f->value.tf->fileName, f->value.tf->lineDefined); | 233 | (*lua_callhook)(Ref(f), f->value.tf->fileName, f->value.tf->lineDefined); |
234 | else | 234 | else |
@@ -261,7 +261,7 @@ static StkId callC (lua_CFunction func, StkId base) | |||
261 | return firstResult; | 261 | return firstResult; |
262 | } | 262 | } |
263 | 263 | ||
264 | static void callIM (Object *f, int nParams, int nResults) | 264 | static void callIM (TObject *f, int nParams, int nResults) |
265 | { | 265 | { |
266 | open_stack(nParams); | 266 | open_stack(nParams); |
267 | *(top-nParams-1) = *f; | 267 | *(top-nParams-1) = *f; |
@@ -278,7 +278,7 @@ static void callIM (Object *f, int nParams, int nResults) | |||
278 | static void do_call (StkId base, int nResults) | 278 | static void do_call (StkId base, int nResults) |
279 | { | 279 | { |
280 | StkId firstResult; | 280 | StkId firstResult; |
281 | Object *func = stack+base-1; | 281 | TObject *func = stack+base-1; |
282 | int i; | 282 | int i; |
283 | if (ttype(func) == LUA_T_CFUNCTION) { | 283 | if (ttype(func) == LUA_T_CFUNCTION) { |
284 | ttype(func) = LUA_T_CMARK; | 284 | ttype(func) = LUA_T_CMARK; |
@@ -290,7 +290,7 @@ static void do_call (StkId base, int nResults) | |||
290 | } | 290 | } |
291 | else { /* func is not a function */ | 291 | else { /* func is not a function */ |
292 | /* Check the fallback for invalid functions */ | 292 | /* Check the fallback for invalid functions */ |
293 | Object *im = luaI_getimbyObj(func, IM_FUNCTION); | 293 | TObject *im = luaI_getimbyObj(func, IM_FUNCTION); |
294 | if (ttype(im) == LUA_T_NIL) | 294 | if (ttype(im) == LUA_T_NIL) |
295 | lua_error("call expression not a function"); | 295 | lua_error("call expression not a function"); |
296 | open_stack((top-stack)-(base-1)); | 296 | open_stack((top-stack)-(base-1)); |
@@ -317,9 +317,9 @@ static void do_call (StkId base, int nResults) | |||
317 | static void pushsubscript (void) | 317 | static void pushsubscript (void) |
318 | { | 318 | { |
319 | int tg = luaI_tag(top-2); | 319 | int tg = luaI_tag(top-2); |
320 | Object *im = luaI_getim(tg, IM_GETTABLE); | 320 | TObject *im = luaI_getim(tg, IM_GETTABLE); |
321 | if (ttype(top-2) == LUA_T_ARRAY && ttype(im) == LUA_T_NIL) { | 321 | if (ttype(top-2) == LUA_T_ARRAY && ttype(im) == LUA_T_NIL) { |
322 | Object *h = lua_hashget(avalue(top-2), top-1); | 322 | TObject *h = lua_hashget(avalue(top-2), top-1); |
323 | if (h != NULL && ttype(h) != LUA_T_NIL) { | 323 | if (h != NULL && ttype(h) != LUA_T_NIL) { |
324 | --top; | 324 | --top; |
325 | *(top-1) = *h; | 325 | *(top-1) = *h; |
@@ -346,7 +346,7 @@ lua_Object lua_basicindex (void) | |||
346 | if (ttype(top-2) != LUA_T_ARRAY) | 346 | if (ttype(top-2) != LUA_T_ARRAY) |
347 | lua_error("indexed expression not a table in basic indexing"); | 347 | lua_error("indexed expression not a table in basic indexing"); |
348 | else { | 348 | else { |
349 | Object *h = lua_hashget(avalue(top-2), top-1); | 349 | TObject *h = lua_hashget(avalue(top-2), top-1); |
350 | --top; | 350 | --top; |
351 | if (h != NULL) | 351 | if (h != NULL) |
352 | *(top-1) = *h; | 352 | *(top-1) = *h; |
@@ -364,11 +364,11 @@ lua_Object lua_basicindex (void) | |||
364 | ** mode = 1: normal store (with internal methods) | 364 | ** mode = 1: normal store (with internal methods) |
365 | ** mode = 2: "deep stack" store (with internal methods) | 365 | ** mode = 2: "deep stack" store (with internal methods) |
366 | */ | 366 | */ |
367 | static void storesubscript (Object *t, int mode) | 367 | static void storesubscript (TObject *t, int mode) |
368 | { | 368 | { |
369 | Object *im = (mode == 0) ? NULL : luaI_getimbyObj(t, IM_SETTABLE); | 369 | TObject *im = (mode == 0) ? NULL : luaI_getimbyObj(t, IM_SETTABLE); |
370 | if (ttype(t) == LUA_T_ARRAY && (im == NULL || ttype(im) == LUA_T_NIL)) { | 370 | if (ttype(t) == LUA_T_ARRAY && (im == NULL || ttype(im) == LUA_T_NIL)) { |
371 | Object *h = lua_hashdefine(avalue(t), t+1); | 371 | TObject *h = lua_hashdefine(avalue(t), t+1); |
372 | *h = *(top-1); | 372 | *h = *(top-1); |
373 | top -= (mode == 2) ? 1 : 3; | 373 | top -= (mode == 2) ? 1 : 3; |
374 | } | 374 | } |
@@ -394,7 +394,7 @@ static void getglobal (Word n) | |||
394 | *top = lua_table[n].object; | 394 | *top = lua_table[n].object; |
395 | incr_top; | 395 | incr_top; |
396 | if (ttype(top-1) == LUA_T_NIL) { /* check i.m. */ | 396 | if (ttype(top-1) == LUA_T_NIL) { /* check i.m. */ |
397 | Object *im = luaI_getgim(GIM_GETGLOBAL); | 397 | TObject *im = luaI_getgim(GIM_GETGLOBAL); |
398 | if (ttype(im) != LUA_T_NIL) { | 398 | if (ttype(im) != LUA_T_NIL) { |
399 | ttype(top-1) = LUA_T_STRING; | 399 | ttype(top-1) = LUA_T_STRING; |
400 | tsvalue(top-1) = lua_table[n].varname; | 400 | tsvalue(top-1) = lua_table[n].varname; |
@@ -406,9 +406,9 @@ static void getglobal (Word n) | |||
406 | /* | 406 | /* |
407 | ** Traverse all objects on stack | 407 | ** Traverse all objects on stack |
408 | */ | 408 | */ |
409 | void lua_travstack (int (*fn)(Object *)) | 409 | void lua_travstack (int (*fn)(TObject *)) |
410 | { | 410 | { |
411 | Object *o; | 411 | TObject *o; |
412 | for (o = top-1; o >= stack; o--) | 412 | for (o = top-1; o >= stack; o--) |
413 | fn (o); | 413 | fn (o); |
414 | } | 414 | } |
@@ -420,7 +420,7 @@ void lua_travstack (int (*fn)(Object *)) | |||
420 | 420 | ||
421 | static void lua_message (char *s) | 421 | static void lua_message (char *s) |
422 | { | 422 | { |
423 | Object *im = luaI_getgim(GIM_ERROR); | 423 | TObject *im = luaI_getgim(GIM_ERROR); |
424 | if (ttype(im) == LUA_T_NIL) | 424 | if (ttype(im) == LUA_T_NIL) |
425 | fprintf(stderr, "lua: %s\n", s); | 425 | fprintf(stderr, "lua: %s\n", s); |
426 | else { | 426 | else { |
@@ -458,14 +458,14 @@ lua_Function lua_stackedfunction (int level) | |||
458 | 458 | ||
459 | int lua_currentline (lua_Function func) | 459 | int lua_currentline (lua_Function func) |
460 | { | 460 | { |
461 | Object *f = Address(func); | 461 | TObject *f = Address(func); |
462 | return (f+1 < top && (f+1)->ttype == LUA_T_LINE) ? (f+1)->value.i : -1; | 462 | return (f+1 < top && (f+1)->ttype == LUA_T_LINE) ? (f+1)->value.i : -1; |
463 | } | 463 | } |
464 | 464 | ||
465 | 465 | ||
466 | lua_Object lua_getlocal (lua_Function func, int local_number, char **name) | 466 | lua_Object lua_getlocal (lua_Function func, int local_number, char **name) |
467 | { | 467 | { |
468 | Object *f = luaI_Address(func); | 468 | TObject *f = luaI_Address(func); |
469 | *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func)); | 469 | *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func)); |
470 | if (*name) | 470 | if (*name) |
471 | { | 471 | { |
@@ -479,7 +479,7 @@ lua_Object lua_getlocal (lua_Function func, int local_number, char **name) | |||
479 | 479 | ||
480 | int lua_setlocal (lua_Function func, int local_number) | 480 | int lua_setlocal (lua_Function func, int local_number) |
481 | { | 481 | { |
482 | Object *f = Address(func); | 482 | TObject *f = Address(func); |
483 | char *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func)); | 483 | char *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func)); |
484 | adjustC(1); | 484 | adjustC(1); |
485 | --top; | 485 | --top; |
@@ -843,7 +843,7 @@ lua_CFunction lua_getcfunction (lua_Object object) | |||
843 | 843 | ||
844 | lua_Object lua_getref (int ref) | 844 | lua_Object lua_getref (int ref) |
845 | { | 845 | { |
846 | Object *o = luaI_getref(ref); | 846 | TObject *o = luaI_getref(ref); |
847 | if (o == NULL) | 847 | if (o == NULL) |
848 | return LUA_NOOBJECT; | 848 | return LUA_NOOBJECT; |
849 | adjustC(0); | 849 | adjustC(0); |
@@ -855,7 +855,7 @@ lua_Object lua_getref (int ref) | |||
855 | 855 | ||
856 | void lua_pushref (int ref) | 856 | void lua_pushref (int ref) |
857 | { | 857 | { |
858 | Object *o = luaI_getref(ref); | 858 | TObject *o = luaI_getref(ref); |
859 | if (o == NULL) | 859 | if (o == NULL) |
860 | lua_error("access to invalid (possibly garbage collected) reference"); | 860 | lua_error("access to invalid (possibly garbage collected) reference"); |
861 | luaI_pushobject(o); | 861 | luaI_pushobject(o); |
@@ -970,7 +970,7 @@ void lua_pushusertag (void *u, int tag) | |||
970 | /* | 970 | /* |
971 | ** Push an object on the stack. | 971 | ** Push an object on the stack. |
972 | */ | 972 | */ |
973 | void luaI_pushobject (Object *o) | 973 | void luaI_pushobject (TObject *o) |
974 | { | 974 | { |
975 | *top = *o; | 975 | *top = *o; |
976 | incr_top; | 976 | incr_top; |
@@ -995,9 +995,9 @@ int lua_tag (lua_Object o) | |||
995 | } | 995 | } |
996 | 996 | ||
997 | 997 | ||
998 | void luaI_gcIM (Object *o) | 998 | void luaI_gcIM (TObject *o) |
999 | { | 999 | { |
1000 | Object *im = luaI_getimbyObj(o, IM_GC); | 1000 | TObject *im = luaI_getimbyObj(o, IM_GC); |
1001 | if (ttype(im) != LUA_T_NIL) { | 1001 | if (ttype(im) != LUA_T_NIL) { |
1002 | *top = *o; | 1002 | *top = *o; |
1003 | incr_top; | 1003 | incr_top; |
@@ -1008,7 +1008,7 @@ void luaI_gcIM (Object *o) | |||
1008 | 1008 | ||
1009 | static void call_arith (IMS event) | 1009 | static void call_arith (IMS event) |
1010 | { | 1010 | { |
1011 | Object *im = luaI_getimbyObj(top-2, event); /* try first operand */ | 1011 | TObject *im = luaI_getimbyObj(top-2, event); /* try first operand */ |
1012 | if (ttype(im) == LUA_T_NIL) { | 1012 | if (ttype(im) == LUA_T_NIL) { |
1013 | im = luaI_getimbyObj(top-1, event); /* try second operand */ | 1013 | im = luaI_getimbyObj(top-1, event); /* try second operand */ |
1014 | if (ttype(im) == LUA_T_NIL) { | 1014 | if (ttype(im) == LUA_T_NIL) { |
@@ -1021,17 +1021,17 @@ static void call_arith (IMS event) | |||
1021 | callIM(im, 3, 1); | 1021 | callIM(im, 3, 1); |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | static void concim (Object *o) | 1024 | static void concim (TObject *o) |
1025 | { | 1025 | { |
1026 | Object *im = luaI_getimbyObj(o, IM_CONCAT); | 1026 | TObject *im = luaI_getimbyObj(o, IM_CONCAT); |
1027 | if (ttype(im) == LUA_T_NIL) | 1027 | if (ttype(im) == LUA_T_NIL) |
1028 | lua_error("unexpected type at conversion to string"); | 1028 | lua_error("unexpected type at conversion to string"); |
1029 | callIM(im, 2, 1); | 1029 | callIM(im, 2, 1); |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | static void ordim (Object *o, IMS event) | 1032 | static void ordim (TObject *o, IMS event) |
1033 | { | 1033 | { |
1034 | Object *im = luaI_getimbyObj(o, event); | 1034 | TObject *im = luaI_getimbyObj(o, event); |
1035 | if (ttype(im) == LUA_T_NIL) | 1035 | if (ttype(im) == LUA_T_NIL) |
1036 | lua_error("unexpected type at comparison"); | 1036 | lua_error("unexpected type at comparison"); |
1037 | lua_pushstring(luaI_eventname[event]); | 1037 | lua_pushstring(luaI_eventname[event]); |
@@ -1041,8 +1041,8 @@ static void ordim (Object *o, IMS event) | |||
1041 | static void comparison (lua_Type ttype_less, lua_Type ttype_equal, | 1041 | static void comparison (lua_Type ttype_less, lua_Type ttype_equal, |
1042 | lua_Type ttype_great, IMS op) | 1042 | lua_Type ttype_great, IMS op) |
1043 | { | 1043 | { |
1044 | Object *l = top-2; | 1044 | TObject *l = top-2; |
1045 | Object *r = top-1; | 1045 | TObject *r = top-1; |
1046 | int result; | 1046 | int result; |
1047 | if (ttype(l) == LUA_T_NUMBER && ttype(r) == LUA_T_NUMBER) | 1047 | if (ttype(l) == LUA_T_NUMBER && ttype(r) == LUA_T_NUMBER) |
1048 | result = (nvalue(l) < nvalue(r)) ? -1 : (nvalue(l) == nvalue(r)) ? 0 : 1; | 1048 | result = (nvalue(l) < nvalue(r)) ? -1 : (nvalue(l) == nvalue(r)) ? 0 : 1; |
@@ -1065,21 +1065,21 @@ static void comparison (lua_Type ttype_less, lua_Type ttype_equal, | |||
1065 | 1065 | ||
1066 | static void adjust_varargs (StkId first_extra_arg) | 1066 | static void adjust_varargs (StkId first_extra_arg) |
1067 | { | 1067 | { |
1068 | Object arg; | 1068 | TObject arg; |
1069 | Object *firstelem = stack+first_extra_arg; | 1069 | TObject *firstelem = stack+first_extra_arg; |
1070 | int nvararg = top-firstelem; | 1070 | int nvararg = top-firstelem; |
1071 | int i; | 1071 | int i; |
1072 | if (nvararg < 0) nvararg = 0; | 1072 | if (nvararg < 0) nvararg = 0; |
1073 | avalue(&arg) = lua_createarray(nvararg+1); /* +1 for field 'n' */ | 1073 | avalue(&arg) = lua_createarray(nvararg+1); /* +1 for field 'n' */ |
1074 | ttype(&arg) = LUA_T_ARRAY; | 1074 | ttype(&arg) = LUA_T_ARRAY; |
1075 | for (i=0; i<nvararg; i++) { | 1075 | for (i=0; i<nvararg; i++) { |
1076 | Object index; | 1076 | TObject index; |
1077 | ttype(&index) = LUA_T_NUMBER; | 1077 | ttype(&index) = LUA_T_NUMBER; |
1078 | nvalue(&index) = i+1; | 1078 | nvalue(&index) = i+1; |
1079 | *(lua_hashdefine(avalue(&arg), &index)) = *(firstelem+i); | 1079 | *(lua_hashdefine(avalue(&arg), &index)) = *(firstelem+i); |
1080 | } | 1080 | } |
1081 | /* store counter in field "n" */ { | 1081 | /* store counter in field "n" */ { |
1082 | Object index, extra; | 1082 | TObject index, extra; |
1083 | ttype(&index) = LUA_T_STRING; | 1083 | ttype(&index) = LUA_T_STRING; |
1084 | tsvalue(&index) = lua_createstring("n"); | 1084 | tsvalue(&index) = lua_createstring("n"); |
1085 | ttype(&extra) = LUA_T_NUMBER; | 1085 | ttype(&extra) = LUA_T_NUMBER; |
@@ -1177,7 +1177,7 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1177 | 1177 | ||
1178 | case PUSHSELF: | 1178 | case PUSHSELF: |
1179 | { | 1179 | { |
1180 | Object receiver = *(top-1); | 1180 | TObject receiver = *(top-1); |
1181 | Word w; | 1181 | Word w; |
1182 | get_word(w,pc); | 1182 | get_word(w,pc); |
1183 | ttype(top) = LUA_T_STRING; tsvalue(top) = lua_constant[w]; | 1183 | ttype(top) = LUA_T_STRING; tsvalue(top) = lua_constant[w]; |
@@ -1219,7 +1219,7 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1219 | case STORELIST: | 1219 | case STORELIST: |
1220 | { | 1220 | { |
1221 | int m, n; | 1221 | int m, n; |
1222 | Object *arr; | 1222 | TObject *arr; |
1223 | if (opcode == STORELIST0) m = 0; | 1223 | if (opcode == STORELIST0) m = 0; |
1224 | else m = *(pc++) * FIELDS_PER_FLUSH; | 1224 | else m = *(pc++) * FIELDS_PER_FLUSH; |
1225 | n = *(pc++); | 1225 | n = *(pc++); |
@@ -1237,7 +1237,7 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1237 | case STORERECORD: /* opcode obsolete: supersed by STOREMAP */ | 1237 | case STORERECORD: /* opcode obsolete: supersed by STOREMAP */ |
1238 | { | 1238 | { |
1239 | int n = *(pc++); | 1239 | int n = *(pc++); |
1240 | Object *arr = top-n-1; | 1240 | TObject *arr = top-n-1; |
1241 | while (n) | 1241 | while (n) |
1242 | { | 1242 | { |
1243 | Word w; | 1243 | Word w; |
@@ -1252,7 +1252,7 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1252 | 1252 | ||
1253 | case STOREMAP: { | 1253 | case STOREMAP: { |
1254 | int n = *(pc++); | 1254 | int n = *(pc++); |
1255 | Object *arr = top-(2*n)-1; | 1255 | TObject *arr = top-(2*n)-1; |
1256 | while (n--) { | 1256 | while (n--) { |
1257 | *(lua_hashdefine (avalue(arr), top-2)) = *(top-1); | 1257 | *(lua_hashdefine (avalue(arr), top-2)) = *(top-1); |
1258 | top-=2; | 1258 | top-=2; |
@@ -1309,8 +1309,8 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1309 | 1309 | ||
1310 | case ADDOP: | 1310 | case ADDOP: |
1311 | { | 1311 | { |
1312 | Object *l = top-2; | 1312 | TObject *l = top-2; |
1313 | Object *r = top-1; | 1313 | TObject *r = top-1; |
1314 | if (tonumber(r) || tonumber(l)) | 1314 | if (tonumber(r) || tonumber(l)) |
1315 | call_arith(IM_ADD); | 1315 | call_arith(IM_ADD); |
1316 | else | 1316 | else |
@@ -1323,8 +1323,8 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1323 | 1323 | ||
1324 | case SUBOP: | 1324 | case SUBOP: |
1325 | { | 1325 | { |
1326 | Object *l = top-2; | 1326 | TObject *l = top-2; |
1327 | Object *r = top-1; | 1327 | TObject *r = top-1; |
1328 | if (tonumber(r) || tonumber(l)) | 1328 | if (tonumber(r) || tonumber(l)) |
1329 | call_arith(IM_SUB); | 1329 | call_arith(IM_SUB); |
1330 | else | 1330 | else |
@@ -1337,8 +1337,8 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1337 | 1337 | ||
1338 | case MULTOP: | 1338 | case MULTOP: |
1339 | { | 1339 | { |
1340 | Object *l = top-2; | 1340 | TObject *l = top-2; |
1341 | Object *r = top-1; | 1341 | TObject *r = top-1; |
1342 | if (tonumber(r) || tonumber(l)) | 1342 | if (tonumber(r) || tonumber(l)) |
1343 | call_arith(IM_MUL); | 1343 | call_arith(IM_MUL); |
1344 | else | 1344 | else |
@@ -1351,8 +1351,8 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1351 | 1351 | ||
1352 | case DIVOP: | 1352 | case DIVOP: |
1353 | { | 1353 | { |
1354 | Object *l = top-2; | 1354 | TObject *l = top-2; |
1355 | Object *r = top-1; | 1355 | TObject *r = top-1; |
1356 | if (tonumber(r) || tonumber(l)) | 1356 | if (tonumber(r) || tonumber(l)) |
1357 | call_arith(IM_DIV); | 1357 | call_arith(IM_DIV); |
1358 | else | 1358 | else |
@@ -1368,8 +1368,8 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1368 | break; | 1368 | break; |
1369 | 1369 | ||
1370 | case CONCOP: { | 1370 | case CONCOP: { |
1371 | Object *l = top-2; | 1371 | TObject *l = top-2; |
1372 | Object *r = top-1; | 1372 | TObject *r = top-1; |
1373 | if (tostring(l)) /* first argument is not a string */ | 1373 | if (tostring(l)) /* first argument is not a string */ |
1374 | concim(l); | 1374 | concim(l); |
1375 | else if (tostring(r)) /* second argument is not a string */ | 1375 | else if (tostring(r)) /* second argument is not a string */ |
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | ** TeCGraf - PUC-Rio | 2 | ** TeCGraf - PUC-Rio |
3 | ** $Id: opcode.h,v 3.29 1997/03/19 19:41:10 roberto Exp roberto $ | 3 | ** $Id: opcode.h,v 3.30 1997/03/20 19:20:43 roberto Exp roberto $ |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef opcode_h | 6 | #ifndef opcode_h |
@@ -125,11 +125,11 @@ typedef union | |||
125 | int i; | 125 | int i; |
126 | } Value; | 126 | } Value; |
127 | 127 | ||
128 | typedef struct Object | 128 | typedef struct TObject |
129 | { | 129 | { |
130 | lua_Type ttype; | 130 | lua_Type ttype; |
131 | Value value; | 131 | Value value; |
132 | } Object; | 132 | } TObject; |
133 | 133 | ||
134 | 134 | ||
135 | /* Macros to access structure members */ | 135 | /* Macros to access structure members */ |
@@ -159,10 +159,10 @@ typedef struct Object | |||
159 | /* Exported functions */ | 159 | /* Exported functions */ |
160 | void lua_parse (TFunc *tf); /* from "lua.stx" module */ | 160 | void lua_parse (TFunc *tf); /* from "lua.stx" module */ |
161 | void luaI_codedebugline (int line); /* from "lua.stx" module */ | 161 | void luaI_codedebugline (int line); /* from "lua.stx" module */ |
162 | void lua_travstack (int (*fn)(Object *)); | 162 | void lua_travstack (int (*fn)(TObject *)); |
163 | Object *luaI_Address (lua_Object o); | 163 | TObject *luaI_Address (lua_Object o); |
164 | void luaI_pushobject (Object *o); | 164 | void luaI_pushobject (TObject *o); |
165 | void luaI_gcIM (Object *o); | 165 | void luaI_gcIM (TObject *o); |
166 | int luaI_dorun (TFunc *tf); | 166 | int luaI_dorun (TFunc *tf); |
167 | 167 | ||
168 | #endif | 168 | #endif |
@@ -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.62 1997/03/21 21:39:57 roberto Exp roberto $"; | 6 | char *rcs_table="$Id: table.c,v 2.63 1997/03/26 22:22:41 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include "mem.h" | 8 | #include "mem.h" |
9 | #include "opcode.h" | 9 | #include "opcode.h" |
@@ -113,7 +113,7 @@ TaggedString *luaI_createfixedstring (char *name) | |||
113 | /* | 113 | /* |
114 | ** Traverse symbol table objects | 114 | ** Traverse symbol table objects |
115 | */ | 115 | */ |
116 | static char *lua_travsymbol (int (*fn)(Object *)) | 116 | static char *lua_travsymbol (int (*fn)(TObject *)) |
117 | { | 117 | { |
118 | Word i; | 118 | Word i; |
119 | for (i=0; i<lua_ntable; i++) | 119 | for (i=0; i<lua_ntable; i++) |
@@ -126,7 +126,7 @@ static char *lua_travsymbol (int (*fn)(Object *)) | |||
126 | /* | 126 | /* |
127 | ** Mark an object if it is a string or a unmarked array. | 127 | ** Mark an object if it is a string or a unmarked array. |
128 | */ | 128 | */ |
129 | int lua_markobject (Object *o) | 129 | int lua_markobject (TObject *o) |
130 | {/* if already marked, does not change mark value */ | 130 | {/* if already marked, does not change mark value */ |
131 | if (ttype(o) == LUA_T_USERDATA || | 131 | if (ttype(o) == LUA_T_USERDATA || |
132 | (ttype(o) == LUA_T_STRING && !tsvalue(o)->marked)) | 132 | (ttype(o) == LUA_T_STRING && !tsvalue(o)->marked)) |
@@ -142,7 +142,7 @@ int lua_markobject (Object *o) | |||
142 | /* | 142 | /* |
143 | * returns 0 if the object is going to be (garbage) collected | 143 | * returns 0 if the object is going to be (garbage) collected |
144 | */ | 144 | */ |
145 | int luaI_ismarked (Object *o) | 145 | int luaI_ismarked (TObject *o) |
146 | { | 146 | { |
147 | switch (o->ttype) | 147 | switch (o->ttype) |
148 | { | 148 | { |
@@ -160,7 +160,7 @@ int luaI_ismarked (Object *o) | |||
160 | 160 | ||
161 | static void call_nilIM (void) | 161 | static void call_nilIM (void) |
162 | { /* signals end of garbage collection */ | 162 | { /* signals end of garbage collection */ |
163 | Object t; | 163 | TObject t; |
164 | ttype(&t) = LUA_T_NIL; | 164 | ttype(&t) = LUA_T_NIL; |
165 | luaI_gcIM(&t); /* end of list */ | 165 | luaI_gcIM(&t); /* end of list */ |
166 | } | 166 | } |
@@ -227,8 +227,8 @@ void luaI_nextvar (void) | |||
227 | } | 227 | } |
228 | 228 | ||
229 | 229 | ||
230 | static Object *functofind; | 230 | static TObject *functofind; |
231 | static int checkfunc (Object *o) | 231 | static int checkfunc (TObject *o) |
232 | { | 232 | { |
233 | if (o->ttype == LUA_T_FUNCTION) | 233 | if (o->ttype == LUA_T_FUNCTION) |
234 | return | 234 | return |
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | ** Module to control static tables | 2 | ** Module to control static tables |
3 | ** TeCGraf - PUC-Rio | 3 | ** TeCGraf - PUC-Rio |
4 | ** $Id: table.h,v 2.21 1996/04/22 18:00:37 roberto Exp roberto $ | 4 | ** $Id: table.h,v 2.22 1997/02/26 17:38:41 roberto Unstable roberto $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef table_h | 7 | #ifndef table_h |
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | typedef struct | 13 | typedef struct |
14 | { | 14 | { |
15 | Object object; | 15 | TObject object; |
16 | TaggedString *varname; | 16 | TaggedString *varname; |
17 | } Symbol; | 17 | } Symbol; |
18 | 18 | ||
@@ -30,8 +30,8 @@ Word luaI_findconstant (TaggedString *t); | |||
30 | Word luaI_findconstantbyname (char *name); | 30 | Word luaI_findconstantbyname (char *name); |
31 | void luaI_nextvar (void); | 31 | void luaI_nextvar (void); |
32 | TaggedString *luaI_createfixedstring (char *str); | 32 | TaggedString *luaI_createfixedstring (char *str); |
33 | int lua_markobject (Object *o); | 33 | int lua_markobject (TObject *o); |
34 | int luaI_ismarked (Object *o); | 34 | int luaI_ismarked (TObject *o); |
35 | Long luaI_collectgarbage (void); | 35 | Long luaI_collectgarbage (void); |
36 | void lua_pack (void); | 36 | void lua_pack (void); |
37 | 37 | ||
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_tree="$Id: tree.c,v 1.21 1997/02/11 11:35:05 roberto Exp roberto $"; | 6 | char *rcs_tree="$Id: tree.c,v 1.22 1997/03/19 19:41:10 roberto Exp roberto $"; |
7 | 7 | ||
8 | 8 | ||
9 | #include <string.h> | 9 | #include <string.h> |
@@ -125,7 +125,7 @@ TaggedString *lua_createstring (char *str) | |||
125 | void luaI_strcallIM (void) | 125 | void luaI_strcallIM (void) |
126 | { | 126 | { |
127 | int i; | 127 | int i; |
128 | Object o; | 128 | TObject o; |
129 | ttype(&o) = LUA_T_USERDATA; | 129 | ttype(&o) = LUA_T_USERDATA; |
130 | for (i=0; i<NUM_HASHS; i++) { | 130 | for (i=0; i<NUM_HASHS; i++) { |
131 | stringtable *tb = &string_root[i]; | 131 | stringtable *tb = &string_root[i]; |