Browse Source

"tag" changed to "ttype" (since now tag has other meaning)

Roberto Ierusalimschy 28 years ago
parent
commit
b6d91e24e2
7 changed files with 119 additions and 116 deletions
  1. 7 7
      fallback.c
  2. 2 2
      func.c
  3. 15 14
      hash.c
  4. 3 3
      inout.c
  5. 75 74
      opcode.c
  6. 4 4
      opcode.h
  7. 13 12
      table.c

+ 7 - 7
fallback.c

@@ -3,7 +3,7 @@
 ** TecCGraf - PUC-Rio
 ** TecCGraf - PUC-Rio
 */
 */
  
  
-char *rcs_fallback="$Id: fallback.c,v 1.25 1996/04/25 14:10:00 roberto Exp roberto $";
+char *rcs_fallback="$Id: fallback.c,v 1.26 1997/02/26 17:38:41 roberto Unstable roberto $";
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
@@ -132,7 +132,7 @@ int luaI_ref (Object *object, int lock)
 {
 {
   int i;
   int i;
   int oldSize;
   int oldSize;
-  if (tag(object) == LUA_T_NIL)
+  if (ttype(object) == LUA_T_NIL)
     return -1;   /* special ref for nil */
     return -1;   /* special ref for nil */
   for (i=0; i<refSize; i++)
   for (i=0; i<refSize; i++)
     if (refArray[i].status == FREE)
     if (refArray[i].status == FREE)
@@ -223,7 +223,7 @@ int lua_newtag (char *t)
   else
   else
     lua_error("invalid type for new tag");
     lua_error("invalid type for new tag");
   for (i=0; i<FB_N; i++)
   for (i=0; i<FB_N; i++)
-    luaI_IMtable[last_tag-BASE_TAG].int_method[i].tag = LUA_T_NIL;
+    luaI_IMtable[last_tag-BASE_TAG].int_method[i].ttype = LUA_T_NIL;
   return last_tag;
   return last_tag;
 }
 }
 
 
@@ -241,9 +241,9 @@ static void checktag (int tag)
 void luaI_settag (int tag, Object *o)
 void luaI_settag (int tag, Object *o)
 {
 {
   checktag(tag);
   checktag(tag);
-  if (tag(o) != luaI_IMtable[tag-BASE_TAG].tp)
+  if (ttype(o) != luaI_IMtable[tag-BASE_TAG].tp)
     lua_error("Tag is not compatible with this type");
     lua_error("Tag is not compatible with this type");
-  if (o->tag == LUA_T_ARRAY)
+  if (o->ttype == LUA_T_ARRAY)
     o->value.a->htag = tag;
     o->value.a->htag = tag;
   else  /* must be userdata */
   else  /* must be userdata */
     o->value.ts->tag = tag;
     o->value.ts->tag = tag;
@@ -251,7 +251,7 @@ void luaI_settag (int tag, Object *o)
 
 
 int luaI_tag (Object *o)
 int luaI_tag (Object *o)
 {
 {
-  lua_Type t = tag(o);
+  lua_Type t = ttype(o);
   if (t == LUA_T_USERDATA)
   if (t == LUA_T_USERDATA)
     return o->value.ts->tag;
     return o->value.ts->tag;
   else if (t == LUA_T_ARRAY)
   else if (t == LUA_T_ARRAY)
@@ -265,7 +265,7 @@ Object *luaI_getim (int tag, int event)
     return &luaI_fallBacks[event].function;
     return &luaI_fallBacks[event].function;
   else if (validtag(tag)) {
   else if (validtag(tag)) {
     Object *func = &luaI_IMtable[tag-BASE_TAG].int_method[event];
     Object *func = &luaI_IMtable[tag-BASE_TAG].int_method[event];
-    if (func->tag == LUA_T_NIL)
+    if (func->ttype == LUA_T_NIL)
       return NULL;
       return NULL;
     else
     else
       return func;
       return func;

+ 2 - 2
func.c

@@ -84,12 +84,12 @@ Long luaI_funccollector (void)
 void lua_funcinfo (lua_Object func, char **filename, int *linedefined)
 void lua_funcinfo (lua_Object func, char **filename, int *linedefined)
 {
 {
   Object *f = luaI_Address(func);
   Object *f = luaI_Address(func);
-  if (f->tag == LUA_T_MARK || f->tag == LUA_T_FUNCTION)
+  if (f->ttype == LUA_T_MARK || f->ttype == LUA_T_FUNCTION)
   {
   {
     *filename = f->value.tf->fileName;
     *filename = f->value.tf->fileName;
     *linedefined = f->value.tf->lineDefined;
     *linedefined = f->value.tf->lineDefined;
   }
   }
-  else if (f->tag == LUA_T_CMARK || f->tag == LUA_T_CFUNCTION)
+  else if (f->ttype == LUA_T_CMARK || f->ttype == LUA_T_CFUNCTION)
   {
   {
     *filename = "(C)";
     *filename = "(C)";
     *linedefined = -1;
     *linedefined = -1;

+ 15 - 14
hash.c

@@ -3,7 +3,7 @@
 ** hash manager for lua
 ** hash manager for lua
 */
 */
 
 
-char *rcs_hash="$Id: hash.c,v 2.33 1997/02/11 11:35:05 roberto Exp roberto $";
+char *rcs_hash="$Id: hash.c,v 2.34 1997/02/26 17:38:41 roberto Unstable roberto $";
 
 
 
 
 #include "mem.h"
 #include "mem.h"
@@ -51,7 +51,7 @@ int luaI_redimension (int nhash)
 static int hashindex (Hash *t, Object *ref)		/* hash function */
 static int hashindex (Hash *t, Object *ref)		/* hash function */
 {
 {
   long int h;
   long int h;
-  switch (tag(ref)) {
+  switch (ttype(ref)) {
     case LUA_T_NUMBER:
     case LUA_T_NUMBER:
       h = (long int)nvalue(ref); break;
       h = (long int)nvalue(ref); break;
     case LUA_T_STRING: case LUA_T_USERDATA:
     case LUA_T_STRING: case LUA_T_USERDATA:
@@ -72,8 +72,8 @@ static int hashindex (Hash *t, Object *ref)		/* hash function */
 
 
 int lua_equalObj (Object *t1, Object *t2)
 int lua_equalObj (Object *t1, Object *t2)
 {
 {
-  if (tag(t1) != tag(t2)) return 0;
-  switch (tag(t1))
+  if (ttype(t1) != ttype(t2)) return 0;
+  switch (ttype(t1))
   {
   {
     case LUA_T_NIL: return 1;
     case LUA_T_NIL: return 1;
     case LUA_T_NUMBER: return nvalue(t1) == nvalue(t2);
     case LUA_T_NUMBER: return nvalue(t1) == nvalue(t2);
@@ -90,7 +90,7 @@ int lua_equalObj (Object *t1, Object *t2)
 static int present (Hash *t, Object *ref)
 static int present (Hash *t, Object *ref)
 { 
 { 
  int h = hashindex(t, ref);
  int h = hashindex(t, ref);
- while (tag(ref(node(t, h))) != LUA_T_NIL)
+ while (ttype(ref(node(t, h))) != LUA_T_NIL)
  {
  {
   if (lua_equalObj(ref, ref(node(t, h))))
   if (lua_equalObj(ref, ref(node(t, h))))
     return h;
     return h;
@@ -108,7 +108,7 @@ static Node *hashnodecreate (int nhash)
  int i;
  int i;
  Node *v = newvector (nhash, Node);
  Node *v = newvector (nhash, Node);
  for (i=0; i<nhash; i++)
  for (i=0; i<nhash; i++)
-   tag(ref(&v[i])) = LUA_T_NIL;
+   ttype(ref(&v[i])) = LUA_T_NIL;
  return v;
  return v;
 }
 }
 
 
@@ -149,7 +149,7 @@ void lua_hashmark (Hash *h)
   for (i=0; i<nhash(h); i++)
   for (i=0; i<nhash(h); i++)
   {
   {
    Node *n = node(h,i);
    Node *n = node(h,i);
-   if (tag(ref(n)) != LUA_T_NIL)
+   if (ttype(ref(n)) != LUA_T_NIL)
    {
    {
     lua_markobject(&n->ref);
     lua_markobject(&n->ref);
     lua_markobject(&n->val);
     lua_markobject(&n->val);
@@ -163,14 +163,14 @@ static void call_fallbacks (void)
 {
 {
   Hash *curr_array;
   Hash *curr_array;
   Object t;
   Object t;
-  tag(&t) = LUA_T_ARRAY;
+  ttype(&t) = LUA_T_ARRAY;
   for (curr_array = listhead; curr_array; curr_array = curr_array->next)
   for (curr_array = listhead; curr_array; curr_array = curr_array->next)
     if (markarray(curr_array) != 1)
     if (markarray(curr_array) != 1)
     {
     {
       avalue(&t) = curr_array;
       avalue(&t) = curr_array;
       luaI_gcFB(&t);
       luaI_gcFB(&t);
     }
     }
-  tag(&t) = LUA_T_NIL;
+  ttype(&t) = LUA_T_NIL;
   luaI_gcFB(&t);  /* end of list */
   luaI_gcFB(&t);  /* end of list */
 }
 }
 
 
@@ -235,7 +235,7 @@ static void rehash (Hash *t)
  for (i=0; i<nold; i++)
  for (i=0; i<nold; i++)
  {
  {
   Node *n = vold+i;
   Node *n = vold+i;
-  if (tag(ref(n)) != LUA_T_NIL && tag(val(n)) != LUA_T_NIL)
+  if (ttype(ref(n)) != LUA_T_NIL && ttype(val(n)) != LUA_T_NIL)
    *node(t, present(t, ref(n))) = *n;  /* copy old node to new hahs */
    *node(t, present(t, ref(n))) = *n;  /* copy old node to new hahs */
  }
  }
  luaI_free(vold);
  luaI_free(vold);
@@ -248,7 +248,7 @@ static void rehash (Hash *t)
 Object *lua_hashget (Hash *t, Object *ref)
 Object *lua_hashget (Hash *t, Object *ref)
 {
 {
  int h = present(t, ref);
  int h = present(t, ref);
- if (tag(ref(node(t, h))) != LUA_T_NIL) return val(node(t, h));
+ if (ttype(ref(node(t, h))) != LUA_T_NIL) return val(node(t, h));
  else return NULL;
  else return NULL;
 }
 }
 
 
@@ -263,7 +263,7 @@ Object *lua_hashdefine (Hash *t, Object *ref)
  Node *n;
  Node *n;
  h = present(t, ref);
  h = present(t, ref);
  n = node(t, h);
  n = node(t, h);
- if (tag(ref(n)) == LUA_T_NIL)
+ if (ttype(ref(n)) == LUA_T_NIL)
  {
  {
   nuse(t)++;
   nuse(t)++;
   if ((float)nuse(t) > (float)nhash(t)*REHASH_LIMIT)
   if ((float)nuse(t) > (float)nhash(t)*REHASH_LIMIT)
@@ -273,7 +273,7 @@ Object *lua_hashdefine (Hash *t, Object *ref)
    n = node(t, h);
    n = node(t, h);
   }
   }
   *ref(n) = *ref;
   *ref(n) = *ref;
-  tag(val(n)) = LUA_T_NIL;
+  ttype(val(n)) = LUA_T_NIL;
  }
  }
  return (val(n));
  return (val(n));
 }
 }
@@ -289,7 +289,8 @@ static void hashnext (Hash *t, int i)
 {
 {
  if (i >= nhash(t))
  if (i >= nhash(t))
   return;
   return;
- while (tag(ref(node(t,i))) == LUA_T_NIL || tag(val(node(t,i))) == LUA_T_NIL)
+ while (ttype(ref(node(t,i))) == LUA_T_NIL ||
+        ttype(val(node(t,i))) == LUA_T_NIL)
  {
  {
   if (++i >= nhash(t))
   if (++i >= nhash(t))
    return;
    return;

+ 3 - 3
inout.c

@@ -5,7 +5,7 @@
 ** Also provides some predefined lua functions.
 ** Also provides some predefined lua functions.
 */
 */
 
 
-char *rcs_inout="$Id: inout.c,v 2.43 1996/09/25 12:57:22 roberto Exp roberto $";
+char *rcs_inout="$Id: inout.c,v 2.44 1997/02/26 17:38:41 roberto Unstable roberto $";
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
@@ -368,10 +368,10 @@ void luaI_predefine (void)
   Word n;
   Word n;
   for (i=0; i<INTFUNCSIZE; i++) {
   for (i=0; i<INTFUNCSIZE; i++) {
     n = luaI_findsymbolbyname(int_funcs[i].name);
     n = luaI_findsymbolbyname(int_funcs[i].name);
-    s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = int_funcs[i].func;
+    s_ttype(n) = LUA_T_CFUNCTION; s_fvalue(n) = int_funcs[i].func;
   }
   }
   n = luaI_findsymbolbyname("_VERSION_");
   n = luaI_findsymbolbyname("_VERSION_");
-  s_tag(n) = LUA_T_STRING; s_tsvalue(n) = lua_createstring(LUA_VERSION);
+  s_ttype(n) = LUA_T_STRING; s_tsvalue(n) = lua_createstring(LUA_VERSION);
 }
 }
 
 
 
 

+ 75 - 74
opcode.c

@@ -3,7 +3,7 @@
 ** TecCGraf - PUC-Rio
 ** TecCGraf - PUC-Rio
 */
 */
 
 
-char *rcs_opcode="$Id: opcode.c,v 3.82 1997/02/26 17:38:41 roberto Unstable roberto $";
+char *rcs_opcode="$Id: opcode.c,v 3.83 1997/03/06 17:30:55 roberto Exp roberto $";
 
 
 #include <setjmp.h>
 #include <setjmp.h>
 #include <stdio.h>
 #include <stdio.h>
@@ -20,8 +20,8 @@ char *rcs_opcode="$Id: opcode.c,v 3.82 1997/02/26 17:38:41 roberto Unstable robe
 #include "fallback.h"
 #include "fallback.h"
 #include "undump.h"
 #include "undump.h"
 
 
-#define tonumber(o) ((tag(o) != LUA_T_NUMBER) && (lua_tonumber(o) != 0))
-#define tostring(o) ((tag(o) != LUA_T_STRING) && (lua_tostring(o) != 0))
+#define tonumber(o) ((ttype(o) != LUA_T_NUMBER) && (lua_tonumber(o) != 0))
+#define tostring(o) ((ttype(o) != LUA_T_STRING) && (lua_tostring(o) != 0))
 
 
 
 
 #define STACK_SIZE 	128
 #define STACK_SIZE 	128
@@ -138,12 +138,12 @@ static int lua_tonumber (Object *obj)
 {
 {
  float t;
  float t;
  char c;
  char c;
- if (tag(obj) != LUA_T_STRING)
+ if (ttype(obj) != LUA_T_STRING)
    return 1;
    return 1;
  else if (sscanf(svalue(obj), "%f %c",&t, &c) == 1)
  else if (sscanf(svalue(obj), "%f %c",&t, &c) == 1)
  {
  {
    nvalue(obj) = t;
    nvalue(obj) = t;
-   tag(obj) = LUA_T_NUMBER;
+   ttype(obj) = LUA_T_NUMBER;
    return 0;
    return 0;
  }
  }
  else
  else
@@ -152,12 +152,12 @@ static int lua_tonumber (Object *obj)
 
 
 
 
 /*
 /*
-** Convert, if possible, to a string tag
+** Convert, if possible, to a string ttype
 ** Return 0 in success or not 0 on error.
 ** Return 0 in success or not 0 on error.
 */
 */
 static int lua_tostring (Object *obj)
 static int lua_tostring (Object *obj)
 {
 {
-  if (tag(obj) != LUA_T_NUMBER)
+  if (ttype(obj) != LUA_T_NUMBER)
     return 1;
     return 1;
   else {
   else {
     char s[60];
     char s[60];
@@ -168,7 +168,7 @@ static int lua_tostring (Object *obj)
     else
     else
       sprintf (s, "%g", nvalue(obj));
       sprintf (s, "%g", nvalue(obj));
     tsvalue(obj) = lua_createstring(s);
     tsvalue(obj) = lua_createstring(s);
-    tag(obj) = LUA_T_STRING;
+    ttype(obj) = LUA_T_STRING;
     return 0;
     return 0;
   }
   }
 }
 }
@@ -182,7 +182,7 @@ static void adjust_top (StkId newtop)
   Object *nt;
   Object *nt;
   lua_checkstack(stack+newtop);
   lua_checkstack(stack+newtop);
   nt = stack+newtop;  /* warning: previous call may change stack */
   nt = stack+newtop;  /* warning: previous call may change stack */
-  while (top < nt) tag(top++) = LUA_T_NIL;
+  while (top < nt) ttype(top++) = LUA_T_NIL;
   top = nt;  /* top could be bigger than newtop */
   top = nt;  /* top could be bigger than newtop */
 }
 }
 
 
@@ -289,14 +289,14 @@ static void do_call (StkId base, int nResults)
   StkId firstResult;
   StkId firstResult;
   Object *func = stack+base-1;
   Object *func = stack+base-1;
   int i;
   int i;
-  if (tag(func) == LUA_T_CFUNCTION)
+  if (ttype(func) == LUA_T_CFUNCTION)
   {
   {
-    tag(func) = LUA_T_CMARK;
+    ttype(func) = LUA_T_CMARK;
     firstResult = callC(fvalue(func), base);
     firstResult = callC(fvalue(func), base);
   }
   }
-  else if (tag(func) == LUA_T_FUNCTION)
+  else if (ttype(func) == LUA_T_FUNCTION)
   {
   {
-    tag(func) = LUA_T_MARK;
+    ttype(func) = LUA_T_MARK;
     firstResult = lua_execute(func->value.tf->code, base);
     firstResult = lua_execute(func->value.tf->code, base);
   }
   }
   else
   else
@@ -327,9 +327,9 @@ static void pushsubscript (void)
 {
 {
   int tg = luaI_tag(top-2);
   int tg = luaI_tag(top-2);
   Object *im = luaI_getim(tg, FB_GETTABLE);
   Object *im = luaI_getim(tg, FB_GETTABLE);
-  if (tag(top-2) == LUA_T_ARRAY && im == NULL) {
+  if (ttype(top-2) == LUA_T_ARRAY && im == NULL) {
       Object *h = lua_hashget(avalue(top-2), top-1);
       Object *h = lua_hashget(avalue(top-2), top-1);
-      if (h != NULL && tag(h) != LUA_T_NIL) {
+      if (h != NULL && ttype(h) != LUA_T_NIL) {
         --top;
         --top;
         *(top-1) = *h;
         *(top-1) = *h;
       }
       }
@@ -338,7 +338,7 @@ static void pushsubscript (void)
         callIM(im, 2, 1);
         callIM(im, 2, 1);
       else {
       else {
         --top;
         --top;
-        tag(top-1) = LUA_T_NIL;
+        ttype(top-1) = LUA_T_NIL;
       }
       }
   }
   }
   else {  /* object is not a table, and/or has a specific "gettable" method */
   else {  /* object is not a table, and/or has a specific "gettable" method */
@@ -353,7 +353,7 @@ static void pushsubscript (void)
 lua_Object lua_basicindex (void)
 lua_Object lua_basicindex (void)
 {
 {
   adjustC(2);
   adjustC(2);
-  if (tag(top-2) != LUA_T_ARRAY)
+  if (ttype(top-2) != LUA_T_ARRAY)
     lua_error("indexed expression not a table in basic indexing");
     lua_error("indexed expression not a table in basic indexing");
   else {
   else {
     Object *h = lua_hashget(avalue(top-2), top-1);
     Object *h = lua_hashget(avalue(top-2), top-1);
@@ -361,7 +361,7 @@ lua_Object lua_basicindex (void)
     if (h != NULL)
     if (h != NULL)
       *(top-1) = *h;
       *(top-1) = *h;
     else
     else
-      tag(top-1) = LUA_T_NIL;
+      ttype(top-1) = LUA_T_NIL;
   }
   }
   CLS_current.base++;  /* incorporate object in the stack */
   CLS_current.base++;  /* incorporate object in the stack */
   return (Ref(top-1));
   return (Ref(top-1));
@@ -377,7 +377,7 @@ lua_Object lua_basicindex (void)
 static void storesubscript (Object *t, int mode)
 static void storesubscript (Object *t, int mode)
 {
 {
   Object *im = (mode == 0) ? NULL : luaI_getim(luaI_tag(t), FB_SETTABLE);
   Object *im = (mode == 0) ? NULL : luaI_getim(luaI_tag(t), FB_SETTABLE);
-  if (tag(t) == LUA_T_ARRAY && im == NULL) {
+  if (ttype(t) == LUA_T_ARRAY && im == NULL) {
     Object *h = lua_hashdefine(avalue(t), t+1);
     Object *h = lua_hashdefine(avalue(t), t+1);
     *h = *(top-1);
     *h = *(top-1);
     top -= (mode == 2) ? 1 : 3;
     top -= (mode == 2) ? 1 : 3;
@@ -403,9 +403,9 @@ static void getglobal (Word n)
 {
 {
   *top = lua_table[n].object;
   *top = lua_table[n].object;
   incr_top;
   incr_top;
-  if (tag(top-1) == LUA_T_NIL)
+  if (ttype(top-1) == LUA_T_NIL)
   { /* must call getglobal fallback */
   { /* must call getglobal fallback */
-    tag(top-1) = LUA_T_STRING;
+    ttype(top-1) = LUA_T_STRING;
     tsvalue(top-1) = lua_table[n].varname;
     tsvalue(top-1) = lua_table[n].varname;
     callFB(FB_GETGLOBAL);
     callFB(FB_GETGLOBAL);
   }
   }
@@ -452,7 +452,7 @@ lua_Function lua_stackedfunction (int level)
 {
 {
   StkId i;
   StkId i;
   for (i = (top-1)-stack; i>=0; i--)
   for (i = (top-1)-stack; i>=0; i--)
-    if (stack[i].tag == LUA_T_MARK || stack[i].tag == LUA_T_CMARK)
+    if (stack[i].ttype == LUA_T_MARK || stack[i].ttype == LUA_T_CMARK)
       if (level-- == 0)
       if (level-- == 0)
         return Ref(stack+i);
         return Ref(stack+i);
   return LUA_NOOBJECT;
   return LUA_NOOBJECT;
@@ -462,7 +462,7 @@ lua_Function lua_stackedfunction (int level)
 int lua_currentline (lua_Function func)
 int lua_currentline (lua_Function func)
 {
 {
   Object *f = Address(func);
   Object *f = Address(func);
-  return (f+1 < top && (f+1)->tag == LUA_T_LINE) ? (f+1)->value.i : -1;
+  return (f+1 < top && (f+1)->ttype == LUA_T_LINE) ? (f+1)->value.i : -1;
 }
 }
 
 
 
 
@@ -512,7 +512,7 @@ static void do_unprotectedrun (lua_CFunction f, int nParams, int nResults)
 {
 {
   adjustC(nParams);
   adjustC(nParams);
   open_stack((top-stack)-CLS_current.base);
   open_stack((top-stack)-CLS_current.base);
-  stack[CLS_current.base].tag = LUA_T_CFUNCTION;
+  stack[CLS_current.base].ttype = LUA_T_CFUNCTION;
   stack[CLS_current.base].value.f = f;
   stack[CLS_current.base].value.f = f;
   do_callinc(nResults);
   do_callinc(nResults);
 }
 }
@@ -546,7 +546,7 @@ int luaI_dorun (TFunc *tf)
 {
 {
   int status;
   int status;
   adjustC(1);  /* one slot for the pseudo-function */
   adjustC(1);  /* one slot for the pseudo-function */
-  stack[CLS_current.base].tag = LUA_T_FUNCTION;
+  stack[CLS_current.base].ttype = LUA_T_FUNCTION;
   stack[CLS_current.base].value.tf = tf;
   stack[CLS_current.base].value.tf = tf;
   status = do_protectedrun(MULT_RET);
   status = do_protectedrun(MULT_RET);
   return status;
   return status;
@@ -731,7 +731,7 @@ lua_Object lua_createtable (void)
 {
 {
   adjustC(0);
   adjustC(0);
   avalue(top) = lua_createarray(0);
   avalue(top) = lua_createarray(0);
-  tag(top) = LUA_T_ARRAY;
+  ttype(top) = LUA_T_ARRAY;
   incr_top;
   incr_top;
   CLS_current.base++;  /* incorporate object in the stack */
   CLS_current.base++;  /* incorporate object in the stack */
   return Ref(top-1);
   return Ref(top-1);
@@ -751,17 +751,17 @@ lua_Object lua_getparam (int number)
 
 
 int lua_isnil (lua_Object o)
 int lua_isnil (lua_Object o)
 {
 {
-  return (o!= LUA_NOOBJECT) && (tag(Address(o)) == LUA_T_NIL);
+  return (o!= LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_NIL);
 }
 }
 
 
 int lua_istable (lua_Object o)
 int lua_istable (lua_Object o)
 {
 {
-  return (o!= LUA_NOOBJECT) && (tag(Address(o)) == LUA_T_ARRAY);
+  return (o!= LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_ARRAY);
 }
 }
 
 
 int lua_isuserdata (lua_Object o)
 int lua_isuserdata (lua_Object o)
 {
 {
-  return (o!= LUA_NOOBJECT) && (tag(Address(o)) == LUA_T_USERDATA);
+  return (o!= LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_USERDATA);
 }
 }
 
 
 int lua_iscfunction (lua_Object o)
 int lua_iscfunction (lua_Object o)
@@ -810,14 +810,14 @@ char *lua_getstring (lua_Object object)
 
 
 void *lua_getbinarydata (lua_Object object)
 void *lua_getbinarydata (lua_Object object)
 {
 {
-  if (object == LUA_NOOBJECT || tag(Address(object)) != LUA_T_USERDATA)
+  if (object == LUA_NOOBJECT || ttype(Address(object)) != LUA_T_USERDATA)
     lua_error("getbinarydata: object is not binary data");
     lua_error("getbinarydata: object is not binary data");
   return svalue(Address(object));
   return svalue(Address(object));
 }
 }
 
 
 int lua_getbindatasize (lua_Object object)
 int lua_getbindatasize (lua_Object object)
 {
 {
-  if (object == LUA_NOOBJECT || tag(Address(object)) != LUA_T_USERDATA)
+  if (object == LUA_NOOBJECT || ttype(Address(object)) != LUA_T_USERDATA)
     return 0;
     return 0;
   else return (Address(object))->value.ts->size;
   else return (Address(object))->value.ts->size;
 }
 }
@@ -827,8 +827,8 @@ int lua_getbindatasize (lua_Object object)
 */
 */
 lua_CFunction lua_getcfunction (lua_Object object)
 lua_CFunction lua_getcfunction (lua_Object object)
 {
 {
- if (object == LUA_NOOBJECT || ((tag(Address(object)) != LUA_T_CFUNCTION) &&
-                                (tag(Address(object)) != LUA_T_CMARK)))
+ if (object == LUA_NOOBJECT || ((ttype(Address(object)) != LUA_T_CFUNCTION) &&
+                                (ttype(Address(object)) != LUA_T_CMARK)))
    return NULL;
    return NULL;
  else return (fvalue(Address(object)));
  else return (fvalue(Address(object)));
 }
 }
@@ -889,30 +889,30 @@ void lua_storeglobal (char *name)
 */
 */
 void lua_pushnil (void)
 void lua_pushnil (void)
 {
 {
- tag(top) = LUA_T_NIL;
+ ttype(top) = LUA_T_NIL;
  incr_top;
  incr_top;
 }
 }
 
 
 /*
 /*
-** Push an object (tag=number) to stack.
+** Push an object (ttype=number) to stack.
 */
 */
 void lua_pushnumber (real n)
 void lua_pushnumber (real n)
 {
 {
- tag(top) = LUA_T_NUMBER; nvalue(top) = n;
+ ttype(top) = LUA_T_NUMBER; nvalue(top) = n;
  incr_top;
  incr_top;
 }
 }
 
 
 /*
 /*
-** Push an object (tag=string) to stack.
+** Push an object (ttype=string) to stack.
 */
 */
 void lua_pushstring (char *s)
 void lua_pushstring (char *s)
 {
 {
   if (s == NULL)
   if (s == NULL)
-    tag(top) = LUA_T_NIL;
+    ttype(top) = LUA_T_NIL;
   else
   else
   {
   {
     tsvalue(top) = lua_createstring(s);
     tsvalue(top) = lua_createstring(s);
-    tag(top) = LUA_T_STRING;
+    ttype(top) = LUA_T_STRING;
   }
   }
   incr_top;
   incr_top;
 }
 }
@@ -920,27 +920,27 @@ void lua_pushstring (char *s)
 void lua_pushliteral(char *s) { lua_pushstring(s); }*/
 void lua_pushliteral(char *s) { lua_pushstring(s); }*/
 
 
 /*
 /*
-** Push an object (tag=cfunction) to stack.
+** Push an object (ttype=cfunction) to stack.
 */
 */
 void lua_pushcfunction (lua_CFunction fn)
 void lua_pushcfunction (lua_CFunction fn)
 {
 {
- tag(top) = LUA_T_CFUNCTION; fvalue(top) = fn;
+ ttype(top) = LUA_T_CFUNCTION; fvalue(top) = fn;
  incr_top;
  incr_top;
 }
 }
 
 
 void lua_pushbinarydata (void *buff, int size, int tag)
 void lua_pushbinarydata (void *buff, int size, int tag)
 {
 {
   if (buff == NULL)
   if (buff == NULL)
-    tag(top) = LUA_T_NIL;
+    ttype(top) = LUA_T_NIL;
   else {
   else {
     tsvalue(top) = luaI_createuserdata(buff, size, tag);
     tsvalue(top) = luaI_createuserdata(buff, size, tag);
-    tag(top) = LUA_T_USERDATA;
+    ttype(top) = LUA_T_USERDATA;
   }
   }
   incr_top;
   incr_top;
 }
 }
 
 
 /*
 /*
-** Push an object (tag=userdata) to stack.
+** Push an object (ttype=userdata) to stack.
 */
 */
 void lua_pushusertag (void *u, int tag)
 void lua_pushusertag (void *u, int tag)
 {
 {
@@ -966,8 +966,8 @@ void lua_pushobject (lua_Object o)
   if (o == LUA_NOOBJECT)
   if (o == LUA_NOOBJECT)
     lua_error("attempt to push a NOOBJECT");
     lua_error("attempt to push a NOOBJECT");
   *top = *Address(o);
   *top = *Address(o);
-  if (tag(top) == LUA_T_MARK) tag(top) = LUA_T_FUNCTION;
-  else if (tag(top) == LUA_T_CMARK) tag(top) = LUA_T_CFUNCTION;
+  if (ttype(top) == LUA_T_MARK) ttype(top) = LUA_T_FUNCTION;
+  else if (ttype(top) == LUA_T_CMARK) ttype(top) = LUA_T_CFUNCTION;
   incr_top;
   incr_top;
 }
 }
 
 
@@ -991,13 +991,13 @@ static void call_arith (char *op)
   callFB(FB_ARITH);
   callFB(FB_ARITH);
 }
 }
 
 
-static void comparison (lua_Type tag_less, lua_Type tag_equal, 
-                        lua_Type tag_great, char *op)
+static void comparison (lua_Type ttype_less, lua_Type ttype_equal, 
+                        lua_Type ttype_great, char *op)
 {
 {
   Object *l = top-2;
   Object *l = top-2;
   Object *r = top-1;
   Object *r = top-1;
   int result;
   int result;
-  if (tag(l) == LUA_T_NUMBER && tag(r) == LUA_T_NUMBER)
+  if (ttype(l) == LUA_T_NUMBER && ttype(r) == LUA_T_NUMBER)
     result = (nvalue(l) < nvalue(r)) ? -1 : (nvalue(l) == nvalue(r)) ? 0 : 1;
     result = (nvalue(l) < nvalue(r)) ? -1 : (nvalue(l) == nvalue(r)) ? 0 : 1;
   else if (tostring(l) || tostring(r))
   else if (tostring(l) || tostring(r))
   {
   {
@@ -1009,7 +1009,8 @@ static void comparison (lua_Type tag_less, lua_Type tag_equal,
     result = strcmp(svalue(l), svalue(r));
     result = strcmp(svalue(l), svalue(r));
   top--;
   top--;
   nvalue(top-1) = 1;
   nvalue(top-1) = 1;
-  tag(top-1) = (result < 0) ? tag_less : (result == 0) ? tag_equal : tag_great;
+  ttype(top-1) = (result < 0) ? ttype_less :
+                                (result == 0) ? ttype_equal : ttype_great;
 }
 }
 
 
 
 
@@ -1021,18 +1022,18 @@ static void adjust_varargs (StkId first_extra_arg)
   int i;
   int i;
   if (nvararg < 0) nvararg = 0;
   if (nvararg < 0) nvararg = 0;
   avalue(&arg)  = lua_createarray(nvararg+1);  /* +1 for field 'n' */
   avalue(&arg)  = lua_createarray(nvararg+1);  /* +1 for field 'n' */
-  tag(&arg) = LUA_T_ARRAY;
+  ttype(&arg) = LUA_T_ARRAY;
   for (i=0; i<nvararg; i++) {
   for (i=0; i<nvararg; i++) {
     Object index;
     Object index;
-    tag(&index) = LUA_T_NUMBER;
+    ttype(&index) = LUA_T_NUMBER;
     nvalue(&index) = i+1;
     nvalue(&index) = i+1;
     *(lua_hashdefine(avalue(&arg), &index)) = *(firstelem+i);
     *(lua_hashdefine(avalue(&arg), &index)) = *(firstelem+i);
   }
   }
   /* store counter in field "n" */ {
   /* store counter in field "n" */ {
     Object index, extra;
     Object index, extra;
-    tag(&index) = LUA_T_STRING;
+    ttype(&index) = LUA_T_STRING;
     tsvalue(&index) = lua_createstring("n");
     tsvalue(&index) = lua_createstring("n");
-    tag(&extra) = LUA_T_NUMBER;
+    ttype(&extra) = LUA_T_NUMBER;
     nvalue(&extra) = nvararg;
     nvalue(&extra) = nvararg;
     *(lua_hashdefine(avalue(&arg), &index)) = extra;
     *(lua_hashdefine(avalue(&arg), &index)) = extra;
   }
   }
@@ -1056,22 +1057,22 @@ static StkId lua_execute (Byte *pc, StkId base)
   OpCode opcode;
   OpCode opcode;
   switch (opcode = (OpCode)*pc++)
   switch (opcode = (OpCode)*pc++)
   {
   {
-   case PUSHNIL: tag(top) = LUA_T_NIL; incr_top; break;
+   case PUSHNIL: ttype(top) = LUA_T_NIL; incr_top; break;
 
 
    case PUSH0: case PUSH1: case PUSH2:
    case PUSH0: case PUSH1: case PUSH2:
-     tag(top) = LUA_T_NUMBER;
+     ttype(top) = LUA_T_NUMBER;
      nvalue(top) = opcode-PUSH0;
      nvalue(top) = opcode-PUSH0;
      incr_top;
      incr_top;
      break;
      break;
 
 
    case PUSHBYTE: 
    case PUSHBYTE: 
-     tag(top) = LUA_T_NUMBER; nvalue(top) = *pc++; incr_top; break;
+     ttype(top) = LUA_T_NUMBER; nvalue(top) = *pc++; incr_top; break;
 
 
    case PUSHWORD:
    case PUSHWORD:
    {
    {
     Word w;
     Word w;
     get_word(w,pc);
     get_word(w,pc);
-    tag(top) = LUA_T_NUMBER; nvalue(top) = w;
+    ttype(top) = LUA_T_NUMBER; nvalue(top) = w;
     incr_top;
     incr_top;
    }
    }
    break;
    break;
@@ -1080,7 +1081,7 @@ static StkId lua_execute (Byte *pc, StkId base)
    {
    {
     real num;
     real num;
     get_float(num,pc);
     get_float(num,pc);
-    tag(top) = LUA_T_NUMBER; nvalue(top) = num;
+    ttype(top) = LUA_T_NUMBER; nvalue(top) = num;
     incr_top;
     incr_top;
    }
    }
    break;
    break;
@@ -1089,7 +1090,7 @@ static StkId lua_execute (Byte *pc, StkId base)
    {
    {
     Word w;
     Word w;
     get_word(w,pc);
     get_word(w,pc);
-    tag(top) = LUA_T_STRING; tsvalue(top) = lua_constant[w];
+    ttype(top) = LUA_T_STRING; tsvalue(top) = lua_constant[w];
     incr_top;
     incr_top;
    }
    }
    break;
    break;
@@ -1099,7 +1100,7 @@ static StkId lua_execute (Byte *pc, StkId base)
     TFunc *f;
     TFunc *f;
     get_code(f,pc);
     get_code(f,pc);
     luaI_insertfunction(f);  /* may take part in GC */
     luaI_insertfunction(f);  /* may take part in GC */
-    top->tag = LUA_T_FUNCTION;
+    top->ttype = LUA_T_FUNCTION;
     top->value.tf = f;
     top->value.tf = f;
     incr_top;
     incr_top;
    }
    }
@@ -1130,7 +1131,7 @@ static StkId lua_execute (Byte *pc, StkId base)
      Object receiver = *(top-1);
      Object receiver = *(top-1);
      Word w;
      Word w;
      get_word(w,pc);
      get_word(w,pc);
-     tag(top) = LUA_T_STRING; tsvalue(top) = lua_constant[w];
+     ttype(top) = LUA_T_STRING; tsvalue(top) = lua_constant[w];
      incr_top;
      incr_top;
      pushsubscript();
      pushsubscript();
      *top = receiver;
      *top = receiver;
@@ -1176,7 +1177,7 @@ static StkId lua_execute (Byte *pc, StkId base)
     arr = top-n-1;
     arr = top-n-1;
     while (n)
     while (n)
     {
     {
-     tag(top) = LUA_T_NUMBER; nvalue(top) = n+m;
+     ttype(top) = LUA_T_NUMBER; nvalue(top) = n+m;
      *(lua_hashdefine (avalue(arr), top)) = *(top-1);
      *(lua_hashdefine (avalue(arr), top)) = *(top-1);
      top--;
      top--;
      n--;
      n--;
@@ -1192,7 +1193,7 @@ static StkId lua_execute (Byte *pc, StkId base)
     {
     {
      Word w;
      Word w;
      get_word(w,pc);
      get_word(w,pc);
-     tag(top) = LUA_T_STRING; tsvalue(top) = lua_constant[w];
+     ttype(top) = LUA_T_STRING; tsvalue(top) = lua_constant[w];
      *(lua_hashdefine (avalue(arr), top)) = *(top-1);
      *(lua_hashdefine (avalue(arr), top)) = *(top-1);
      top--;
      top--;
      n--;
      n--;
@@ -1227,7 +1228,7 @@ static StkId lua_execute (Byte *pc, StkId base)
     Word size;
     Word size;
     get_word(size,pc);
     get_word(size,pc);
     avalue(top) = lua_createarray(size);
     avalue(top) = lua_createarray(size);
-    tag(top) = LUA_T_ARRAY;
+    ttype(top) = LUA_T_ARRAY;
     incr_top;
     incr_top;
    }
    }
    break;
    break;
@@ -1236,7 +1237,7 @@ static StkId lua_execute (Byte *pc, StkId base)
    {
    {
     int res = lua_equalObj(top-2, top-1);
     int res = lua_equalObj(top-2, top-1);
     --top;
     --top;
-    tag(top-1) = res ? LUA_T_NUMBER : LUA_T_NIL;
+    ttype(top-1) = res ? LUA_T_NUMBER : LUA_T_NIL;
     nvalue(top-1) = 1;
     nvalue(top-1) = 1;
    }
    }
    break;
    break;
@@ -1334,7 +1335,7 @@ static StkId lua_execute (Byte *pc, StkId base)
    case MINUSOP:
    case MINUSOP:
     if (tonumber(top-1))
     if (tonumber(top-1))
     {
     {
-      tag(top) = LUA_T_NIL;
+      ttype(top) = LUA_T_NIL;
       incr_top;
       incr_top;
       call_arith("unm");
       call_arith("unm");
     }
     }
@@ -1343,7 +1344,7 @@ static StkId lua_execute (Byte *pc, StkId base)
    break;
    break;
 
 
    case NOTOP:
    case NOTOP:
-    tag(top-1) = (tag(top-1) == LUA_T_NIL) ? LUA_T_NUMBER : LUA_T_NIL;
+    ttype(top-1) = (ttype(top-1) == LUA_T_NIL) ? LUA_T_NUMBER : LUA_T_NIL;
     nvalue(top-1) = 1;
     nvalue(top-1) = 1;
    break;
    break;
 
 
@@ -1351,7 +1352,7 @@ static StkId lua_execute (Byte *pc, StkId base)
    {
    {
     Word w;
     Word w;
     get_word(w,pc);
     get_word(w,pc);
-    if (tag(top-1) != LUA_T_NIL) pc += w;
+    if (ttype(top-1) != LUA_T_NIL) pc += w;
    }
    }
    break;
    break;
 
 
@@ -1359,7 +1360,7 @@ static StkId lua_execute (Byte *pc, StkId base)
    {
    {
     Word w;
     Word w;
     get_word(w,pc);
     get_word(w,pc);
-    if (tag(top-1) == LUA_T_NIL) pc += w;
+    if (ttype(top-1) == LUA_T_NIL) pc += w;
    }
    }
    break;
    break;
 
 
@@ -1384,7 +1385,7 @@ static StkId lua_execute (Byte *pc, StkId base)
     Word w;
     Word w;
     get_word(w,pc);
     get_word(w,pc);
     top--;
     top--;
-    if (tag(top) == LUA_T_NIL) pc += w;
+    if (ttype(top) == LUA_T_NIL) pc += w;
    }
    }
    break;
    break;
 
 
@@ -1393,7 +1394,7 @@ static StkId lua_execute (Byte *pc, StkId base)
     Word w;
     Word w;
     get_word(w,pc);
     get_word(w,pc);
     top--;
     top--;
-    if (tag(top) == LUA_T_NIL) pc -= w;
+    if (ttype(top) == LUA_T_NIL) pc -= w;
    }
    }
    break;
    break;
 
 
@@ -1418,12 +1419,12 @@ static StkId lua_execute (Byte *pc, StkId base)
    {
    {
     Word line;
     Word line;
     get_word(line,pc);
     get_word(line,pc);
-    if ((stack+base-1)->tag != LUA_T_LINE)
+    if ((stack+base-1)->ttype != LUA_T_LINE)
     {
     {
       /* open space for LINE value */
       /* open space for LINE value */
       open_stack((top-stack)-base);
       open_stack((top-stack)-base);
       base++;
       base++;
-      (stack+base-1)->tag = LUA_T_LINE;
+      (stack+base-1)->ttype = LUA_T_LINE;
     }
     }
     (stack+base-1)->value.i = line;
     (stack+base-1)->value.i = line;
     if (lua_linehook)
     if (lua_linehook)

+ 4 - 4
opcode.h

@@ -1,6 +1,6 @@
 /*
 /*
 ** TeCGraf - PUC-Rio
 ** TeCGraf - PUC-Rio
-** $Id: opcode.h,v 3.26 1997/02/20 15:51:14 roberto Exp roberto $
+** $Id: opcode.h,v 3.27 1997/03/06 17:30:55 roberto Exp roberto $
 */
 */
 
 
 #ifndef opcode_h
 #ifndef opcode_h
@@ -121,13 +121,13 @@ typedef union
 
 
 typedef struct Object
 typedef struct Object
 {
 {
- lua_Type  tag;
+ lua_Type ttype;
  Value value;
  Value value;
 } Object;
 } Object;
 
 
 
 
 /* Macros to access structure members */
 /* Macros to access structure members */
-#define tag(o)		((o)->tag)
+#define ttype(o)	((o)->ttype)
 #define nvalue(o)	((o)->value.n)
 #define nvalue(o)	((o)->value.n)
 #define svalue(o)	((o)->value.ts->str)
 #define svalue(o)	((o)->value.ts->str)
 #define tsvalue(o)	((o)->value.ts)
 #define tsvalue(o)	((o)->value.ts)
@@ -136,7 +136,7 @@ typedef struct Object
 
 
 /* Macros to access symbol table */
 /* Macros to access symbol table */
 #define s_object(i)	(lua_table[i].object)
 #define s_object(i)	(lua_table[i].object)
-#define s_tag(i)	(tag(&s_object(i)))
+#define s_ttype(i)	(ttype(&s_object(i)))
 #define s_nvalue(i)	(nvalue(&s_object(i)))
 #define s_nvalue(i)	(nvalue(&s_object(i)))
 #define s_svalue(i)	(svalue(&s_object(i)))
 #define s_svalue(i)	(svalue(&s_object(i)))
 #define s_tsvalue(i)	(tsvalue(&s_object(i)))
 #define s_tsvalue(i)	(tsvalue(&s_object(i)))

+ 13 - 12
table.c

@@ -3,7 +3,7 @@
 ** Module to control static tables
 ** Module to control static tables
 */
 */
 
 
-char *rcs_table="$Id: table.c,v 2.58 1996/11/01 12:47:45 roberto Exp roberto $";
+char *rcs_table="$Id: table.c,v 2.59 1997/02/26 17:38:41 roberto Unstable roberto $";
 
 
 #include "mem.h"
 #include "mem.h"
 #include "opcode.h"
 #include "opcode.h"
@@ -64,7 +64,7 @@ Word luaI_findsymbol (TaggedString *t)
                       symbolEM, MAX_WORD);
                       symbolEM, MAX_WORD);
   t->varindex = lua_ntable;
   t->varindex = lua_ntable;
   lua_table[lua_ntable].varname = t;
   lua_table[lua_ntable].varname = t;
-  s_tag(lua_ntable) = LUA_T_NIL;
+  s_ttype(lua_ntable) = LUA_T_NIL;
   lua_ntable++;
   lua_ntable++;
  }
  }
  return t->varindex;
  return t->varindex;
@@ -128,11 +128,11 @@ static char *lua_travsymbol (int (*fn)(Object *))
 */
 */
 int lua_markobject (Object *o)
 int lua_markobject (Object *o)
 {/* if already marked, does not change mark value */
 {/* if already marked, does not change mark value */
- if (tag(o) == LUA_T_STRING && !tsvalue(o)->marked)
+ if (ttype(o) == LUA_T_STRING && !tsvalue(o)->marked)
    tsvalue(o)->marked = 1;
    tsvalue(o)->marked = 1;
- else if (tag(o) == LUA_T_ARRAY)
+ else if (ttype(o) == LUA_T_ARRAY)
    lua_hashmark (avalue(o));
    lua_hashmark (avalue(o));
- else if ((o->tag == LUA_T_FUNCTION || o->tag == LUA_T_MARK)
+ else if ((o->ttype == LUA_T_FUNCTION || o->ttype == LUA_T_MARK)
            && !o->value.tf->marked)
            && !o->value.tf->marked)
    o->value.tf->marked = 1;
    o->value.tf->marked = 1;
  return 0;
  return 0;
@@ -143,7 +143,7 @@ int lua_markobject (Object *o)
 */
 */
 int luaI_ismarked (Object *o)
 int luaI_ismarked (Object *o)
 {
 {
-  switch (o->tag)
+  switch (o->ttype)
   {
   {
    case LUA_T_STRING:
    case LUA_T_STRING:
      return o->value.ts->marked;
      return o->value.ts->marked;
@@ -207,7 +207,7 @@ void luaI_nextvar (void)
  }
  }
  else
  else
    next = luaI_findsymbolbyname(lua_getstring(o)) + 1;
    next = luaI_findsymbolbyname(lua_getstring(o)) + 1;
- while (next < lua_ntable && s_tag(next) == LUA_T_NIL) next++;
+ while (next < lua_ntable && s_ttype(next) == LUA_T_NIL) next++;
  if (next < lua_ntable)
  if (next < lua_ntable)
  {
  {
   lua_pushstring(lua_table[next].varname->str);
   lua_pushstring(lua_table[next].varname->str);
@@ -219,14 +219,15 @@ void luaI_nextvar (void)
 static Object *functofind;
 static Object *functofind;
 static int checkfunc (Object *o)
 static int checkfunc (Object *o)
 {
 {
-  if (o->tag == LUA_T_FUNCTION)
+  if (o->ttype == LUA_T_FUNCTION)
     return
     return
-       ((functofind->tag == LUA_T_FUNCTION || functofind->tag == LUA_T_MARK)
+       ((functofind->ttype == LUA_T_FUNCTION || functofind->ttype == LUA_T_MARK)
             && (functofind->value.tf == o->value.tf));
             && (functofind->value.tf == o->value.tf));
-  if (o->tag == LUA_T_CFUNCTION)
+  if (o->ttype == LUA_T_CFUNCTION)
     return
     return
-       ((functofind->tag == LUA_T_CFUNCTION || functofind->tag == LUA_T_CMARK)
-            && (functofind->value.f == o->value.f));
+       ((functofind->ttype == LUA_T_CFUNCTION ||
+         functofind->ttype == LUA_T_CMARK) &&
+         (functofind->value.f == o->value.f));
   return 0;
   return 0;
 }
 }