浏览代码

"Object" renamed to "TObject" (Tagged Object), to avoid conflicts with
pre-defined names in some C compilers.

Roberto Ierusalimschy 28 年之前
父节点
当前提交
ad5574c4c9
共有 10 个文件被更改,包括 117 次插入117 次删除
  1. 15 15
      fallback.c
  2. 9 9
      fallback.h
  3. 1 1
      func.c
  4. 7 7
      hash.c
  5. 6 6
      hash.h
  6. 59 59
      opcode.c
  7. 7 7
      opcode.h
  8. 7 7
      table.c
  9. 4 4
      table.h
  10. 2 2
      tree.c

+ 15 - 15
fallback.c

@@ -3,7 +3,7 @@
 ** TecCGraf - PUC-Rio
 */
  
-char *rcs_fallback="$Id: fallback.c,v 1.32 1997/03/21 18:37:28 roberto Exp roberto $";
+char *rcs_fallback="$Id: fallback.c,v 1.33 1997/03/24 17:13:22 roberto Exp roberto $";
 
 #include <stdio.h>
 #include <string.h>
@@ -39,12 +39,12 @@ void luaI_type (void)
 */
 
 static struct ref {
-  Object o;
+  TObject o;
   enum {LOCK, HOLD, FREE, COLLECTED} status;
 } *refArray = NULL;
 static int refSize = 0;
 
-int luaI_ref (Object *object, int lock)
+int luaI_ref (TObject *object, int lock)
 {
   int i;
   int oldSize;
@@ -73,9 +73,9 @@ void lua_unref (int ref)
 }
 
 
-Object *luaI_getref (int ref)
+TObject *luaI_getref (int ref)
 {
-  static Object nul = {LUA_T_NIL, {0}};
+  static TObject nul = {LUA_T_NIL, {0}};
   if (ref == -1)
     return &nul;
   if (ref >= 0 && ref < refSize &&
@@ -86,7 +86,7 @@ Object *luaI_getref (int ref)
 }
 
 
-void luaI_travlock (int (*fn)(Object *))
+void luaI_travlock (int (*fn)(TObject *))
 {
   int i;
   for (i=0; i<refSize; i++)
@@ -140,7 +140,7 @@ static int luaI_checkevent (char *name, char *list[])
 
 static struct IM {
   lua_Type tp;
-  Object int_method[IM_N];
+  TObject int_method[IM_N];
 } *luaI_IMtable = NULL;
 
 static int IMtable_size = 0;
@@ -219,7 +219,7 @@ lua_Type luaI_typetag (int tag)
   }
 }
 
-void luaI_settag (int tag, Object *o)
+void luaI_settag (int tag, TObject *o)
 {
   if (ttype(o) != luaI_typetag(tag))
     lua_error("Tag is not compatible with this type");
@@ -230,7 +230,7 @@ void luaI_settag (int tag, Object *o)
 }
 
 
-int luaI_tag (Object *o)
+int luaI_tag (TObject *o)
 {
   lua_Type t = ttype(o);
   if (t == LUA_T_USERDATA)
@@ -241,7 +241,7 @@ int luaI_tag (Object *o)
 }
 
 
-Object *luaI_getim (int tag, IMS event)
+TObject *luaI_getim (int tag, IMS event)
 {
   if (tag > LUA_T_USERDATA)
     tag = LUA_T_USERDATA;  /* default for non-registered tags */
@@ -263,11 +263,11 @@ void luaI_setintmethod (void)
   luaI_IMtable[-t].int_method[e] = *luaI_Address(func);
 }
 
-static Object gmethod[GIM_N] = {
+static TObject gmethod[GIM_N] = {
   {LUA_T_NIL, {NULL}}, {LUA_T_NIL, {NULL}}, {LUA_T_NIL, {NULL}}
 };
 
-Object *luaI_getgim (IMGS event)
+TObject *luaI_getgim (IMGS event)
 {
   return &gmethod[event];
 }
@@ -282,7 +282,7 @@ void luaI_setglobalmethod (void)
   gmethod[e] = *luaI_Address(func);
 }
 
-char *luaI_travfallbacks (int (*fn)(Object *))
+char *luaI_travfallbacks (int (*fn)(TObject *))
 {
   int e;
   for (e=GIM_ERROR; e<=GIM_SETGLOBAL; e++) {  /* ORDER GIM */
@@ -324,7 +324,7 @@ static void typeFB (void)
 }
 
 
-static void fillvalids (IMS e, Object *func)
+static void fillvalids (IMS e, TObject *func)
 {
   int t;
   for (t=LUA_T_NIL; t<=LUA_T_USERDATA; t++)
@@ -335,7 +335,7 @@ static void fillvalids (IMS e, Object *func)
 void luaI_setfallback (void)
 {
   int e;
-  Object oldfunc;
+  TObject oldfunc;
   lua_CFunction replace;
   char *name = luaL_check_string(1, "setfallback");
   lua_Object func = lua_getparam(2);

+ 9 - 9
fallback.h

@@ -1,5 +1,5 @@
 /*
-** $Id: fallback.h,v 1.16 1997/03/20 19:20:43 roberto Exp roberto $
+** $Id: fallback.h,v 1.17 1997/03/24 17:13:22 roberto Exp roberto $
 */
  
 #ifndef fallback_h
@@ -49,19 +49,19 @@ typedef enum {
 #define GIM_N 3
 
 void luaI_setfallback (void);
-int luaI_ref (Object *object, int lock);
-Object *luaI_getref (int ref);
-void luaI_travlock (int (*fn)(Object *));
+int luaI_ref (TObject *object, int lock);
+TObject *luaI_getref (int ref);
+void luaI_travlock (int (*fn)(TObject *));
 void luaI_invalidaterefs (void);
-char *luaI_travfallbacks (int (*fn)(Object *));
+char *luaI_travfallbacks (int (*fn)(TObject *));
 
 void luaI_type (void);
-void luaI_settag (int tag, Object *o);
+void luaI_settag (int tag, TObject *o);
 lua_Type luaI_typetag (int tag);
-Object *luaI_getim (int tag, IMS event);
+TObject *luaI_getim (int tag, IMS event);
 #define luaI_getimbyObj(o,e)  (luaI_getim(luaI_tag(o),(e)))
-Object *luaI_getgim (IMGS event);
-int luaI_tag (Object *o);
+TObject *luaI_getgim (IMGS event);
+int luaI_tag (TObject *o);
 void luaI_setintmethod (void);
 void luaI_setglobalmethod (void);
 void luaI_initfallbacks (void);

+ 1 - 1
func.c

@@ -83,7 +83,7 @@ Long luaI_funccollector (void)
 
 void lua_funcinfo (lua_Object func, char **filename, int *linedefined)
 {
-  Object *f = luaI_Address(func);
+  TObject *f = luaI_Address(func);
   if (f->ttype == LUA_T_MARK || f->ttype == LUA_T_FUNCTION)
   {
     *filename = f->value.tf->fileName;

+ 7 - 7
hash.c

@@ -3,7 +3,7 @@
 ** hash manager for lua
 */
 
-char *rcs_hash="$Id: hash.c,v 2.36 1997/03/19 19:41:10 roberto Exp roberto $";
+char *rcs_hash="$Id: hash.c,v 2.37 1997/03/21 18:52:37 roberto Exp roberto $";
 
 
 #include "mem.h"
@@ -48,7 +48,7 @@ int luaI_redimension (int nhash)
  return 0;  /* to avoid warnings */
 }
 
-static int hashindex (Hash *t, Object *ref)		/* hash function */
+static int hashindex (Hash *t, TObject *ref)		/* hash function */
 {
   long int h;
   switch (ttype(ref)) {
@@ -70,7 +70,7 @@ static int hashindex (Hash *t, Object *ref)		/* hash function */
   return h%nhash(t);  /* make it a valid index */
 }
 
-int lua_equalObj (Object *t1, Object *t2)
+int lua_equalObj (TObject *t1, TObject *t2)
 {
   if (ttype(t1) != ttype(t2)) return 0;
   switch (ttype(t1))
@@ -87,7 +87,7 @@ int lua_equalObj (Object *t1, Object *t2)
   }
 }
 
-static int present (Hash *t, Object *ref)
+static int present (Hash *t, TObject *ref)
 { 
  int h = hashindex(t, ref);
  while (ttype(ref(node(t, h))) != LUA_T_NIL)
@@ -162,7 +162,7 @@ void lua_hashmark (Hash *h)
 void luaI_hashcallIM (void)
 {
   Hash *curr_array;
-  Object t;
+  TObject t;
   ttype(&t) = LUA_T_ARRAY;
   for (curr_array = listhead; curr_array; curr_array = curr_array->next)
     if (markarray(curr_array) != 1)
@@ -242,7 +242,7 @@ static void rehash (Hash *t)
 ** If the hash node is present, return its pointer, otherwise return
 ** null.
 */
-Object *lua_hashget (Hash *t, Object *ref)
+TObject *lua_hashget (Hash *t, TObject *ref)
 {
  int h = present(t, ref);
  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)
 ** If the hash node is present, return its pointer, otherwise create a new
 ** node for the given reference and also return its pointer.
 */
-Object *lua_hashdefine (Hash *t, Object *ref)
+TObject *lua_hashdefine (Hash *t, TObject *ref)
 {
  int   h;
  Node *n;

+ 6 - 6
hash.h

@@ -1,7 +1,7 @@
 /*
 ** hash.h
 ** hash manager for lua
-** $Id: hash.h,v 2.13 1997/02/26 17:38:41 roberto Unstable roberto $
+** $Id: hash.h,v 2.14 1997/03/19 19:41:10 roberto Exp roberto $
 */
 
 #ifndef hash_h
@@ -11,8 +11,8 @@
 #include "opcode.h"
 
 typedef struct node {
- Object ref;
- Object val;
+ TObject ref;
+ TObject val;
 } Node;
 
 typedef struct Hash {
@@ -25,14 +25,14 @@ typedef struct Hash {
 } Hash;
 
 
-int      lua_equalObj (Object *t1, Object *t2);
+int      lua_equalObj (TObject *t1, TObject *t2);
 int      luaI_redimension (int nhash);
 Hash    *lua_createarray (int nhash);
 void     lua_hashmark (Hash *h);
 Long     lua_hashcollector (void);
 void	 luaI_hashcallIM (void);
-Object  *lua_hashget (Hash *t, Object *ref);
-Object 	*lua_hashdefine (Hash *t, Object *ref);
+TObject  *lua_hashget (Hash *t, TObject *ref);
+TObject 	*lua_hashdefine (Hash *t, TObject *ref);
 void     lua_next (void);
 
 #endif

+ 59 - 59
opcode.c

@@ -3,7 +3,7 @@
 ** TecCGraf - PUC-Rio
 */
 
-char *rcs_opcode="$Id: opcode.c,v 3.85 1997/03/19 19:41:10 roberto Exp roberto $";
+char *rcs_opcode="$Id: opcode.c,v 3.86 1997/03/20 19:20:43 roberto Exp roberto $";
 
 #include <setjmp.h>
 #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 $
 
 typedef int StkId;  /* index to stack elements */
 
-static Object initial_stack;
+static TObject initial_stack;
 
-static Object *stackLimit = &initial_stack+1;
-static Object *stack = &initial_stack;
-static Object *top = &initial_stack;
+static TObject *stackLimit = &initial_stack+1;
+static TObject *stack = &initial_stack;
+static TObject *top = &initial_stack;
 
 
-/* macros to convert from lua_Object to (Object *) and back */
+/* macros to convert from lua_Object to (TObject *) and back */
  
 #define Address(lo)     ((lo)+stack-1)
 #define Ref(st)         ((st)-stack+1)
@@ -72,7 +72,7 @@ static void do_call (StkId base, int nResults);
 
 
 
-Object *luaI_Address (lua_Object o)
+TObject *luaI_Address (lua_Object o)
 {
   return Address(o);
 }
@@ -84,7 +84,7 @@ Object *luaI_Address (lua_Object o)
 static void lua_initstack (void)
 {
  Long maxstack = STACK_SIZE;
- stack = newvector(maxstack, Object);
+ stack = newvector(maxstack, TObject);
  stackLimit = stack+maxstack;
  top = stack;
  *(top++) = initial_stack;
@@ -105,7 +105,7 @@ static void growstack (void)
   static int limit = STACK_LIMIT;
   StkId t = top-stack;
   Long stacksize = stackLimit - stack;
-  stacksize = growvector(&stack, stacksize, Object, stackEM, limit+100);
+  stacksize = growvector(&stack, stacksize, TObject, stackEM, limit+100);
   stackLimit = stack+stacksize;
   top = stack + t;
   if (stacksize >= limit)
@@ -134,7 +134,7 @@ static char *lua_strconc (char *l, char *r)
 ** Convert, if possible, to a number object.
 ** Return 0 if success, not 0 if error.
 */
-static int lua_tonumber (Object *obj)
+static int lua_tonumber (TObject *obj)
 {
  float t;
  char c;
@@ -155,7 +155,7 @@ static int lua_tonumber (Object *obj)
 ** Convert, if possible, to a string ttype
 ** Return 0 in success or not 0 on error.
 */
-static int lua_tostring (Object *obj)
+static int lua_tostring (TObject *obj)
 {
   if (ttype(obj) != LUA_T_NUMBER)
     return 1;
@@ -179,7 +179,7 @@ static int lua_tostring (Object *obj)
 */
 static void adjust_top (StkId newtop)
 {
-  Object *nt;
+  TObject *nt;
   lua_checkstack(stack+newtop);
   nt = stack+newtop;  /* warning: previous call may change stack */
   while (top < nt) ttype(top++) = LUA_T_NIL;
@@ -228,7 +228,7 @@ static void callHook (StkId base, lua_Type type, int isreturn)
     (*lua_callhook)(LUA_NOOBJECT, "(return)", 0);
   else
   {
-    Object *f = stack+base-1;
+    TObject *f = stack+base-1;
     if (type == LUA_T_MARK)
       (*lua_callhook)(Ref(f), f->value.tf->fileName, f->value.tf->lineDefined);
     else
@@ -261,7 +261,7 @@ static StkId callC (lua_CFunction func, StkId base)
   return firstResult;
 }
 
-static void callIM (Object *f, int nParams, int nResults)
+static void callIM (TObject *f, int nParams, int nResults)
 {
   open_stack(nParams);
   *(top-nParams-1) = *f;
@@ -278,7 +278,7 @@ static void callIM (Object *f, int nParams, int nResults)
 static void do_call (StkId base, int nResults)
 {
   StkId firstResult;
-  Object *func = stack+base-1;
+  TObject *func = stack+base-1;
   int i;
   if (ttype(func) == LUA_T_CFUNCTION) {
     ttype(func) = LUA_T_CMARK;
@@ -290,7 +290,7 @@ static void do_call (StkId base, int nResults)
   }
   else { /* func is not a function */
     /* Check the fallback for invalid functions */
-    Object *im = luaI_getimbyObj(func, IM_FUNCTION);
+    TObject *im = luaI_getimbyObj(func, IM_FUNCTION);
     if (ttype(im) == LUA_T_NIL)
       lua_error("call expression not a function");
     open_stack((top-stack)-(base-1));
@@ -317,9 +317,9 @@ static void do_call (StkId base, int nResults)
 static void pushsubscript (void)
 {
   int tg = luaI_tag(top-2);
-  Object *im = luaI_getim(tg, IM_GETTABLE);
+  TObject *im = luaI_getim(tg, IM_GETTABLE);
   if (ttype(top-2) == LUA_T_ARRAY && ttype(im) == LUA_T_NIL) {
-      Object *h = lua_hashget(avalue(top-2), top-1);
+      TObject *h = lua_hashget(avalue(top-2), top-1);
       if (h != NULL && ttype(h) != LUA_T_NIL) {
         --top;
         *(top-1) = *h;
@@ -346,7 +346,7 @@ lua_Object lua_basicindex (void)
   if (ttype(top-2) != LUA_T_ARRAY)
     lua_error("indexed expression not a table in basic indexing");
   else {
-    Object *h = lua_hashget(avalue(top-2), top-1);
+    TObject *h = lua_hashget(avalue(top-2), top-1);
     --top;
     if (h != NULL)
       *(top-1) = *h;
@@ -364,11 +364,11 @@ lua_Object lua_basicindex (void)
 ** mode = 1: normal store (with internal methods)
 ** mode = 2: "deep stack" store (with internal methods)
 */
-static void storesubscript (Object *t, int mode)
+static void storesubscript (TObject *t, int mode)
 {
-  Object *im = (mode == 0) ? NULL : luaI_getimbyObj(t, IM_SETTABLE);
+  TObject *im = (mode == 0) ? NULL : luaI_getimbyObj(t, IM_SETTABLE);
   if (ttype(t) == LUA_T_ARRAY && (im == NULL || ttype(im) == LUA_T_NIL)) {
-    Object *h = lua_hashdefine(avalue(t), t+1);
+    TObject *h = lua_hashdefine(avalue(t), t+1);
     *h = *(top-1);
     top -= (mode == 2) ? 1 : 3;
   }
@@ -394,7 +394,7 @@ static void getglobal (Word n)
   *top = lua_table[n].object;
   incr_top;
   if (ttype(top-1) == LUA_T_NIL) {  /* check i.m. */
-    Object *im = luaI_getgim(GIM_GETGLOBAL);
+    TObject *im = luaI_getgim(GIM_GETGLOBAL);
     if (ttype(im) != LUA_T_NIL) {
       ttype(top-1) = LUA_T_STRING;
       tsvalue(top-1) = lua_table[n].varname;
@@ -406,9 +406,9 @@ static void getglobal (Word n)
 /*
 ** Traverse all objects on stack
 */
-void lua_travstack (int (*fn)(Object *))
+void lua_travstack (int (*fn)(TObject *))
 {
- Object *o;
+ TObject *o;
  for (o = top-1; o >= stack; o--)
    fn (o);
 }
@@ -420,7 +420,7 @@ void lua_travstack (int (*fn)(Object *))
 
 static void lua_message (char *s)
 {
-  Object *im = luaI_getgim(GIM_ERROR);
+  TObject *im = luaI_getgim(GIM_ERROR);
   if (ttype(im) == LUA_T_NIL)
     fprintf(stderr, "lua: %s\n", s);
   else {
@@ -458,14 +458,14 @@ lua_Function lua_stackedfunction (int level)
 
 int lua_currentline (lua_Function func)
 {
-  Object *f = Address(func);
+  TObject *f = Address(func);
   return (f+1 < top && (f+1)->ttype == LUA_T_LINE) ? (f+1)->value.i : -1;
 }
 
 
 lua_Object lua_getlocal (lua_Function func, int local_number, char **name)
 {
-  Object *f = luaI_Address(func);
+  TObject *f = luaI_Address(func);
   *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func));
   if (*name)
   {
@@ -479,7 +479,7 @@ lua_Object lua_getlocal (lua_Function func, int local_number, char **name)
 
 int lua_setlocal (lua_Function func, int local_number)
 {
-  Object *f = Address(func);
+  TObject *f = Address(func);
   char *name = luaI_getlocalname(f->value.tf, local_number, lua_currentline(func));
   adjustC(1);
   --top;
@@ -843,7 +843,7 @@ lua_CFunction lua_getcfunction (lua_Object object)
 
 lua_Object lua_getref (int ref)
 {
-  Object *o = luaI_getref(ref);
+  TObject *o = luaI_getref(ref);
   if (o == NULL)
     return LUA_NOOBJECT;
   adjustC(0);
@@ -855,7 +855,7 @@ lua_Object lua_getref (int ref)
 
 void lua_pushref (int ref)
 {
-  Object *o = luaI_getref(ref);
+  TObject *o = luaI_getref(ref);
   if (o == NULL)
     lua_error("access to invalid (possibly garbage collected) reference");
   luaI_pushobject(o);
@@ -970,7 +970,7 @@ void lua_pushusertag (void *u, int tag)
 /*
 ** Push an object on the stack.
 */
-void luaI_pushobject (Object *o)
+void luaI_pushobject (TObject *o)
 {
  *top = *o;
  incr_top;
@@ -995,9 +995,9 @@ int lua_tag (lua_Object o)
 }
 
 
-void luaI_gcIM (Object *o)
+void luaI_gcIM (TObject *o)
 {
-  Object *im = luaI_getimbyObj(o, IM_GC);
+  TObject *im = luaI_getimbyObj(o, IM_GC);
   if (ttype(im) != LUA_T_NIL) {
     *top = *o;
     incr_top;
@@ -1008,7 +1008,7 @@ void luaI_gcIM (Object *o)
 
 static void call_arith (IMS event)
 {
-  Object *im = luaI_getimbyObj(top-2, event);  /* try first operand */
+  TObject *im = luaI_getimbyObj(top-2, event);  /* try first operand */
   if (ttype(im) == LUA_T_NIL) {
     im = luaI_getimbyObj(top-1, event);  /* try second operand */
     if (ttype(im) == LUA_T_NIL) {
@@ -1021,17 +1021,17 @@ static void call_arith (IMS event)
   callIM(im, 3, 1);
 }
 
-static void concim (Object *o)
+static void concim (TObject *o)
 {
-  Object *im = luaI_getimbyObj(o, IM_CONCAT);
+  TObject *im = luaI_getimbyObj(o, IM_CONCAT);
   if (ttype(im) == LUA_T_NIL)
     lua_error("unexpected type at conversion to string");
   callIM(im, 2, 1);
 }
 
-static void ordim (Object *o, IMS event)
+static void ordim (TObject *o, IMS event)
 {
-  Object *im = luaI_getimbyObj(o, event);
+  TObject *im = luaI_getimbyObj(o, event);
   if (ttype(im) == LUA_T_NIL)
     lua_error("unexpected type at comparison");
   lua_pushstring(luaI_eventname[event]);
@@ -1041,8 +1041,8 @@ static void ordim (Object *o, IMS event)
 static void comparison (lua_Type ttype_less, lua_Type ttype_equal, 
                         lua_Type ttype_great, IMS op)
 {
-  Object *l = top-2;
-  Object *r = top-1;
+  TObject *l = top-2;
+  TObject *r = top-1;
   int result;
   if (ttype(l) == LUA_T_NUMBER && ttype(r) == LUA_T_NUMBER)
     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,
 
 static void adjust_varargs (StkId first_extra_arg)
 {
-  Object arg;
-  Object *firstelem = stack+first_extra_arg;
+  TObject arg;
+  TObject *firstelem = stack+first_extra_arg;
   int nvararg = top-firstelem;
   int i;
   if (nvararg < 0) nvararg = 0;
   avalue(&arg)  = lua_createarray(nvararg+1);  /* +1 for field 'n' */
   ttype(&arg) = LUA_T_ARRAY;
   for (i=0; i<nvararg; i++) {
-    Object index;
+    TObject index;
     ttype(&index) = LUA_T_NUMBER;
     nvalue(&index) = i+1;
     *(lua_hashdefine(avalue(&arg), &index)) = *(firstelem+i);
   }
   /* store counter in field "n" */ {
-    Object index, extra;
+    TObject index, extra;
     ttype(&index) = LUA_T_STRING;
     tsvalue(&index) = lua_createstring("n");
     ttype(&extra) = LUA_T_NUMBER;
@@ -1177,7 +1177,7 @@ static StkId lua_execute (Byte *pc, StkId base)
 
    case PUSHSELF:
    {
-     Object receiver = *(top-1);
+     TObject receiver = *(top-1);
      Word w;
      get_word(w,pc);
      ttype(top) = LUA_T_STRING; tsvalue(top) = lua_constant[w];
@@ -1219,7 +1219,7 @@ static StkId lua_execute (Byte *pc, StkId base)
    case STORELIST:
    {
     int m, n;
-    Object *arr;
+    TObject *arr;
     if (opcode == STORELIST0) m = 0;
     else m = *(pc++) * FIELDS_PER_FLUSH;
     n = *(pc++);
@@ -1237,7 +1237,7 @@ static StkId lua_execute (Byte *pc, StkId base)
    case STORERECORD:  /* opcode obsolete: supersed by STOREMAP */
    {
     int n = *(pc++);
-    Object *arr = top-n-1;
+    TObject *arr = top-n-1;
     while (n)
     {
      Word w;
@@ -1252,7 +1252,7 @@ static StkId lua_execute (Byte *pc, StkId base)
 
    case STOREMAP: {
      int n = *(pc++);
-     Object *arr = top-(2*n)-1;
+     TObject *arr = top-(2*n)-1;
      while (n--) {
        *(lua_hashdefine (avalue(arr), top-2)) = *(top-1);
        top-=2;
@@ -1309,8 +1309,8 @@ static StkId lua_execute (Byte *pc, StkId base)
 
    case ADDOP:
    {
-    Object *l = top-2;
-    Object *r = top-1;
+    TObject *l = top-2;
+    TObject *r = top-1;
     if (tonumber(r) || tonumber(l))
       call_arith(IM_ADD);
     else
@@ -1323,8 +1323,8 @@ static StkId lua_execute (Byte *pc, StkId base)
 
    case SUBOP:
    {
-    Object *l = top-2;
-    Object *r = top-1;
+    TObject *l = top-2;
+    TObject *r = top-1;
     if (tonumber(r) || tonumber(l))
       call_arith(IM_SUB);
     else
@@ -1337,8 +1337,8 @@ static StkId lua_execute (Byte *pc, StkId base)
 
    case MULTOP:
    {
-    Object *l = top-2;
-    Object *r = top-1;
+    TObject *l = top-2;
+    TObject *r = top-1;
     if (tonumber(r) || tonumber(l))
       call_arith(IM_MUL);
     else
@@ -1351,8 +1351,8 @@ static StkId lua_execute (Byte *pc, StkId base)
 
    case DIVOP:
    {
-    Object *l = top-2;
-    Object *r = top-1;
+    TObject *l = top-2;
+    TObject *r = top-1;
     if (tonumber(r) || tonumber(l))
       call_arith(IM_DIV);
     else
@@ -1368,8 +1368,8 @@ static StkId lua_execute (Byte *pc, StkId base)
     break;
 
    case CONCOP: {
-     Object *l = top-2;
-     Object *r = top-1;
+     TObject *l = top-2;
+     TObject *r = top-1;
      if (tostring(l))  /* first argument is not a string */
        concim(l);
      else if (tostring(r))  /* second argument is not a string */

+ 7 - 7
opcode.h

@@ -1,6 +1,6 @@
 /*
 ** TeCGraf - PUC-Rio
-** $Id: opcode.h,v 3.29 1997/03/19 19:41:10 roberto Exp roberto $
+** $Id: opcode.h,v 3.30 1997/03/20 19:20:43 roberto Exp roberto $
 */
 
 #ifndef opcode_h
@@ -125,11 +125,11 @@ typedef union
  int	       i;
 } Value;
 
-typedef struct Object
+typedef struct TObject
 {
  lua_Type ttype;
  Value value;
-} Object;
+} TObject;
 
 
 /* Macros to access structure members */
@@ -159,10 +159,10 @@ typedef struct Object
 /* Exported functions */
 void    lua_parse      (TFunc *tf);	/* from "lua.stx" module */
 void	luaI_codedebugline (int line);  /* from "lua.stx" module */
-void    lua_travstack (int (*fn)(Object *));
-Object *luaI_Address (lua_Object o);
-void	luaI_pushobject (Object *o);
-void    luaI_gcIM       (Object *o);
+void    lua_travstack (int (*fn)(TObject *));
+TObject *luaI_Address (lua_Object o);
+void	luaI_pushobject (TObject *o);
+void    luaI_gcIM       (TObject *o);
 int     luaI_dorun (TFunc *tf);
 
 #endif

+ 7 - 7
table.c

@@ -3,7 +3,7 @@
 ** Module to control static tables
 */
 
-char *rcs_table="$Id: table.c,v 2.62 1997/03/21 21:39:57 roberto Exp roberto $";
+char *rcs_table="$Id: table.c,v 2.63 1997/03/26 22:22:41 roberto Exp roberto $";
 
 #include "mem.h"
 #include "opcode.h"
@@ -113,7 +113,7 @@ TaggedString *luaI_createfixedstring (char *name)
 /*
 ** Traverse symbol table objects
 */
-static char *lua_travsymbol (int (*fn)(Object *))
+static char *lua_travsymbol (int (*fn)(TObject *))
 {
  Word i;
  for (i=0; i<lua_ntable; i++)
@@ -126,7 +126,7 @@ static char *lua_travsymbol (int (*fn)(Object *))
 /*
 ** Mark an object if it is a string or a unmarked array.
 */
-int lua_markobject (Object *o)
+int lua_markobject (TObject *o)
 {/* if already marked, does not change mark value */
  if (ttype(o) == LUA_T_USERDATA ||
      (ttype(o) == LUA_T_STRING && !tsvalue(o)->marked))
@@ -142,7 +142,7 @@ int lua_markobject (Object *o)
 /*
 * returns 0 if the object is going to be (garbage) collected
 */
-int luaI_ismarked (Object *o)
+int luaI_ismarked (TObject *o)
 {
   switch (o->ttype)
   {
@@ -160,7 +160,7 @@ int luaI_ismarked (Object *o)
 
 static void call_nilIM (void)
 { /* signals end of garbage collection */
-  Object t;
+  TObject t;
   ttype(&t) = LUA_T_NIL;
   luaI_gcIM(&t);  /* end of list */
 }
@@ -227,8 +227,8 @@ void luaI_nextvar (void)
 }
 
 
-static Object *functofind;
-static int checkfunc (Object *o)
+static TObject *functofind;
+static int checkfunc (TObject *o)
 {
   if (o->ttype == LUA_T_FUNCTION)
     return

+ 4 - 4
table.h

@@ -1,7 +1,7 @@
 /*
 ** Module to control static tables
 ** TeCGraf - PUC-Rio
-** $Id: table.h,v 2.21 1996/04/22 18:00:37 roberto Exp roberto $
+** $Id: table.h,v 2.22 1997/02/26 17:38:41 roberto Unstable roberto $
 */
 
 #ifndef table_h
@@ -12,7 +12,7 @@
 
 typedef struct
 {
- Object  object;
+ TObject  object;
  TaggedString *varname;
 } Symbol;
 
@@ -30,8 +30,8 @@ Word  luaI_findconstant    (TaggedString *t);
 Word  luaI_findconstantbyname (char *name);
 void luaI_nextvar (void);
 TaggedString *luaI_createfixedstring  (char *str);
-int   lua_markobject      (Object *o);
-int luaI_ismarked (Object *o);
+int   lua_markobject      (TObject *o);
+int luaI_ismarked (TObject *o);
 Long luaI_collectgarbage (void);
 void  lua_pack            (void);
 

+ 2 - 2
tree.c

@@ -3,7 +3,7 @@
 ** TecCGraf - PUC-Rio
 */
  
-char *rcs_tree="$Id: tree.c,v 1.21 1997/02/11 11:35:05 roberto Exp roberto $";
+char *rcs_tree="$Id: tree.c,v 1.22 1997/03/19 19:41:10 roberto Exp roberto $";
 
 
 #include <string.h>
@@ -125,7 +125,7 @@ TaggedString *lua_createstring (char *str)
 void luaI_strcallIM (void)
 {
   int i;
-  Object o;
+  TObject o;
   ttype(&o) = LUA_T_USERDATA;
   for (i=0; i<NUM_HASHS; i++) {
     stringtable *tb = &string_root[i];