From 73aa465a8ed8dee6c6a27a6f8b2f51227b70789d Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 10 Mar 2000 15:37:44 -0300
Subject: some name changes

---
 lapi.c     |  54 ++++++++--------
 lapi.h     |   4 +-
 lbuiltin.c |  64 +++++++++----------
 lcode.c    | 172 +++++++++++++++++++++++++--------------------------
 lcode.h    |   4 +-
 ldebug.c   |  38 ++++++------
 ldo.c      |  28 ++++-----
 lfunc.c    |  12 ++--
 lfunc.h    |   8 +--
 lgc.c      |  30 ++++-----
 llex.c     |  42 ++++++-------
 llex.h     |  17 ++---
 lmathlib.c |   4 +-
 lmem.c     |   4 +-
 lobject.c  |  20 +++---
 lobject.h  |  88 +++++++++++++-------------
 lopcodes.h |  98 ++++++++++++++---------------
 lparser.c  | 158 +++++++++++++++++++++++------------------------
 lparser.h  |   8 +--
 lref.c     |  12 ++--
 lstate.h   |   6 +-
 lstring.c  |  52 ++++++++--------
 lstring.h  |  14 ++---
 ltable.c   |  30 ++++-----
 ltests.c   |   6 +-
 ltm.c      |  40 ++++++------
 lundump.c  |  36 +++++------
 lundump.h  |   6 +-
 lvm.c      | 206 ++++++++++++++++++++++++++++++-------------------------------
 lvm.h      |   8 +--
 30 files changed, 635 insertions(+), 634 deletions(-)

diff --git a/lapi.c b/lapi.c
index d915696b..1391511f 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lapi.c,v 1.72 2000/02/22 17:54:16 roberto Exp roberto $
+** $Id: lapi.c,v 1.73 2000/03/03 14:58:26 roberto Exp roberto $
 ** Lua API
 ** See Copyright Notice in lua.h
 */
@@ -33,7 +33,7 @@ const char lua_ident[] = "$Lua: " LUA_VERSION " " LUA_COPYRIGHT " $\n"
 
 const TObject *luaA_protovalue (const TObject *o) {
   switch (ttype(o)) {
-    case LUA_T_CCLOSURE:  case LUA_T_LCLOSURE:
+    case TAG_CCLOSURE:  case TAG_LCLOSURE:
       return protovalue(o);
     default:
       return o;
@@ -106,7 +106,7 @@ lua_Object lua_settagmethod (lua_State *L, int tag, const char *event) {
   TObject *method;
   luaA_checkCargs(L, 1);
   method = L->top-1;
-  if ((ttype(method) != LUA_T_NIL) && (*lua_type(L, method) != 'f'))
+  if ((ttype(method) != TAG_NIL) && (*lua_type(L, method) != 'f'))
     lua_error(L, "Lua API error - tag method must be a function or nil");
   luaT_settagmethod(L, tag, event, method);
   return luaA_putObjectOnTop(L);
@@ -132,7 +132,7 @@ lua_Object lua_gettable (lua_State *L) {
 lua_Object lua_rawgettable (lua_State *L) {
   lua_Object res;
   luaA_checkCargs(L, 2);
-  if (ttype(L->top-2) != LUA_T_ARRAY)
+  if (ttype(L->top-2) != TAG_ARRAY)
     lua_error(L, "indexed expression not a table in rawgettable");
   res = luaA_putluaObject(L, luaH_get(L, avalue(L->top-2), L->top-1));
   L->top -= 2;
@@ -159,7 +159,7 @@ lua_Object lua_createtable (lua_State *L) {
   TObject o;
   luaC_checkGC(L);
   avalue(&o) = luaH_new(L, 0);
-  ttype(&o) = LUA_T_ARRAY;
+  ttype(&o) = TAG_ARRAY;
   return luaA_putluaObject(L, &o);
 }
 
@@ -196,21 +196,21 @@ const char *lua_type (lua_State *L, lua_Object o) {
 
 int lua_isnil (lua_State *L, lua_Object o) {
   UNUSED(L);
-  return (o != LUA_NOOBJECT) && (ttype(o) == LUA_T_NIL);
+  return (o != LUA_NOOBJECT) && (ttype(o) == TAG_NIL);
 }
 
 int lua_istable (lua_State *L, lua_Object o) {
   UNUSED(L);
-  return (o != LUA_NOOBJECT) && (ttype(o) == LUA_T_ARRAY);
+  return (o != LUA_NOOBJECT) && (ttype(o) == TAG_ARRAY);
 }
 
 int lua_isuserdata (lua_State *L, lua_Object o) {
   UNUSED(L);
-  return (o != LUA_NOOBJECT) && (ttype(o) == LUA_T_USERDATA);
+  return (o != LUA_NOOBJECT) && (ttype(o) == TAG_USERDATA);
 }
 
 int lua_iscfunction (lua_State *L, lua_Object o) {
-  return (lua_tag(L, o) == LUA_T_CPROTO);
+  return (lua_tag(L, o) == TAG_CPROTO);
 }
 
 int lua_isnumber (lua_State *L, lua_Object o) {
@@ -220,8 +220,8 @@ int lua_isnumber (lua_State *L, lua_Object o) {
 
 int lua_isstring (lua_State *L, lua_Object o) {
   UNUSED(L);
-  return (o != LUA_NOOBJECT && (ttype(o) == LUA_T_STRING ||
-                                ttype(o) == LUA_T_NUMBER));
+  return (o != LUA_NOOBJECT && (ttype(o) == TAG_STRING ||
+                                ttype(o) == TAG_NUMBER));
 }
 
 int lua_isfunction (lua_State *L, lua_Object o) {
@@ -258,7 +258,7 @@ long lua_strlen (lua_State *L, lua_Object obj) {
 
 void *lua_getuserdata (lua_State *L, lua_Object obj) {
   UNUSED(L);
-  if (obj == LUA_NOOBJECT || ttype(obj) != LUA_T_USERDATA)
+  if (obj == LUA_NOOBJECT || ttype(obj) != TAG_USERDATA)
     return NULL;
   else return tsvalue(obj)->u.d.value;
 }
@@ -271,19 +271,19 @@ lua_CFunction lua_getcfunction (lua_State *L, lua_Object obj) {
 
 
 void lua_pushnil (lua_State *L) {
-  ttype(L->top) = LUA_T_NIL;
+  ttype(L->top) = TAG_NIL;
   incr_top;
 }
 
 void lua_pushnumber (lua_State *L, double n) {
-  ttype(L->top) = LUA_T_NUMBER;
+  ttype(L->top) = TAG_NUMBER;
   nvalue(L->top) = n;
   incr_top;
 }
 
 void lua_pushlstring (lua_State *L, const char *s, long len) {
   tsvalue(L->top) = luaS_newlstr(L, s, len);
-  ttype(L->top) = LUA_T_STRING;
+  ttype(L->top) = TAG_STRING;
   incr_top;
   luaC_checkGC(L);
 }
@@ -299,7 +299,7 @@ void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
   if (fn == NULL)
     lua_error(L, "Lua API error - attempt to push a NULL Cfunction");
   luaA_checkCargs(L, n);
-  ttype(L->top) = LUA_T_CPROTO;
+  ttype(L->top) = TAG_CPROTO;
   fvalue(L->top) = fn;
   incr_top;
   luaV_closure(L, n);
@@ -310,7 +310,7 @@ void lua_pushusertag (lua_State *L, void *u, int tag) {
   if (tag < 0 && tag != LUA_ANYTAG)
     luaT_realtag(L, tag);  /* error if tag is not valid */
   tsvalue(L->top) = luaS_createudata(L, u, tag);
-  ttype(L->top) = LUA_T_USERDATA;
+  ttype(L->top) = TAG_USERDATA;
   incr_top;
   luaC_checkGC(L);
 }
@@ -331,8 +331,8 @@ void lua_pushobject (lua_State *L, lua_Object o) {
 int lua_tag (lua_State *L, lua_Object o) {
   UNUSED(L);
   if (o == LUA_NOOBJECT)
-    return LUA_T_NIL;
-  else if (ttype(o) == LUA_T_USERDATA)  /* to allow `old' tags (deprecated) */
+    return TAG_NIL;
+  else if (ttype(o) == TAG_USERDATA)  /* to allow `old' tags (deprecated) */
     return o->value.ts->u.d.tag;
   else
     return luaT_effectivetag(o);
@@ -343,10 +343,10 @@ void lua_settag (lua_State *L, int tag) {
   luaA_checkCargs(L, 1);
   luaT_realtag(L, tag);
   switch (ttype(L->top-1)) {
-    case LUA_T_ARRAY:
+    case TAG_ARRAY:
       (L->top-1)->value.a->htag = tag;
       break;
-    case LUA_T_USERDATA:
+    case TAG_USERDATA:
       (L->top-1)->value.ts->u.d.tag = tag;
       break;
     default:
@@ -357,7 +357,7 @@ void lua_settag (lua_State *L, int tag) {
 }
 
 
-GlobalVar *luaA_nextvar (lua_State *L, TaggedString *ts) {
+GlobalVar *luaA_nextvar (lua_State *L, TString *ts) {
   GlobalVar *gv;
   if (ts == NULL)
     gv = L->rootglobal;  /* first variable */
@@ -366,10 +366,10 @@ GlobalVar *luaA_nextvar (lua_State *L, TaggedString *ts) {
     luaL_arg_check(L, ts->u.s.gv, 1, "variable name expected");
     gv = ts->u.s.gv->next;  /* get next */
   }
-  while (gv && gv->value.ttype == LUA_T_NIL)  /* skip globals with nil */
+  while (gv && gv->value.ttype == TAG_NIL)  /* skip globals with nil */
     gv = gv->next;
   if (gv) {
-    ttype(L->top) = LUA_T_STRING; tsvalue(L->top) = gv->name;
+    ttype(L->top) = TAG_STRING; tsvalue(L->top) = gv->name;
     incr_top;
     luaA_pushobject(L, &gv->value);
   }
@@ -378,7 +378,7 @@ GlobalVar *luaA_nextvar (lua_State *L, TaggedString *ts) {
 
 
 const char *lua_nextvar (lua_State *L, const char *varname) {
-  TaggedString *ts = (varname == NULL) ? NULL : luaS_new(L, varname);
+  TString *ts = (varname == NULL) ? NULL : luaS_new(L, varname);
   GlobalVar *gv = luaA_nextvar(L, ts);
   if (gv) {
     top2LC(L, 2);
@@ -395,7 +395,7 @@ int luaA_next (lua_State *L, const Hash *t, int i) {
   int tsize = t->size;
   for (; i<tsize; i++) {
     Node *n = node(t, i);
-    if (ttype(val(n)) != LUA_T_NIL) {
+    if (ttype(val(n)) != TAG_NIL) {
       luaA_pushobject(L, key(n));
       luaA_pushobject(L, val(n));
       return i+1;  /* index to be used next time */
@@ -406,7 +406,7 @@ int luaA_next (lua_State *L, const Hash *t, int i) {
 
 
 int lua_next (lua_State *L, lua_Object t, int i) {
-  if (ttype(t) != LUA_T_ARRAY)
+  if (ttype(t) != TAG_ARRAY)
     lua_error(L, "Lua API error - object is not a table in `lua_next'"); 
   i = luaA_next(L, avalue(t), i);
   top2LC(L, (i==0) ? 0 : 2);
diff --git a/lapi.h b/lapi.h
index 5fb3e90d..835009d7 100644
--- a/lapi.h
+++ b/lapi.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lapi.h,v 1.13 2000/01/19 12:00:45 roberto Exp roberto $
+** $Id: lapi.h,v 1.14 2000/03/03 14:58:26 roberto Exp roberto $
 ** Auxiliary functions from Lua API
 ** See Copyright Notice in lua.h
 */
@@ -14,7 +14,7 @@
 void luaA_checkCargs (lua_State *L, int nargs);
 const TObject *luaA_protovalue (const TObject *o);
 void luaA_pushobject (lua_State *L, const TObject *o);
-GlobalVar *luaA_nextvar (lua_State *L, TaggedString *g);
+GlobalVar *luaA_nextvar (lua_State *L, TString *g);
 int luaA_next (lua_State *L, const Hash *t, int i);
 lua_Object luaA_putluaObject (lua_State *L, const TObject *o);
 lua_Object luaA_putObjectOnTop (lua_State *L);
diff --git a/lbuiltin.c b/lbuiltin.c
index 3c558886..41787bcc 100644
--- a/lbuiltin.c
+++ b/lbuiltin.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lbuiltin.c,v 1.94 2000/03/03 14:58:26 roberto Exp $
+** $Id: lbuiltin.c,v 1.95 2000/03/09 00:19:22 roberto Exp roberto $
 ** Built-in functions
 ** See Copyright Notice in lua.h
 */
@@ -52,20 +52,20 @@ void luaB_opentests (lua_State *L);
 */
 
 
-static void pushtagstring (lua_State *L, TaggedString *s) {
-  ttype(L->top) = LUA_T_STRING;
+static void pushtagstring (lua_State *L, TString *s) {
+  ttype(L->top) = TAG_STRING;
   tsvalue(L->top) = s;
   incr_top;
 }
 
 
-static real getsize (const Hash *h) {
-  real max = 0;
+static Number getsize (const Hash *h) {
+  Number max = 0;
   int i = h->size;
   Node *n = h->node;
   while (i--) {
-    if (ttype(key(n)) == LUA_T_NUMBER && 
-        ttype(val(n)) != LUA_T_NIL &&
+    if (ttype(key(n)) == TAG_NUMBER && 
+        ttype(val(n)) != TAG_NIL &&
         nvalue(key(n)) > max)
       max = nvalue(key(n));
     n++;
@@ -74,14 +74,14 @@ static real getsize (const Hash *h) {
 }
 
 
-static real getnarg (lua_State *L, const Hash *a) {
+static Number getnarg (lua_State *L, const Hash *a) {
   TObject index;
   const TObject *value;
   /* value = table.n */
-  ttype(&index) = LUA_T_STRING;
+  ttype(&index) = TAG_STRING;
   tsvalue(&index) = luaS_new(L, "n");
   value = luaH_get(L, a, &index);
-  return (ttype(value) == LUA_T_NUMBER) ? nvalue(value) : getsize(a);
+  return (ttype(value) == TAG_NUMBER) ? nvalue(value) : getsize(a);
 }
 
 
@@ -167,7 +167,7 @@ void luaB_tonumber (lua_State *L) {
   else {
     const char *s1 = luaL_check_string(L, 1);
     char *s2;
-    real n;
+    Number n;
     luaL_arg_check(L, 0 <= base && base <= 36, 2, "base out of range");
     n = strtoul(s1, &s2, base);
     if (s1 == s2) return;  /* no valid digits: return nil */
@@ -244,7 +244,7 @@ void luaB_settagmethod (lua_State *L) {
   luaL_arg_check(L, lua_isnil(L, nf) || lua_isfunction(L, nf), 3,
                  "function or nil expected");
 #ifndef LUA_COMPAT_GC
-  if (strcmp(event, "gc") == 0 && tag != LUA_T_NIL)
+  if (strcmp(event, "gc") == 0 && tag != TAG_NIL)
     lua_error(L, "cannot set this `gc' tag method from Lua");
 #endif
   lua_pushobject(L, nf);
@@ -349,11 +349,11 @@ void luaB_call (lua_State *L) {
 
 void luaB_nextvar (lua_State *L) {
   lua_Object o = luaL_nonnullarg(L, 1);
-  TaggedString *name;
-  if (ttype(o) == LUA_T_NIL)
+  TString *name;
+  if (ttype(o) == TAG_NIL)
     name = NULL;
   else {
-    luaL_arg_check(L, ttype(o) == LUA_T_STRING, 1, "variable name expected");
+    luaL_arg_check(L, ttype(o) == TAG_STRING, 1, "variable name expected");
     name = tsvalue(o);
   }
   if (!luaA_nextvar(L, name))
@@ -365,7 +365,7 @@ void luaB_next (lua_State *L) {
   const Hash *a = gettable(L, 1);
   lua_Object k = luaL_nonnullarg(L, 2);
   int i;  /* `luaA_next' gets first element after `i' */
-  if (ttype(k) == LUA_T_NIL)
+  if (ttype(k) == TAG_NIL)
     i = 0;  /* get first */
   else {
     i = luaH_pos(L, a, k)+1;
@@ -380,29 +380,29 @@ void luaB_tostring (lua_State *L) {
   lua_Object o = lua_getparam(L, 1);
   char buff[64];
   switch (ttype(o)) {
-    case LUA_T_NUMBER:
+    case TAG_NUMBER:
       lua_pushstring(L, lua_getstring(L, o));
       return;
-    case LUA_T_STRING:
+    case TAG_STRING:
       lua_pushobject(L, o);
       return;
-    case LUA_T_ARRAY:
+    case TAG_ARRAY:
       sprintf(buff, "table: %p", o->value.a);
       break;
-    case LUA_T_LCLOSURE:  case LUA_T_CCLOSURE:
+    case TAG_LCLOSURE:  case TAG_CCLOSURE:
       sprintf(buff, "function: %p", o->value.cl);
       break;
-    case LUA_T_LPROTO:
+    case TAG_LPROTO:
       sprintf(buff, "function: %p", o->value.tf);
       break;
-    case LUA_T_CPROTO:
+    case TAG_CPROTO:
       sprintf(buff, "function: %p", o->value.f);
       break;
-    case LUA_T_USERDATA:
+    case TAG_USERDATA:
       sprintf(buff, "userdata: %p(%d)", o->value.ts->u.d.value,
                                         o->value.ts->u.d.tag);
       break;
-    case LUA_T_NIL:
+    case TAG_NIL:
       lua_pushstring(L, "nil");
       return;
     default:
@@ -440,10 +440,10 @@ void luaB_foreachi (lua_State *L) {
   luaD_checkstack(L, 3);  /* for f, key, and val */
   for (i=1; i<=n; i++) {
     *(L->top++) = *f;
-    ttype(L->top) = LUA_T_NUMBER; nvalue(L->top++) = i;
+    ttype(L->top) = TAG_NUMBER; nvalue(L->top++) = i;
     *(L->top++) = *luaH_getint(L, t, i);
     luaD_call(L, L->top-3, 1);
-    if (ttype(L->top-1) != LUA_T_NIL)
+    if (ttype(L->top-1) != TAG_NIL)
       return;
     L->top--;  /* remove nil result */
   }
@@ -457,12 +457,12 @@ void luaB_foreach (lua_State *L) {
   luaD_checkstack(L, 3);  /* for f, key, and val */
   for (i=0; i<a->size; i++) {
     const Node *nd = &(a->node[i]);
-    if (ttype(val(nd)) != LUA_T_NIL) {
+    if (ttype(val(nd)) != TAG_NIL) {
       *(L->top++) = *f;
       *(L->top++) = *key(nd);
       *(L->top++) = *val(nd);
       luaD_call(L, L->top-3, 1);
-      if (ttype(L->top-1) != LUA_T_NIL)
+      if (ttype(L->top-1) != TAG_NIL)
         return;
       L->top--;  /* remove result */
     }
@@ -475,13 +475,13 @@ void luaB_foreachvar (lua_State *L) {
   GlobalVar *gv;
   luaD_checkstack(L, 4);  /* for extra var name, f, var name, and globalval */
   for (gv = L->rootglobal; gv; gv = gv->next) {
-    if (gv->value.ttype != LUA_T_NIL) {
+    if (gv->value.ttype != TAG_NIL) {
       pushtagstring(L, gv->name);  /* keep (extra) name on stack to avoid GC */
       *(L->top++) = *f;
       pushtagstring(L, gv->name);
       *(L->top++) = gv->value;
       luaD_call(L, L->top-3, 1);
-      if (ttype(L->top-1) != LUA_T_NIL) {
+      if (ttype(L->top-1) != TAG_NIL) {
         *(L->top-2) = *(L->top-1);  /* remove extra name */
         L->top--;
         return;
@@ -551,7 +551,7 @@ static int sort_comp (lua_State *L, lua_Object f, const TObject *a,
     L->top += 3;
     luaD_call(L, L->top-3, 1);
     L->top--;
-    return (ttype(L->top) != LUA_T_NIL);
+    return (ttype(L->top) != TAG_NIL);
   }
   else  /* a < b? */
     return luaV_lessthan(L, a, b, L->top);
@@ -559,7 +559,7 @@ static int sort_comp (lua_State *L, lua_Object f, const TObject *a,
 
 static void auxsort (lua_State *L, Hash *a, int l, int u, lua_Object f) {
   StkId P = L->top++;  /* temporary place for pivot */
-  ttype(P) = LUA_T_NIL;
+  ttype(P) = TAG_NIL;
   while (l < u) {  /* for tail recursion */
     int i, j;
     /* sort elements a[l], a[(l+u)/2] and a[u] */
diff --git a/lcode.c b/lcode.c
index 1a5c23f7..de78c52f 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.c,v 1.8 2000/03/09 13:57:37 roberto Exp roberto $
+** $Id: lcode.c,v 1.9 2000/03/10 14:38:10 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -32,8 +32,8 @@ static Instruction *previous_instruction (LexState *ls) {
   if (fs->pc > fs->lasttarget)  /* no jumps to current position? */
     return &fs->f->code[fs->pc-1];  /* returns previous instruction */
   else {
-    static Instruction dummy = CREATE_0(ENDCODE);
-    return &dummy;  /* no optimizations after an `ENDCODE' */
+    static Instruction dummy = CREATE_0(OP_END);
+    return &dummy;  /* no optimizations after an `END' */
   }
 }
 
@@ -49,10 +49,10 @@ int luaK_primitivecode (LexState *ls, Instruction i) {
 static void luaK_minus (LexState *ls) {
   Instruction *previous = previous_instruction(ls);
   switch(GET_OPCODE(*previous)) {
-    case PUSHINT: SETARG_S(*previous, -GETARG_S(*previous)); return;
-    case PUSHNUM: SET_OPCODE(*previous, PUSHNEGNUM); return;
-    case PUSHNEGNUM: SET_OPCODE(*previous, PUSHNUM); return;
-    default: luaK_primitivecode(ls, CREATE_0(MINUSOP));
+    case OP_PUSHINT: SETARG_S(*previous, -GETARG_S(*previous)); return;
+    case OP_PUSHNUM: SET_OPCODE(*previous, OP_PUSHNEGNUM); return;
+    case OP_PUSHNEGNUM: SET_OPCODE(*previous, OP_PUSHNUM); return;
+    default: luaK_primitivecode(ls, CREATE_0(OP_MINUS));
   }
 }
 
@@ -61,8 +61,8 @@ static void luaK_gettable (LexState *ls) {
   Instruction *previous = previous_instruction(ls);
   luaK_deltastack(ls, -1);
   switch(GET_OPCODE(*previous)) {
-    case PUSHSTRING: SET_OPCODE(*previous, GETDOTTED); break;
-    default: luaK_primitivecode(ls, CREATE_0(GETTABLE));
+    case OP_PUSHSTRING: SET_OPCODE(*previous, OP_GETDOTTED); break;
+    default: luaK_primitivecode(ls, CREATE_0(OP_GETTABLE));
   }
 }
 
@@ -71,8 +71,8 @@ static void luaK_add (LexState *ls) {
   Instruction *previous = previous_instruction(ls);
   luaK_deltastack(ls, -1);
   switch(GET_OPCODE(*previous)) {
-    case PUSHINT: SET_OPCODE(*previous, ADDI); break;
-    default: luaK_primitivecode(ls, CREATE_0(ADDOP));
+    case OP_PUSHINT: SET_OPCODE(*previous, OP_ADDI); break;
+    default: luaK_primitivecode(ls, CREATE_0(OP_ADD));
   }
 }
 
@@ -81,11 +81,11 @@ static void luaK_sub (LexState *ls) {
   Instruction *previous = previous_instruction(ls);
   luaK_deltastack(ls, -1);
   switch(GET_OPCODE(*previous)) {
-    case PUSHINT:
-      SET_OPCODE(*previous, ADDI);
+    case OP_PUSHINT:
+      SET_OPCODE(*previous, OP_ADDI);
       SETARG_S(*previous, -GETARG_S(*previous));
       break;
-    default: luaK_primitivecode(ls, CREATE_0(SUBOP));
+    default: luaK_primitivecode(ls, CREATE_0(OP_SUB));
   }
 }
 
@@ -94,43 +94,43 @@ static void luaK_conc (LexState *ls) {
   Instruction *previous = previous_instruction(ls);
   luaK_deltastack(ls, -1);
   switch(GET_OPCODE(*previous)) {
-    case CONCOP: SETARG_U(*previous, GETARG_U(*previous)+1); break;
-    default: luaK_primitivecode(ls, CREATE_U(CONCOP, 2));
+    case OP_CONC: SETARG_U(*previous, GETARG_U(*previous)+1); break;
+    default: luaK_primitivecode(ls, CREATE_U(OP_CONC, 2));
   }
 }
 
 
 static void luaK_eq (LexState *ls) {
   Instruction *previous = previous_instruction(ls);
-  if (*previous == CREATE_U(PUSHNIL, 1)) {
-    *previous = CREATE_0(NOTOP);
+  if (*previous == CREATE_U(OP_PUSHNIL, 1)) {
+    *previous = CREATE_0(OP_NOT);
     luaK_deltastack(ls, -1);  /* undo effect of PUSHNIL */
   }
   else
-    luaK_S(ls, IFEQJMP, 0, -2);
+    luaK_S(ls, OP_IFEQJMP, 0, -2);
 }
 
 
 static void luaK_neq (LexState *ls) {
   Instruction *previous = previous_instruction(ls);
-  if (*previous == CREATE_U(PUSHNIL, 1)) {
+  if (*previous == CREATE_U(OP_PUSHNIL, 1)) {
     ls->fs->pc--;  /* remove PUSHNIL */
     luaK_deltastack(ls, -1);  /* undo effect of PUSHNIL */
   }
   else
-    luaK_S(ls, IFNEQJMP, 0, -2);
+    luaK_S(ls, OP_IFNEQJMP, 0, -2);
 }
 
 
 void luaK_retcode (LexState *ls, int nlocals, int nexps) {
   Instruction *previous = previous_instruction(ls);
-  if (nexps > 0 && GET_OPCODE(*previous) == CALL) {
+  if (nexps > 0 && GET_OPCODE(*previous) == OP_CALL) {
     LUA_ASSERT(ls->L, GETARG_B(*previous) == MULT_RET, "call should be open");
-    SET_OPCODE(*previous, TAILCALL);
+    SET_OPCODE(*previous, OP_TAILCALL);
     SETARG_B(*previous, nlocals);
   }
   else
-    luaK_primitivecode(ls, CREATE_U(RETCODE, nlocals));
+    luaK_primitivecode(ls, CREATE_U(OP_RETURN, nlocals));
 }
 
 
@@ -138,8 +138,8 @@ static void luaK_pushnil (LexState *ls, int n) {
   Instruction *previous = previous_instruction(ls);
   luaK_deltastack(ls, n);
   switch(GET_OPCODE(*previous)) {
-    case PUSHNIL: SETARG_U(*previous, GETARG_U(*previous)+n); break;
-    default: luaK_primitivecode(ls, CREATE_U(PUSHNIL, n));
+    case OP_PUSHNIL: SETARG_U(*previous, GETARG_U(*previous)+n); break;
+    default: luaK_primitivecode(ls, CREATE_U(OP_PUSHNIL, n));
   }
 }
 
@@ -181,7 +181,7 @@ void luaK_deltastack (LexState *ls, int delta) {
 
 
 void luaK_kstr (LexState *ls, int c) {
-  luaK_U(ls, PUSHSTRING, c, 1);
+  luaK_U(ls, OP_PUSHSTRING, c, 1);
 }
 
 
@@ -189,32 +189,32 @@ void luaK_kstr (LexState *ls, int c) {
 #define LOOKBACKNUMS	20	/* arbitrary limit */
 #endif
 
-static int real_constant (LexState *ls, real r) {
+static int real_constant (LexState *ls, Number r) {
   /* check whether `r' has appeared within the last LOOKBACKNUMS entries */
-  TProtoFunc *f = ls->fs->f;
+  Proto *f = ls->fs->f;
   int c = f->nknum;
   int lim = c < LOOKBACKNUMS ? 0 : c-LOOKBACKNUMS;
   while (--c >= lim)
     if (f->knum[c] == r) return c;
   /* not found; create a new entry */
-  luaM_growvector(ls->L, f->knum, f->nknum, 1, real, constantEM, MAXARG_U);
+  luaM_growvector(ls->L, f->knum, f->nknum, 1, Number, constantEM, MAXARG_U);
   c = f->nknum++;
   f->knum[c] = r;
   return c;
 }
 
 
-void luaK_number (LexState *ls, real f) {
-  if (f <= (real)MAXARG_S && (int)f == f)
-    luaK_S(ls, PUSHINT, (int)f, 1);  /* f has a short integer value */
+void luaK_number (LexState *ls, Number f) {
+  if (f <= (Number)MAXARG_S && (int)f == f)
+    luaK_S(ls, OP_PUSHINT, (int)f, 1);  /* f has a short integer value */
   else
-    luaK_U(ls, PUSHNUM, real_constant(ls, f), 1);
+    luaK_U(ls, OP_PUSHNUM, real_constant(ls, f), 1);
 }
 
 
 void luaK_adjuststack (LexState *ls, int n) {
   if (n > 0)
-    luaK_U(ls, POP, n, -n);
+    luaK_U(ls, OP_POP, n, -n);
   else if (n < 0)
     luaK_pushnil(ls, -n);
 }
@@ -223,7 +223,7 @@ void luaK_adjuststack (LexState *ls, int n) {
 int luaK_lastisopen (LexState *ls) {
   /* check whether last instruction is an (open) function call */
   Instruction *i = previous_instruction(ls);
-  if (GET_OPCODE(*i) == CALL) {
+  if (GET_OPCODE(*i) == OP_CALL) {
     LUA_ASSERT(ls->L, GETARG_B(*i) == MULT_RET, "call should be open");
     return 1;
   }
@@ -233,7 +233,7 @@ int luaK_lastisopen (LexState *ls) {
 
 void luaK_setcallreturns (LexState *ls, int nresults) {
   Instruction *i = previous_instruction(ls);
-  if (GET_OPCODE(*i) == CALL) {  /* expression is a function call? */
+  if (GET_OPCODE(*i) == OP_CALL) {  /* expression is a function call? */
     LUA_ASSERT(ls->L, GETARG_B(*i) == MULT_RET, "call should be open");
     SETARG_B(*i, nresults);  /* set nresults */
     luaK_deltastack(ls, nresults);  /* push results */
@@ -249,10 +249,10 @@ static void assertglobal (LexState *ls, int index) {
 static int discharge (LexState *ls, expdesc *var) {
   switch (var->k) {
     case VLOCAL:
-      luaK_U(ls, PUSHLOCAL, var->u.index, 1);
+      luaK_U(ls, OP_PUSHLOCAL, var->u.index, 1);
       break;
     case VGLOBAL:
-      luaK_U(ls, GETGLOBAL, var->u.index, 1);
+      luaK_U(ls, OP_GETGLOBAL, var->u.index, 1);
       assertglobal(ls, var->u.index);  /* make sure that there is a global */
       break;
     case VINDEXED:
@@ -278,14 +278,14 @@ static void discharge1 (LexState *ls, expdesc *var) {
 void luaK_storevar (LexState *ls, const expdesc *var) {
   switch (var->k) {
     case VLOCAL:
-      luaK_U(ls, SETLOCAL, var->u.index, -1);
+      luaK_U(ls, OP_SETLOCAL, var->u.index, -1);
       break;
     case VGLOBAL:
-      luaK_U(ls, SETGLOBAL, var->u.index, -1);
+      luaK_U(ls, OP_SETGLOBAL, var->u.index, -1);
       assertglobal(ls, var->u.index);  /* make sure that there is a global */
       break;
     case VINDEXED:
-      luaK_0(ls, SETTABLEPOP, -3);
+      luaK_0(ls, OP_SETTABLEPOP, -3);
       break;
     default:
       LUA_INTERNALERROR(ls->L, "invalid var kind to store");
@@ -295,17 +295,17 @@ void luaK_storevar (LexState *ls, const expdesc *var) {
 
 static OpCode invertjump (OpCode op) {
   switch (op) {
-    case IFNEQJMP: return IFEQJMP;
-    case IFEQJMP: return IFNEQJMP;
-    case IFLTJMP: return IFGEJMP;
-    case IFLEJMP: return IFGTJMP;
-    case IFGTJMP: return IFLEJMP;
-    case IFGEJMP: return IFLTJMP;
-    case IFTJMP: case ONTJMP:  return IFFJMP;
-    case IFFJMP: case ONFJMP:  return IFTJMP;
+    case OP_IFNEQJMP: return OP_IFEQJMP;
+    case OP_IFEQJMP: return OP_IFNEQJMP;
+    case OP_IFLTJMP: return OP_IFGEJMP;
+    case OP_IFLEJMP: return OP_IFGTJMP;
+    case OP_IFGTJMP: return OP_IFLEJMP;
+    case OP_IFGEJMP: return OP_IFLTJMP;
+    case OP_IFTJMP: case OP_ONTJMP:  return OP_IFFJMP;
+    case OP_IFFJMP: case OP_ONFJMP:  return OP_IFTJMP;
     default:
       LUA_INTERNALERROR(NULL, "invalid jump instruction");
-      return ENDCODE;  /* to avoid warnings */
+      return OP_END;  /* to avoid warnings */
   }
 }
 
@@ -313,7 +313,7 @@ static OpCode invertjump (OpCode op) {
 static void luaK_jump (LexState *ls, OpCode jump) {
   Instruction *previous = previous_instruction(ls);
   luaK_deltastack(ls, -1);
-  if (*previous == CREATE_0(NOTOP))
+  if (*previous == CREATE_0(OP_NOT))
     *previous = CREATE_S(invertjump(jump), 0);
   else
     luaK_primitivecode(ls, CREATE_S(jump, 0));
@@ -342,10 +342,10 @@ static void luaK_patchlistaux (LexState *ls, int list, int target,
         SETARG_S(*i, special_target-(list+1));
       else {
         SETARG_S(*i, target-(list+1));  /* do the patch */
-        if (op == ONTJMP)  /* remove eventual values */
-          SET_OPCODE(*i, IFTJMP);
-        else if (op == ONFJMP)
-          SET_OPCODE(*i, IFFJMP);
+        if (op == OP_ONTJMP)  /* remove eventual values */
+          SET_OPCODE(*i, OP_IFTJMP);
+        else if (op == OP_ONFJMP)
+          SET_OPCODE(*i, OP_IFFJMP);
       }
       if (next == 0) return;
       list += next+1;
@@ -355,7 +355,7 @@ static void luaK_patchlistaux (LexState *ls, int list, int target,
 
 
 void luaK_patchlist (LexState *ls, int list, int target) {
-  luaK_patchlistaux(ls, list, target, ENDCODE, 0);
+  luaK_patchlistaux(ls, list, target, OP_END, 0);
 }
 
 
@@ -399,7 +399,7 @@ void luaK_goiftrue (LexState *ls, expdesc *v, int keepvalue) {
   if (ISJUMP(GET_OPCODE(*previous)))
     SET_OPCODE(*previous, invertjump(GET_OPCODE(*previous)));
   else {
-    OpCode jump = keepvalue ? ONFJMP : IFFJMP;
+    OpCode jump = keepvalue ? OP_ONFJMP : OP_IFFJMP;
     luaK_jump(ls, jump);
   }
   insert_last(fs, &v->u.l.f);
@@ -414,7 +414,7 @@ void luaK_goiffalse (LexState *ls, expdesc *v, int keepvalue) {
   discharge1(ls, v);
   previous = fs->f->code[fs->pc-1];
   if (!ISJUMP(GET_OPCODE(previous))) {
-    OpCode jump = keepvalue ? ONTJMP : IFTJMP;
+    OpCode jump = keepvalue ? OP_ONTJMP : OP_IFTJMP;
     luaK_jump(ls, jump);
   }
   insert_last(fs, &v->u.l.t);
@@ -440,28 +440,28 @@ void luaK_tostack (LexState *ls, expdesc *v, int onlyone) {
       int final;  /* position after whole expression */
       if (ISJUMP(previous)) {
         insert_last(fs, &v->u.l.t);  /* put `previous' in true list */
-        p_nil = luaK_0(ls, PUSHNILJMP, 0);
-        p_1 = luaK_S(ls, PUSHINT, 1, 1);
+        p_nil = luaK_0(ls, OP_PUSHNILJMP, 0);
+        p_1 = luaK_S(ls, OP_PUSHINT, 1, 1);
       }
       else {  /* still may need a PUSHNIL or a PUSHINT */
-        int need_nil = need_value(fs, v->u.l.f, ONFJMP);
-        int need_1 = need_value(fs, v->u.l.t, ONTJMP);
+        int need_nil = need_value(fs, v->u.l.f, OP_ONFJMP);
+        int need_1 = need_value(fs, v->u.l.t, OP_ONTJMP);
         if (need_nil && need_1) {
-          luaK_S(ls, JMP, 2, 0);  /* skip both pushes */
-          p_nil = luaK_0(ls, PUSHNILJMP, 0);
-          p_1 = luaK_S(ls, PUSHINT, 1, 0);
+          luaK_S(ls, OP_JMP, 2, 0);  /* skip both pushes */
+          p_nil = luaK_0(ls, OP_PUSHNILJMP, 0);
+          p_1 = luaK_S(ls, OP_PUSHINT, 1, 0);
         }
         else if (need_nil || need_1) {
-          luaK_S(ls, JMP, 1, 0);  /* skip one push */
+          luaK_S(ls, OP_JMP, 1, 0);  /* skip one push */
           if (need_nil)
-            p_nil = luaK_U(ls, PUSHNIL, 1, 0);
+            p_nil = luaK_U(ls, OP_PUSHNIL, 1, 0);
           else  /* need_1 */
-            p_1 = luaK_S(ls, PUSHINT, 1, 0);
+            p_1 = luaK_S(ls, OP_PUSHINT, 1, 0);
         }
       }
       final = luaK_getlabel(ls);
-      luaK_patchlistaux(ls, v->u.l.f, p_nil, ONFJMP, final);
-      luaK_patchlistaux(ls, v->u.l.t, p_1, ONTJMP, final);
+      luaK_patchlistaux(ls, v->u.l.f, p_nil, OP_ONFJMP, final);
+      luaK_patchlistaux(ls, v->u.l.t, p_1, OP_ONTJMP, final);
       v->u.l.f = v->u.l.t = 0;
     }
   }
@@ -481,7 +481,7 @@ void luaK_prefix (LexState *ls, int op, expdesc *v) {
     if (ISJUMP(GET_OPCODE(*previous)))
       SET_OPCODE(*previous, invertjump(GET_OPCODE(*previous)));
     else
-      luaK_0(ls, NOTOP, 0);
+      luaK_0(ls, OP_NOT, 0);
     /* interchange true and false lists */
     { int temp = v->u.l.f; v->u.l.f = v->u.l.t; v->u.l.t = temp; }
   }
@@ -489,9 +489,9 @@ void luaK_prefix (LexState *ls, int op, expdesc *v) {
 
 
 void luaK_infix (LexState *ls, int op, expdesc *v) {
-  if (op == AND)
+  if (op == TK_AND)
     luaK_goiftrue(ls, v, 1);
-  else if (op == OR)
+  else if (op == TK_OR)
     luaK_goiffalse(ls, v, 1);
   else
     luaK_tostack(ls, v, 1);  /* all other binary operators need a value */
@@ -499,13 +499,13 @@ void luaK_infix (LexState *ls, int op, expdesc *v) {
 
 
 void luaK_posfix (LexState *ls, int op, expdesc *v1, expdesc *v2) {
-  if (op == AND) {
+  if (op == TK_AND) {
     LUA_ASSERT(ls->L, v1->u.l.t == 0, "list must be closed");
     discharge1(ls, v2);
     v1->u.l.t = v2->u.l.t;
     concatlists(ls, &v1->u.l.f, v2->u.l.f);
   }
-  else if (op == OR) {
+  else if (op == TK_OR) {
     LUA_ASSERT(ls->L, v1->u.l.f == 0, "list must be closed");
     discharge1(ls, v2);
     v1->u.l.f = v2->u.l.f;
@@ -516,16 +516,16 @@ void luaK_posfix (LexState *ls, int op, expdesc *v1, expdesc *v2) {
     switch (op) {
       case '+': luaK_add(ls); break;
       case '-': luaK_sub(ls); break;
-      case '*': luaK_0(ls, MULTOP, -1); break;
-      case '/': luaK_0(ls, DIVOP, -1); break;
-      case '^': luaK_0(ls, POWOP, -1); break;
-      case CONC: luaK_conc(ls); break;
-      case EQ: luaK_eq(ls); break;
-      case NE: luaK_neq(ls); break;
-      case '>': luaK_S(ls, IFGTJMP, 0, -2); break;
-      case '<': luaK_S(ls, IFLTJMP, 0, -2); break;
-      case GE: luaK_S(ls, IFGEJMP, 0, -2); break;
-      case LE: luaK_S(ls, IFLEJMP, 0, -2); break;
+      case '*': luaK_0(ls, OP_MULT, -1); break;
+      case '/': luaK_0(ls, OP_DIV, -1); break;
+      case '^': luaK_0(ls, OP_POW, -1); break;
+      case TK_CONC: luaK_conc(ls); break;
+      case TK_EQ: luaK_eq(ls); break;
+      case TK_NE: luaK_neq(ls); break;
+      case '>': luaK_S(ls, OP_IFGTJMP, 0, -2); break;
+      case '<': luaK_S(ls, OP_IFLTJMP, 0, -2); break;
+      case TK_GE: luaK_S(ls, OP_IFGEJMP, 0, -2); break;
+      case TK_LE: luaK_S(ls, OP_IFLEJMP, 0, -2); break;
     }
   }
 }
diff --git a/lcode.h b/lcode.h
index 91674ad3..994ff499 100644
--- a/lcode.h
+++ b/lcode.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.h,v 1.3 2000/03/03 18:53:17 roberto Exp roberto $
+** $Id: lcode.h,v 1.5 2000/03/09 13:57:37 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -30,7 +30,7 @@ void luaK_goiffalse (LexState *ls, expdesc *v, int keepvalue);
 int luaK_getlabel (LexState *ls);
 void luaK_deltastack (LexState *ls, int delta);
 void luaK_kstr (LexState *ls, int c);
-void luaK_number (LexState *ls, real f);
+void luaK_number (LexState *ls, Number f);
 void luaK_adjuststack (LexState *ls, int n);
 int luaK_lastisopen (LexState *ls);
 void luaK_setcallreturns (LexState *ls, int nresults);
diff --git a/ldebug.c b/ldebug.c
index 45214b8f..1353dfc7 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
 /*
-** $Id: ldebug.c,v 1.9 2000/02/17 18:30:36 roberto Exp roberto $
+** $Id: ldebug.c,v 1.10 2000/03/03 14:58:26 roberto Exp roberto $
 ** Debug Interface
 ** See Copyright Notice in lua.h
 */
@@ -23,11 +23,11 @@
 
 
 static const lua_Type normtype[] = {  /* ORDER LUA_T */
-  LUA_T_USERDATA, LUA_T_NUMBER, LUA_T_STRING, LUA_T_ARRAY,
-  LUA_T_LPROTO, LUA_T_CPROTO, LUA_T_NIL,
-  LUA_T_LCLOSURE, LUA_T_CCLOSURE,
-  LUA_T_LCLOSURE, LUA_T_CCLOSURE,   /* LUA_T_LCLMARK, LUA_T_CCLMARK */
-  LUA_T_LPROTO, LUA_T_CPROTO        /* LUA_T_LMARK, LUA_T_CMARK */
+  TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_ARRAY,
+  TAG_LPROTO, TAG_CPROTO, TAG_NIL,
+  TAG_LCLOSURE, TAG_CCLOSURE,
+  TAG_LCLOSURE, TAG_CCLOSURE,   /* TAG_LCLMARK, TAG_CCLMARK */
+  TAG_LPROTO, TAG_CPROTO        /* TAG_LMARK, TAG_CMARK */
 };
 
 
@@ -39,7 +39,7 @@ static void setnormalized (TObject *d, const TObject *s) {
 
 
 static int hasdebuginfo (lua_State *L, StkId f) {
-  return (f+1 < L->top && (f+1)->ttype == LUA_T_LINE);
+  return (f+1 < L->top && (f+1)->ttype == TAG_LINE);
 }
 
 
@@ -89,8 +89,8 @@ int lua_getstack (lua_State *L, int level, lua_Dbgactreg *ar) {
 
 static int lua_nups (StkId f) {
   switch (ttype(f)) {
-    case LUA_T_LCLOSURE:  case LUA_T_CCLOSURE:
-    case LUA_T_LCLMARK:   case LUA_T_CCLMARK:
+    case TAG_LCLOSURE:  case TAG_CCLOSURE:
+    case TAG_LCLMARK:   case TAG_CCLMARK:
       return f->value.cl->nelems;
     default:
       return 0;
@@ -103,10 +103,10 @@ static int lua_currentline (lua_State *L, StkId f) {
 }
 
 
-static TProtoFunc *getluaproto (StkId f) {
-  if (ttype(f) == LUA_T_LMARK)
+static Proto *getluaproto (StkId f) {
+  if (ttype(f) == TAG_LMARK)
     return f->value.tf;
-  else if (ttype(f) == LUA_T_LCLMARK)
+  else if (ttype(f) == TAG_LCLMARK)
     return protovalue(f)->value.tf;
   else return NULL;
 }
@@ -114,13 +114,13 @@ static TProtoFunc *getluaproto (StkId f) {
 
 int lua_getlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) {
   StkId f = ar->_func;
-  TProtoFunc *fp = getluaproto(f);
+  Proto *fp = getluaproto(f);
   if (!fp) return 0;  /* `f' is not a Lua function? */
   v->name = luaF_getlocalname(fp, v->index, lua_currentline(L, f));
   if (!v->name) return 0;
-  /* if `name', there must be a LUA_T_LINE */
+  /* if `name', there must be a TAG_LINE */
   /* therefore, f+2 points to function base */
-  LUA_ASSERT(L, ttype(f+1) == LUA_T_LINE, "");
+  LUA_ASSERT(L, ttype(f+1) == TAG_LINE, "");
   v->value = luaA_putluaObject(L, (f+2)+(v->index-1));
   return 1;
 }
@@ -128,11 +128,11 @@ int lua_getlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) {
 
 int lua_setlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) {
   StkId f = ar->_func;
-  TProtoFunc *fp = getluaproto(f);
+  Proto *fp = getluaproto(f);
   if (!fp) return 0;  /* `f' is not a Lua function? */
   v->name = luaF_getlocalname(fp, v->index, lua_currentline(L, f));
   if (!v->name) return 0;
-  LUA_ASSERT(L, ttype(f+1) == LUA_T_LINE, "");
+  LUA_ASSERT(L, ttype(f+1) == TAG_LINE, "");
   *((f+2)+(v->index-1)) = *v->value;
   return 1;
 }
@@ -141,12 +141,12 @@ int lua_setlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) {
 static void lua_funcinfo (lua_Dbgactreg *ar) {
   StkId func = ar->_func;
   switch (ttype(func)) {
-    case LUA_T_LPROTO:  case LUA_T_LMARK:
+    case TAG_LPROTO:  case TAG_LMARK:
       ar->source = tfvalue(func)->source->str;
       ar->linedefined = tfvalue(func)->lineDefined;
       ar->what = "Lua";
       break;
-    case LUA_T_LCLOSURE:  case LUA_T_LCLMARK:
+    case TAG_LCLOSURE:  case TAG_LCLMARK:
       ar->source = tfvalue(protovalue(func))->source->str;
       ar->linedefined = tfvalue(protovalue(func))->lineDefined;
       ar->what = "Lua";
diff --git a/ldo.c b/ldo.c
index be7a4266..cde94514 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
 /*
-** $Id: ldo.c,v 1.67 2000/02/08 16:34:31 roberto Exp roberto $
+** $Id: ldo.c,v 1.68 2000/03/03 14:58:26 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 */
@@ -86,7 +86,7 @@ void luaD_adjusttop (lua_State *L, StkId base, int extra) {
   else {
     luaD_checkstack(L, diff);
     while (diff--)
-      ttype(L->top++) = LUA_T_NIL;
+      ttype(L->top++) = TAG_NIL;
   }
 }
 
@@ -191,29 +191,29 @@ void luaD_call (lua_State *L, StkId func, int nResults) {
   lua_Dbghook callhook = L->callhook;
   retry:  /* for `function' tag method */
   switch (ttype(func)) {
-    case LUA_T_CPROTO:
-      ttype(func) = LUA_T_CMARK;
+    case TAG_CPROTO:
+      ttype(func) = TAG_CMARK;
       firstResult = callC(L, fvalue(func), func+1);
       break;
-    case LUA_T_LPROTO:
-      ttype(func) = LUA_T_LMARK;
+    case TAG_LPROTO:
+      ttype(func) = TAG_LMARK;
       firstResult = luaV_execute(L, NULL, tfvalue(func), func+1);
       break;
-    case LUA_T_LCLOSURE: {
+    case TAG_LCLOSURE: {
       Closure *c = clvalue(func);
-      ttype(func) = LUA_T_LCLMARK;
+      ttype(func) = TAG_LCLMARK;
       firstResult = luaV_execute(L, c, tfvalue(c->consts), func+1);
       break;
     }
-    case LUA_T_CCLOSURE: {
+    case TAG_CCLOSURE: {
       Closure *c = clvalue(func);
-      ttype(func) = LUA_T_CCLMARK;
+      ttype(func) = TAG_CCLMARK;
       firstResult = callCclosure(L, c, func+1);
       break;
     }
     default: { /* `func' is not a function; check the `function' tag method */
       const TObject *im = luaT_getimbyObj(L, func, IM_FUNCTION);
-      if (ttype(im) == LUA_T_NIL)
+      if (ttype(im) == TAG_NIL)
         luaG_callerror(L, func);
       luaD_openstack(L, func);
       *func = *im;  /* tag method is the new function to be called */
@@ -298,7 +298,7 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) {
   StkId base = L->Cstack.base;
   int numCblocks = L->numCblocks;
   int status;
-  TProtoFunc *volatile tf;
+  Proto *volatile tf;
   struct lua_longjmp *volatile oldErr = L->errorJmp;
   L->errorJmp = &myErrorJmp;
   L->top = base;   /* clear C2Lua */
@@ -316,7 +316,7 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) {
   L->errorJmp = oldErr;
   if (status) return 1;  /* error code */
   if (tf == NULL) return 2;  /* `natural' end */
-  L->top->ttype = LUA_T_LPROTO;  /* push new function on the stack */
+  L->top->ttype = TAG_LPROTO;  /* push new function on the stack */
   L->top->value.tf = tf;
   incr_top;
   return 0;
@@ -345,7 +345,7 @@ static int do_main (lua_State *L, ZIO *z, int bin) {
 
 void luaD_gcIM (lua_State *L, const TObject *o) {
   const TObject *im = luaT_getimbyObj(L, o, IM_GC);
-  if (ttype(im) != LUA_T_NIL) {
+  if (ttype(im) != TAG_NIL) {
     luaD_checkstack(L, 2);
     *(L->top++) = *im;
     *(L->top++) = *o;
diff --git a/lfunc.c b/lfunc.c
index fad91ace..18ca5ca2 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lfunc.c,v 1.18 2000/01/28 16:53:00 roberto Exp roberto $
+** $Id: lfunc.c,v 1.19 2000/03/03 14:58:26 roberto Exp roberto $
 ** Auxiliary functions to manipulate prototypes and closures
 ** See Copyright Notice in lua.h
 */
@@ -13,7 +13,7 @@
 #include "lmem.h"
 #include "lstate.h"
 
-#define gcsizeproto(L, p)	numblocks(L, 0, sizeof(TProtoFunc))
+#define gcsizeproto(L, p)	numblocks(L, 0, sizeof(Proto))
 #define gcsizeclosure(L, c)	numblocks(L, c->nelems, sizeof(Closure))
 
 
@@ -29,8 +29,8 @@ Closure *luaF_newclosure (lua_State *L, int nelems) {
 }
 
 
-TProtoFunc *luaF_newproto (lua_State *L) {
-  TProtoFunc *f = luaM_new(L, TProtoFunc);
+Proto *luaF_newproto (lua_State *L) {
+  Proto *f = luaM_new(L, Proto);
   f->code = NULL;
   f->lineDefined = 0;
   f->source = NULL;
@@ -49,7 +49,7 @@ TProtoFunc *luaF_newproto (lua_State *L) {
 }
 
 
-void luaF_freeproto (lua_State *L, TProtoFunc *f) {
+void luaF_freeproto (lua_State *L, Proto *f) {
   L->nblocks -= gcsizeproto(L, f);
   luaM_free(L, f->code);
   luaM_free(L, f->locvars);
@@ -70,7 +70,7 @@ void luaF_freeclosure (lua_State *L, Closure *c) {
 ** Look for n-th local variable at line `line' in function `func'.
 ** Returns NULL if not found.
 */
-const char *luaF_getlocalname (const TProtoFunc *func,
+const char *luaF_getlocalname (const Proto *func,
                                int local_number, int line) {
   int count = 0;
   const char *varname = NULL;
diff --git a/lfunc.h b/lfunc.h
index 9b862b14..a0dc7817 100644
--- a/lfunc.h
+++ b/lfunc.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lfunc.h,v 1.9 1999/11/22 13:12:07 roberto Exp roberto $
+** $Id: lfunc.h,v 1.10 1999/12/27 17:33:22 roberto Exp roberto $
 ** Auxiliary functions to manipulate prototypes and closures
 ** See Copyright Notice in lua.h
 */
@@ -12,12 +12,12 @@
 
 
 
-TProtoFunc *luaF_newproto (lua_State *L);
+Proto *luaF_newproto (lua_State *L);
 Closure *luaF_newclosure (lua_State *L, int nelems);
-void luaF_freeproto (lua_State *L, TProtoFunc *f);
+void luaF_freeproto (lua_State *L, Proto *f);
 void luaF_freeclosure (lua_State *L, Closure *c);
 
-const char *luaF_getlocalname (const TProtoFunc *func,
+const char *luaF_getlocalname (const Proto *func,
                                int local_number, int line);
 
 
diff --git a/lgc.c b/lgc.c
index 4fbe7230..87aa7d25 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lgc.c,v 1.40 2000/01/25 13:57:18 roberto Exp roberto $
+** $Id: lgc.c,v 1.41 2000/01/28 16:53:00 roberto Exp roberto $
 ** Garbage Collector
 ** See Copyright Notice in lua.h
 */
@@ -28,7 +28,7 @@ static int markobject (lua_State *L, TObject *o);
 
 
 
-static void protomark (lua_State *L, TProtoFunc *f) {
+static void protomark (lua_State *L, Proto *f) {
   if (!f->marked) {
     int i;
     f->marked = 1;
@@ -57,7 +57,7 @@ static void hashmark (lua_State *L, Hash *h) {
     h->marked = 1;
     for (i=h->size-1; i>=0; i--) {
       Node *n = node(h,i);
-      if (ttype(key(n)) != LUA_T_NIL) {
+      if (ttype(key(n)) != TAG_NIL) {
         markobject(L, &n->key);
         markobject(L, &n->val);
       }
@@ -70,7 +70,7 @@ static void travglobal (lua_State *L) {
   GlobalVar *gv;
   for (gv=L->rootglobal; gv; gv=gv->next) {
     LUA_ASSERT(L, gv->name->u.s.gv == gv, "inconsistent global name");
-    if (gv->value.ttype != LUA_T_NIL) {
+    if (gv->value.ttype != TAG_NIL) {
       strmark(L, gv->name);  /* cannot collect non nil global variables */
       markobject(L, &gv->value);
     }
@@ -96,17 +96,17 @@ static void travlock (lua_State *L) {
 
 static int markobject (lua_State *L, TObject *o) {
   switch (ttype(o)) {
-    case LUA_T_USERDATA:  case LUA_T_STRING:
+    case TAG_USERDATA:  case TAG_STRING:
       strmark(L, tsvalue(o));
       break;
-    case LUA_T_ARRAY:
+    case TAG_ARRAY:
       hashmark(L, avalue(o));
       break;
-    case LUA_T_LCLOSURE:  case LUA_T_LCLMARK:
-    case LUA_T_CCLOSURE:  case LUA_T_CCLMARK:
+    case TAG_LCLOSURE:  case TAG_LCLMARK:
+    case TAG_CCLOSURE:  case TAG_CCLMARK:
       closuremark(L, o->value.cl);
       break;
-    case LUA_T_LPROTO: case LUA_T_LMARK:
+    case TAG_LPROTO: case TAG_LMARK:
       protomark(L, o->value.tf);
       break;
     default: break;  /* numbers, cprotos, etc */
@@ -116,8 +116,8 @@ static int markobject (lua_State *L, TObject *o) {
 
 
 static void collectproto (lua_State *L) {
-  TProtoFunc **p = &L->rootproto;
-  TProtoFunc *next;
+  Proto **p = &L->rootproto;
+  Proto *next;
   while ((next = *p) != NULL) {
     if (next->marked) {
       next->marked = 0;
@@ -185,14 +185,14 @@ static void clear_global_list (lua_State *L, int limit) {
 static void collectstring (lua_State *L, int limit) {
   TObject o;  /* to call userdata `gc' tag method */
   int i;
-  ttype(&o) = LUA_T_USERDATA;
+  ttype(&o) = TAG_USERDATA;
   clear_global_list(L, limit);
   for (i=0; i<NUM_HASHS; i++) {  /* for each hash table */
     stringtable *tb = &L->string_root[i];
     int j;
     for (j=0; j<tb->size; j++) {  /* for each list */
-      TaggedString **p = &tb->hash[j];
-      TaggedString *next;
+      TString **p = &tb->hash[j];
+      TString *next;
       while ((next = *p) != NULL) {
        if (next->marked >= limit) {
          if (next->marked < FIXMARK)  /* does not change FIXMARKs */
@@ -220,7 +220,7 @@ static void collectstring (lua_State *L, int limit) {
 static void tableTM (lua_State *L) {
   Hash *p;
   TObject o;
-  ttype(&o) = LUA_T_ARRAY;
+  ttype(&o) = TAG_ARRAY;
   for (p = L->roottable; p; p = p->next) {
     if (!p->marked) {
       avalue(&o) = p;
diff --git a/llex.c b/llex.c
index 6745fbbc..a3d2cab3 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
 /*
-** $Id: llex.c,v 1.51 2000/02/08 16:34:31 roberto Exp roberto $
+** $Id: llex.c,v 1.52 2000/03/03 14:58:26 roberto Exp roberto $
 ** Lexical Analyzer
 ** See Copyright Notice in lua.h
 */
@@ -39,7 +39,7 @@ static const char *const token2string [] = {"and", "do", "else", "elseif", "end"
 void luaX_init (lua_State *L) {
   int i;
   for (i=0; i<NUM_RESERVED; i++) {
-    TaggedString *ts = luaS_new(L, token2string[i]);
+    TString *ts = luaS_new(L, token2string[i]);
     ts->marked = (unsigned char)(RESERVEDMARK+i);  /* reserved word */
   }
 }
@@ -160,7 +160,7 @@ static void ifskip (lua_State *L, LexState *LS) {
     if (LS->current == '\n')
       inclinenumber(L, LS);
     else if (LS->current == EOZ)
-      luaX_error(LS, "input ends inside a $if", EOS);
+      luaX_error(LS, "input ends inside a $if", TK_EOS);
     else next(LS);
   }
 }
@@ -240,7 +240,7 @@ static void read_long_string (lua_State *L, LexState *LS) {
   for (;;) {
     switch (LS->current) {
       case EOZ:
-        luaX_error(LS, "unfinished long string", STRING);
+        luaX_error(LS, "unfinished long string", TK_STRING);
         break;  /* to avoid warnings */
       case '[':
         save_and_next(L, LS);
@@ -276,7 +276,7 @@ static void read_string (lua_State *L, LexState *LS, int del) {
   while (LS->current != del) {
     switch (LS->current) {
       case EOZ:  case '\n':
-        luaX_error(LS, "unfinished string", STRING);
+        luaX_error(LS, "unfinished string", TK_STRING);
         break;  /* to avoid warnings */
       case '\\':
         next(LS);  /* do not save the '\' */
@@ -298,7 +298,7 @@ static void read_string (lua_State *L, LexState *LS, int del) {
               next(LS);
             } while (++i<3 && isdigit(LS->current));
             if (c != (unsigned char)c)
-              luaX_error(LS, "escape sequence too large", STRING);
+              luaX_error(LS, "escape sequence too large", TK_STRING);
             save(L, c);
             break;
           }
@@ -343,34 +343,34 @@ int luaX_lex (LexState *LS) {
         else {
           save_and_next(L, LS);  /* pass the second '[' */
           read_long_string(L, LS);
-          return STRING;
+          return TK_STRING;
         }
 
       case '=':
         next(LS);
         if (LS->current != '=') return '=';
-        else { next(LS); return EQ; }
+        else { next(LS); return TK_EQ; }
 
       case '<':
         next(LS);
         if (LS->current != '=') return '<';
-        else { next(LS); return LE; }
+        else { next(LS); return TK_LE; }
 
       case '>':
         next(LS);
         if (LS->current != '=') return '>';
-        else { next(LS); return GE; }
+        else { next(LS); return TK_GE; }
 
       case '~':
         next(LS);
         if (LS->current != '=') return '~';
-        else { next(LS); return NE; }
+        else { next(LS); return TK_NE; }
 
       case '"':
       case '\'':
         luaL_resetbuffer(L);
         read_string(L, LS, LS->current);
-        return STRING;
+        return TK_STRING;
 
       case '.':
         luaL_resetbuffer(L);
@@ -379,9 +379,9 @@ int luaX_lex (LexState *LS) {
           next(LS);
           if (LS->current == '.') {
             next(LS);
-            return DOTS;   /* ... */
+            return TK_DOTS;   /* ... */
           }
-          else return CONC;   /* .. */
+          else return TK_CONC;   /* .. */
         }
         else if (!isdigit(LS->current)) return '.';
         else goto fraction;  /* LS->current is a digit */
@@ -397,7 +397,7 @@ int luaX_lex (LexState *LS) {
           if (LS->current == '.') {
             save(L, '.');
             luaX_error(LS, "ambiguous syntax"
-                       " (decimal point x string concatenation)", NUMBER);
+                       " (decimal point x string concatenation)", TK_NUMBER);
           }
         }
       fraction:  /* LUA_NUMBER */
@@ -412,13 +412,13 @@ int luaX_lex (LexState *LS) {
         }
         save(L, '\0');
         if (!luaO_str2d(L->Mbuffer+L->Mbuffbase, &LS->seminfo.r))
-          luaX_error(LS, "malformed number", NUMBER);
-        return NUMBER;
+          luaX_error(LS, "malformed number", TK_NUMBER);
+        return TK_NUMBER;
 
       case EOZ:
         if (LS->iflevel > 0)
-          luaX_error(LS, "input ends inside a $if", EOS);
-        return EOS;
+          luaX_error(LS, "input ends inside a $if", TK_EOS);
+        return TK_EOS;
 
       case '_': goto tname;
 
@@ -431,7 +431,7 @@ int luaX_lex (LexState *LS) {
           return c;
         }
         tname: {  /* identifier or reserved word */
-          TaggedString *ts;
+          TString *ts;
           luaL_resetbuffer(L);
           do {
             save_and_next(L, LS);
@@ -441,7 +441,7 @@ int luaX_lex (LexState *LS) {
           if (ts->marked >= RESERVEDMARK)  /* reserved word? */
             return ts->marked-RESERVEDMARK+FIRST_RESERVED;
           LS->seminfo.ts = ts;
-          return NAME;
+          return TK_NAME;
         }
     }
   }
diff --git a/llex.h b/llex.h
index 93097010..26ab95dd 100644
--- a/llex.h
+++ b/llex.h
@@ -1,5 +1,5 @@
 /*
-** $Id: llex.h,v 1.18 2000/02/08 16:34:31 roberto Exp roberto $
+** $Id: llex.h,v 1.19 2000/03/03 14:58:26 roberto Exp roberto $
 ** Lexical Analyzer
 ** See Copyright Notice in lua.h
 */
@@ -23,15 +23,16 @@
 */
 enum RESERVED {
   /* terminal symbols denoted by reserved words */
-  AND = FIRST_RESERVED,
-  DO, ELSE, ELSEIF, END, FUNCTION, IF, LOCAL, NIL, NOT, OR,
-  REPEAT, RETURN, THEN, UNTIL, WHILE,
+  TK_AND = FIRST_RESERVED,
+  TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FUNCTION, TK_IF, TK_LOCAL,
+  TK_NIL, TK_NOT, TK_OR, TK_REPEAT, TK_RETURN, TK_THEN, TK_UNTIL, TK_WHILE,
   /* other terminal symbols */
-  NAME, CONC, DOTS, EQ, GE, LE, NE, NUMBER, STRING, EOS
+  TK_NAME, TK_CONC, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
+  TK_STRING, TK_EOS
 };
 
 /* number of reserved words */
-#define NUM_RESERVED	((int)(WHILE-FIRST_RESERVED+1))
+#define NUM_RESERVED	((int)(TK_WHILE-FIRST_RESERVED+1))
 
 
 #ifndef MAX_IFS
@@ -53,8 +54,8 @@ typedef struct LexState {
   struct FuncState *fs;  /* `FuncState' is private to the parser */
   struct lua_State *L;
   union {
-    real r;
-    TaggedString *ts;
+    Number r;
+    TString *ts;
   } seminfo;  /* semantics information */
   struct zio *z;  /* input stream */
   int linenumber;  /* input line counter */
diff --git a/lmathlib.c b/lmathlib.c
index ee53f52e..8ed5deae 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lmathlib.c,v 1.22 1999/12/14 18:31:20 roberto Exp roberto $
+** $Id: lmathlib.c,v 1.23 1999/12/27 17:33:22 roberto Exp roberto $
 ** Standard mathematical library
 ** See Copyright Notice in lua.h
 */
@@ -147,7 +147,7 @@ static void math_random (lua_State *L) {
      some systems (SunOS!) "rand()" may return a value larger than RAND_MAX */
   double r = (double)(rand()%RAND_MAX) / (double)RAND_MAX;
   if (lua_getparam(L, 1) == LUA_NOOBJECT)  /* no arguments? */
-    lua_pushnumber(L, r);  /* real between 0 and 1 */
+    lua_pushnumber(L, r);  /* Number between 0 and 1 */
   else {
     int l, u;  /* lower & upper limits */
     if (lua_getparam(L, 2) == LUA_NOOBJECT) {  /* only one argument? */
diff --git a/lmem.c b/lmem.c
index 24f56db1..00e45f6f 100644
--- a/lmem.c
+++ b/lmem.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lmem.c,v 1.26 2000/03/03 14:58:26 roberto Exp roberto $
+** $Id: lmem.c,v 1.27 2000/03/10 14:01:05 roberto Exp roberto $
 ** Interface to Memory Manager
 ** See Copyright Notice in lua.h
 */
@@ -16,7 +16,7 @@
 
 
 /*
-** real ANSI systems do not need these tests;
+** Number ANSI systems do not need these tests;
 ** but some systems (Sun OS) are not that ANSI...
 */
 #ifdef OLD_ANSI
diff --git a/lobject.c b/lobject.c
index 617815d8..1fdb7c80 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lobject.c,v 1.31 2000/02/17 18:30:36 roberto Exp roberto $
+** $Id: lobject.c,v 1.32 2000/03/03 14:58:26 roberto Exp roberto $
 ** Some generic functions over Lua objects
 ** See Copyright Notice in lua.h
 */
@@ -20,7 +20,7 @@ const char *const luaO_typenames[] = { /* ORDER LUA_T */
 };
 
 
-const TObject luaO_nilobject = {LUA_T_NIL, {NULL}};
+const TObject luaO_nilobject = {TAG_NIL, {NULL}};
 
 
 /*
@@ -35,19 +35,19 @@ unsigned long luaO_power2 (unsigned long n) {
 
 int luaO_equalval (const TObject *t1, const TObject *t2) {
   switch (ttype(t1)) {
-    case LUA_T_NIL:
+    case TAG_NIL:
       return 1;
-    case LUA_T_NUMBER:
+    case TAG_NUMBER:
       return nvalue(t1) == nvalue(t2);
-    case LUA_T_STRING: case LUA_T_USERDATA:
+    case TAG_STRING: case TAG_USERDATA:
       return svalue(t1) == svalue(t2);
-    case LUA_T_ARRAY: 
+    case TAG_ARRAY: 
       return avalue(t1) == avalue(t2);
-    case LUA_T_LPROTO:
+    case TAG_LPROTO:
       return tfvalue(t1)  == tfvalue(t2);
-    case LUA_T_CPROTO:
+    case TAG_CPROTO:
       return fvalue(t1)  == fvalue(t2);
-    case LUA_T_CCLOSURE: case LUA_T_LCLOSURE:
+    case TAG_CCLOSURE: case TAG_LCLOSURE:
       return t1->value.cl == t2->value.cl;
     default:
      LUA_INTERNALERROR(L, "invalid type");
@@ -67,7 +67,7 @@ static double expten (unsigned int e) {
 }
 
 
-int luaO_str2d (const char *s, real *result) {  /* LUA_NUMBER */
+int luaO_str2d (const char *s, Number *result) {  /* LUA_NUMBER */
   double a = 0.0;
   int point = 0;  /* number of decimal digits */
   int sig;
diff --git a/lobject.h b/lobject.h
index 20368bdf..685124f9 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lobject.h,v 1.49 2000/02/21 18:33:26 roberto Exp roberto $
+** $Id: lobject.h,v 1.50 2000/03/03 14:58:26 roberto Exp roberto $
 ** Type definitions for Lua objects
 ** See Copyright Notice in lua.h
 */
@@ -27,14 +27,14 @@
 #define UNUSED(x)	(void)x		/* to avoid warnings */
 
 /*
-** "real" is the type "number" of Lua
+** Define the type `number' of Lua
 ** GREP LUA_NUMBER to change that
 */
 #ifndef LUA_NUM_TYPE
 #define LUA_NUM_TYPE double
 #endif
 
-typedef LUA_NUM_TYPE real;
+typedef LUA_NUM_TYPE Number;
 
 
 /*
@@ -66,45 +66,45 @@ typedef unsigned long Instruction;
 ** grep "ORDER LUA_T"
 */
 typedef enum {
-  LUA_T_USERDATA  =  0, /* default tag for userdata */
-  LUA_T_NUMBER    = -1, /* fixed tag for numbers */
-  LUA_T_STRING    = -2, /* fixed tag for strings */
-  LUA_T_ARRAY     = -3, /* default tag for tables (or arrays) */
-  LUA_T_LPROTO    = -4, /* fixed tag for Lua functions */
-  LUA_T_CPROTO    = -5, /* fixed tag for C functions */
-  LUA_T_NIL       = -6, /* last "pre-defined" tag */
-
-  LUA_T_LCLOSURE  = -7, /* Lua closure */
-  LUA_T_CCLOSURE  = -8, /* C closure */
-
-  LUA_T_LCLMARK   = -9 ,/* mark for Lua closures */
-  LUA_T_CCLMARK   = -10,/* mark for C closures */
-  LUA_T_LMARK     = -11,/* mark for Lua prototypes */
-  LUA_T_CMARK     = -12,/* mark for C prototypes */
-
-  LUA_T_LINE     = -13
+  TAG_USERDATA  =  0, /* default tag for userdata */
+  TAG_NUMBER    = -1, /* fixed tag for numbers */
+  TAG_STRING    = -2, /* fixed tag for strings */
+  TAG_ARRAY     = -3, /* default tag for tables (or arrays) */
+  TAG_LPROTO    = -4, /* fixed tag for Lua functions */
+  TAG_CPROTO    = -5, /* fixed tag for C functions */
+  TAG_NIL       = -6, /* last "pre-defined" tag */
+
+  TAG_LCLOSURE  = -7, /* Lua closure */
+  TAG_CCLOSURE  = -8, /* C closure */
+
+  TAG_LCLMARK   = -9 ,/* mark for Lua closures */
+  TAG_CCLMARK   = -10,/* mark for C closures */
+  TAG_LMARK     = -11,/* mark for Lua prototypes */
+  TAG_CMARK     = -12,/* mark for C prototypes */
+
+  TAG_LINE     = -13
 } lua_Type;
 
 #define NUM_TAGS	7	/* tags for values visible from Lua */
 
 
-#define LAST_REGULAR_TAG  LUA_T_CCLOSURE  /* after that, are all marks */
+#define LAST_REGULAR_TAG  TAG_CCLOSURE  /* after that, are all marks */
 
 /*
 ** check whether `t' is a mark; ttypes are negative numbers, so the
 ** comparisons look reversed.  (ORDER LUA_T)
 */
-#define is_T_MARK(t)	(LUA_T_CMARK <= (t) && (t) <= LUA_T_LCLMARK)
+#define is_T_MARK(t)	(TAG_CMARK <= (t) && (t) <= TAG_LCLMARK)
 
 
 typedef union {
-  lua_CFunction f;              /* LUA_T_CPROTO, LUA_T_CMARK */
-  real n;                       /* LUA_T_NUMBER */
-  struct TaggedString *ts;      /* LUA_T_STRING, LUA_T_USERDATA */
-  struct TProtoFunc *tf;        /* LUA_T_LPROTO, LUA_T_LMARK */
-  struct Closure *cl;           /* LUA_T_[CL]CLOSURE, LUA_T_[CL]CLMARK */
-  struct Hash *a;               /* LUA_T_ARRAY */
-  int i;                        /* LUA_T_LINE */
+  lua_CFunction f;              /* TAG_CPROTO, TAG_CMARK */
+  Number n;                       /* TAG_NUMBER */
+  struct TString *ts;      /* TAG_STRING, TAG_USERDATA */
+  struct Proto *tf;        /* TAG_LPROTO, TAG_LMARK */
+  struct Closure *cl;           /* TAG_[CL]CLOSURE, TAG_[CL]CLMARK */
+  struct Hash *a;               /* TAG_ARRAY */
+  int i;                        /* TAG_LINE */
 } Value;
 
 
@@ -118,14 +118,14 @@ typedef struct TObject {
 typedef struct GlobalVar {
   TObject value;
   struct GlobalVar *next;
-  struct TaggedString *name;
+  struct TString *name;
 } GlobalVar;
 
 
 /*
 ** String headers for string table
 */
-typedef struct TaggedString {
+typedef struct TString {
   union {
     struct {  /* for strings */
       GlobalVar *gv;  /* eventual global value with this name */
@@ -136,12 +136,12 @@ typedef struct TaggedString {
       void *value;
     } d;
   } u;
-  struct TaggedString *nexthash;  /* chain for hash table */
+  struct TString *nexthash;  /* chain for hash table */
   unsigned long hash;
   int constindex;  /* hint to reuse constants (= -1 if this is a userdata) */
   unsigned char marked;
   char str[1];   /* \0 byte already reserved */
-} TaggedString;
+} TString;
 
 
 
@@ -149,27 +149,27 @@ typedef struct TaggedString {
 /*
 ** Function Prototypes
 */
-typedef struct TProtoFunc {
-  struct TProtoFunc *next;
+typedef struct Proto {
+  struct Proto *next;
   int marked;
-  struct TaggedString **kstr;  /* strings used by the function */
+  struct TString **kstr;  /* strings used by the function */
   int nkstr;  /* size of `kstr' */
-  real *knum;  /* real numbers used by the function */
+  Number *knum;  /* Number numbers used by the function */
   int nknum;  /* size of `knum' */
-  struct TProtoFunc **kproto;  /* functions defined inside the function */
+  struct Proto **kproto;  /* functions defined inside the function */
   int nkproto;  /* size of `kproto' */
   Instruction *code;  /* ends with opcode ENDCODE */
   int lineDefined;
-  TaggedString  *source;
+  TString  *source;
   int numparams;
   int is_vararg;
   int maxstacksize;
   struct LocVar *locvars;  /* ends with line = -1 */
-} TProtoFunc;
+} Proto;
 
 
 typedef struct LocVar {
-  TaggedString *varname;           /* NULL signals end of scope */
+  TString *varname;           /* NULL signals end of scope */
   int line;
 } LocVar;
 
@@ -202,10 +202,10 @@ typedef struct Closure {
 
 
 
-typedef struct node {
+typedef struct Node {
   TObject key;
   TObject val;
-  struct node *next;  /* for chaining */
+  struct Node *next;  /* for chaining */
 } Node;
 
 typedef struct Hash {
@@ -230,7 +230,7 @@ unsigned long luaO_power2 (unsigned long n);
 #define luaO_equalObj(t1,t2)  (ttype(t1) == ttype(t2) && luaO_equalval(t1,t2))
 int luaO_equalval (const TObject *t1, const TObject *t2);
 int luaO_redimension (lua_State *L, int oldsize);
-int luaO_str2d (const char *s, real *result);
+int luaO_str2d (const char *s, Number *result);
 
 
 #endif
diff --git a/lopcodes.h b/lopcodes.h
index cd19ff3d..a155956d 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lopcodes.h,v 1.44 2000/03/03 18:53:17 roberto Exp roberto $
+** $Id: lopcodes.h,v 1.47 2000/03/09 13:57:37 roberto Exp roberto $
 ** Opcodes for Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -20,7 +20,7 @@
   type 3: 1st unsigned argument in the higher 16 bits      (`A')
           2nd unsigned argument in the middle 8 bits       (`B')
 
-  The signed argument is represented in excess 2^23; that is, the real value
+  The signed argument is represented in excess 2^23; that is, the Number value
   is the usigned value minus 2^23.
 ===========================================================================*/
 
@@ -88,73 +88,73 @@ typedef enum {
 /*----------------------------------------------------------------------
 name		args	stack before	stack after	side effects
 ------------------------------------------------------------------------*/
-ENDCODE,/*	-	-		(return)			*/
-RETCODE,/*	U	-		(return)			*/
+OP_END,/*	-	-		(return)			*/
+OP_RETURN,/*	U	-		(return)			*/
 
-CALL,/*		A B	v_n-v_1 f(at a)	r_b-r_1		f(v1,...,v_n)	*/
-TAILCALL,/*	A B	v_a-v_1 f	(return)	f(v1,...,v_a)	*/
+OP_CALL,/*	A B	v_n-v_1 f(at a)	r_b-r_1		f(v1,...,v_n)	*/
+OP_TAILCALL,/*	A B	v_a-v_1 f	(return)	f(v1,...,v_a)	*/
 
-PUSHNIL,/*	U	-		nil_1-nil_u			*/
-POP,/*		U	a_u-a_1		-				*/
+OP_PUSHNIL,/*	U	-		nil_1-nil_u			*/
+OP_POP,/*	U	a_u-a_1		-				*/
 
-PUSHINT,/*	S	-		(real)s				*/
-PUSHSTRING,/*	K	-		KSTR[k]				*/
-PUSHNUM,/*	N	-		KNUM[u]				*/
-PUSHNEGNUM,/*	N	-		-KNUM[u]			*/
+OP_PUSHINT,/*	S	-		(Number)s				*/
+OP_PUSHSTRING,/* K	-		KSTR[k]				*/
+OP_PUSHNUM,/*	N	-		KNUM[u]				*/
+OP_PUSHNEGNUM,/* N	-		-KNUM[u]			*/
 
-PUSHUPVALUE,/*	U	-		Closure[u]			*/
+OP_PUSHUPVALUE,/* U	-		Closure[u]			*/
 
-PUSHLOCAL,/*	L	-		LOC[u]				*/
-GETGLOBAL,/*	K	-		VAR[KSTR[k]]			*/
+OP_PUSHLOCAL,/*	L	-		LOC[u]				*/
+OP_GETGLOBAL,/*	K	-		VAR[KSTR[k]]			*/
 
-GETTABLE,/*	-	i t		t[i]				*/
-GETDOTTED,/*	K	t		t[KSTR[k]]			*/
-PUSHSELF,/*	K	t		t t[KSTR[k]]			*/
+OP_GETTABLE,/*	-	i t		t[i]				*/
+OP_GETDOTTED,/*	K	t		t[KSTR[k]]			*/
+OP_PUSHSELF,/*	K	t		t t[KSTR[k]]			*/
 
-CREATETABLE,/*	U	-		newarray(size = u)		*/
+OP_CREATETABLE,/* U	-		newarray(size = u)		*/
 
-SETLOCAL,/*	L	x		-		LOC[u]=x	*/
-SETGLOBAL,/*	K	x		-		VAR[KSTR[k]]=x	*/
-SETTABLEPOP,/*	-	v i t		-		t[i]=v		*/
-SETTABLE,/*	U	v a_u-a_1 i t	 a_u-a_1 i t	t[i]=v		*/
+OP_SETLOCAL,/*	L	x		-		LOC[u]=x	*/
+OP_SETGLOBAL,/*	K	x		-		VAR[KSTR[k]]=x	*/
+OP_SETTABLEPOP,/* -	v i t		-		t[i]=v		*/
+OP_SETTABLE,/*	U	v a_u-a_1 i t	 a_u-a_1 i t	t[i]=v		*/
 
-SETLIST,/*	A B	v_b-v_0 t	t		t[i+a*FPF]=v_i	*/
-SETMAP,/*	U	v_u k_u - v_0 k_0 t	t	t[k_i]=v_i	*/
+OP_SETLIST,/*	A B	v_b-v_0 t	t		t[i+a*FPF]=v_i	*/
+OP_SETMAP,/*	U	v_u k_u - v_0 k_0 t	t	t[k_i]=v_i	*/
 
-ADDOP,/*	-	y x		x+y				*/
-ADDI,/*		S	x		x+s				*/
-SUBOP,/*	-	y x		x-y				*/
-MULTOP,/*	-	y x		x*y				*/
-DIVOP,/*	-	y x		x/y				*/
-POWOP,/*	-	y x		x^y				*/
-CONCOP,/*	U	v_u-v_1		v1..-..v_u			*/
-MINUSOP,/*	-	x		-x				*/
-NOTOP,/*	-	x		(x==nil)? 1 : nil		*/
+OP_ADD,/*	-	y x		x+y				*/
+OP_ADDI,/*	S	x		x+s				*/
+OP_SUB,/*	-	y x		x-y				*/
+OP_MULT,/*	-	y x		x*y				*/
+OP_DIV,/*	-	y x		x/y				*/
+OP_POW,/*	-	y x		x^y				*/
+OP_CONC,/*	U	v_u-v_1		v1..-..v_u			*/
+OP_MINUS,/*	-	x		-x				*/
+OP_NOT,/*	-	x		(x==nil)? 1 : nil		*/
 
-IFNEQJMP,/*	J	y x		-		(x~=y)? PC+=s	*/
-IFEQJMP,/*	J	y x		-		(x==y)? PC+=s	*/
-IFLTJMP,/*	J	y x		-		(x<y)? PC+=s	*/
-IFLEJMP,/*	J	y x		-		(x<y)? PC+=s	*/
-IFGTJMP,/*	J	y x		-		(x>y)? PC+=s	*/
-IFGEJMP,/*	J	y x		-		(x>=y)? PC+=s	*/
+OP_IFNEQJMP,/*	J	y x		-		(x~=y)? PC+=s	*/
+OP_IFEQJMP,/*	J	y x		-		(x==y)? PC+=s	*/
+OP_IFLTJMP,/*	J	y x		-		(x<y)? PC+=s	*/
+OP_IFLEJMP,/*	J	y x		-		(x<y)? PC+=s	*/
+OP_IFGTJMP,/*	J	y x		-		(x>y)? PC+=s	*/
+OP_IFGEJMP,/*	J	y x		-		(x>=y)? PC+=s	*/
 
-IFTJMP,/*	J	x		-		(x!=nil)? PC+=s	*/
-IFFJMP,/*	J	x		-		(x==nil)? PC+=s	*/
-ONTJMP,/*	J	x		(x!=nil)? x : -	(x!=nil)? PC+=s	*/
-ONFJMP,/*	J	x		(x==nil)? x : -	(x==nil)? PC+=s	*/
-JMP,/*		J	-		-		PC+=s		*/
+OP_IFTJMP,/*	J	x		-		(x!=nil)? PC+=s	*/
+OP_IFFJMP,/*	J	x		-		(x==nil)? PC+=s	*/
+OP_ONTJMP,/*	J	x		(x!=nil)? x : -	(x!=nil)? PC+=s	*/
+OP_ONFJMP,/*	J	x		(x==nil)? x : -	(x==nil)? PC+=s	*/
+OP_JMP,/*	J	-		-		PC+=s		*/
 
-PUSHNILJMP,/*	-	-		nil		PC++;		*/
+OP_PUSHNILJMP,/* -	-		nil		PC++;		*/
 
-CLOSURE,/*	A B	v_b-v_1		closure(CNST[a], v_1-v_b)	*/
+OP_CLOSURE,/*	A B	v_b-v_1		closure(CNST[a], v_1-v_b)	*/
 
-SETLINE/*	U	-		-		LINE=u		*/
+OP_SETLINE/*	U	-		-		LINE=u		*/
 
 } OpCode;
 
 
 
-#define ISJUMP(o)	(IFNEQJMP <= (o) && (o) <= JMP)
+#define ISJUMP(o)	(OP_IFNEQJMP <= (o) && (o) <= OP_JMP)
 
 
 #define RFIELDS_PER_FLUSH 32	/* records (SETMAP) */
diff --git a/lparser.c b/lparser.c
index a8198190..c875f784 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lparser.c,v 1.64 2000/03/03 20:29:25 roberto Exp roberto $
+** $Id: lparser.c,v 1.67 2000/03/09 13:57:37 roberto Exp roberto $
 ** LL(1) Parser and code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -116,7 +116,7 @@ static void checklimit (LexState *ls, int val, int limit, const char *msg) {
 
 static void check_debugline (LexState *ls) {
   if (ls->L->debug && ls->linenumber != ls->fs->lastsetline) {
-    luaK_U(ls, SETLINE, ls->linenumber, 0);
+    luaK_U(ls, OP_SETLINE, ls->linenumber, 0);
     ls->fs->lastsetline = ls->linenumber;
   }
 }
@@ -130,11 +130,11 @@ static void check_match (LexState *ls, int what, int who, int where) {
 }
 
 
-static int string_constant (LexState *ls, FuncState *fs, TaggedString *s) {
-  TProtoFunc *f = fs->f;
+static int string_constant (LexState *ls, FuncState *fs, TString *s) {
+  Proto *f = fs->f;
   int c = s->constindex;
   if (c >= f->nkstr || f->kstr[c] != s) {
-    luaM_growvector(ls->L, f->kstr, f->nkstr, 1, TaggedString *,
+    luaM_growvector(ls->L, f->kstr, f->nkstr, 1, TString *,
                     constantEM, MAXARG_U);
     c = f->nkstr++;
     f->kstr[c] = s;
@@ -144,14 +144,14 @@ static int string_constant (LexState *ls, FuncState *fs, TaggedString *s) {
 }
 
 
-static void code_string (LexState *ls, TaggedString *s) {
+static void code_string (LexState *ls, TString *s) {
   luaK_kstr(ls, string_constant(ls, ls->fs, s));
 }
 
 
 static int checkname (LexState *ls) {
   int sc;
-  if (ls->token != NAME)
+  if (ls->token != TK_NAME)
     luaK_error(ls, "<name> expected");
   sc = string_constant(ls, ls->fs, ls->seminfo.ts);
   next(ls);
@@ -159,17 +159,17 @@ static int checkname (LexState *ls) {
 }
 
 
-static TaggedString *str_checkname (LexState *ls) {
+static TString *str_checkname (LexState *ls) {
   int i = checkname(ls);  /* this call may realloc `f->consts' */
   return ls->fs->f->kstr[i];
 }
 
 
-static void luaI_registerlocalvar (LexState *ls, TaggedString *varname,
+static void luaI_registerlocalvar (LexState *ls, TString *varname,
                                    int line) {
   FuncState *fs = ls->fs;
   if (fs->nvars != -1) {  /* debug information? */
-    TProtoFunc *f = fs->f;
+    Proto *f = fs->f;
     luaM_growvector(ls->L, f->locvars, fs->nvars, 1, LocVar, "", MAX_INT);
     f->locvars[fs->nvars].varname = varname;
     f->locvars[fs->nvars].line = line;
@@ -183,7 +183,7 @@ static void luaI_unregisterlocalvar (LexState *ls, int line) {
 }
 
 
-static void store_localvar (LexState *ls, TaggedString *name, int n) {
+static void store_localvar (LexState *ls, TString *name, int n) {
   FuncState *fs = ls->fs;
   checklimit(ls, fs->nlocalvar+n+1, MAXLOCALS, "local variables");
   fs->localvar[fs->nlocalvar+n] = name;
@@ -199,13 +199,13 @@ static void adjustlocalvars (LexState *ls, int nvars, int line) {
 }
 
 
-static void add_localvar (LexState *ls, TaggedString *name) {
+static void add_localvar (LexState *ls, TString *name) {
   store_localvar(ls, name, 0);
   adjustlocalvars(ls, 1, 0);
 }
 
 
-static int aux_localname (FuncState *fs, TaggedString *n) {
+static int aux_localname (FuncState *fs, TString *n) {
   int i;
   for (i=fs->nlocalvar-1; i >= 0; i--)
     if (n == fs->localvar[i]) return i;  /* local var index */
@@ -213,7 +213,7 @@ static int aux_localname (FuncState *fs, TaggedString *n) {
 }
 
 
-static void singlevar (LexState *ls, TaggedString *n, expdesc *var, int prev) {
+static void singlevar (LexState *ls, TString *n, expdesc *var, int prev) {
   FuncState *fs = prev ? ls->fs->prev : ls->fs;
   int i = aux_localname(fs, n);
   if (i >= 0) {  /* local value? */
@@ -231,7 +231,7 @@ static void singlevar (LexState *ls, TaggedString *n, expdesc *var, int prev) {
 }
 
 
-static int indexupvalue (LexState *ls, TaggedString *n) {
+static int indexupvalue (LexState *ls, TString *n) {
   FuncState *fs = ls->fs;
   expdesc v;
   int i;
@@ -248,12 +248,12 @@ static int indexupvalue (LexState *ls, TaggedString *n) {
 }
 
 
-static void pushupvalue (LexState *ls, TaggedString *n) {
+static void pushupvalue (LexState *ls, TString *n) {
   if (ls->fs->prev == NULL)
     luaX_syntaxerror(ls, "cannot access upvalue in main", n->str);
   if (aux_localname(ls->fs, n) >= 0)
     luaX_syntaxerror(ls, "cannot access an upvalue in current scope", n->str);
-  luaK_U(ls, PUSHUPVALUE, indexupvalue(ls, n), 1);
+  luaK_U(ls, OP_PUSHUPVALUE, indexupvalue(ls, n), 1);
 }
 
 
@@ -308,21 +308,21 @@ static int getvarname (LexState *ls, expdesc *var) {
 
 
 static void func_onstack (LexState *ls, FuncState *func) {
-  TProtoFunc *f = ls->fs->f;
+  Proto *f = ls->fs->f;
   int i;
   for (i=0; i<func->nupvalues; i++)
     luaK_tostack(ls, &func->upvalues[i], 1);
-  luaM_growvector(ls->L, f->kproto, f->nkproto, 1, TProtoFunc *,
+  luaM_growvector(ls->L, f->kproto, f->nkproto, 1, Proto *,
                   constantEM, MAXARG_A);
   f->kproto[f->nkproto++] = func->f;
   luaK_deltastack(ls, 1);  /* CLOSURE puts one extra element before popping */
-  luaK_AB(ls, CLOSURE, f->nkproto-1, func->nupvalues, -func->nupvalues);
+  luaK_AB(ls, OP_CLOSURE, f->nkproto-1, func->nupvalues, -func->nupvalues);
 }
 
 
-static void init_state (LexState *ls, FuncState *fs, TaggedString *source) {
+static void init_state (LexState *ls, FuncState *fs, TString *source) {
   lua_State *L = ls->L;
-  TProtoFunc *f = luaF_newproto(ls->L);
+  Proto *f = luaF_newproto(ls->L);
   fs->prev = ls->fs;  /* linked list of funcstates */
   ls->fs = fs;
   fs->stacksize = 0;
@@ -340,19 +340,19 @@ static void init_state (LexState *ls, FuncState *fs, TaggedString *source) {
   fs->nvars = (L->debug) ? 0 : -1;  /* flag no debug information? */
   /* push function (to avoid GC) */
   tfvalue(L->top) = f;
-  ttype(L->top) = LUA_T_LPROTO;
+  ttype(L->top) = TAG_LPROTO;
   incr_top;
 }
 
 
 static void close_func (LexState *ls) {
   FuncState *fs = ls->fs;
-  TProtoFunc *f = fs->f;
-  luaK_0(ls, ENDCODE, 0);
+  Proto *f = fs->f;
+  luaK_0(ls, OP_END, 0);
   luaM_reallocvector(ls->L, f->code, fs->pc, Instruction);
-  luaM_reallocvector(ls->L, f->kstr, f->nkstr, TaggedString *);
-  luaM_reallocvector(ls->L, f->knum, f->nknum, real);
-  luaM_reallocvector(ls->L, f->kproto, f->nkproto, TProtoFunc *);
+  luaM_reallocvector(ls->L, f->kstr, f->nkstr, TString *);
+  luaM_reallocvector(ls->L, f->knum, f->nknum, Number);
+  luaM_reallocvector(ls->L, f->kproto, f->nkproto, Proto *);
   if (fs->nvars != -1) {  /* debug information? */
     luaI_registerlocalvar(ls, NULL, -1);  /* flag end of vector */
     luaM_reallocvector(ls->L, f->locvars, fs->nvars, LocVar);
@@ -362,14 +362,14 @@ static void close_func (LexState *ls) {
 }
 
 
-TProtoFunc *luaY_parser (lua_State *L, ZIO *z) {
+Proto *luaY_parser (lua_State *L, ZIO *z) {
   struct LexState lexstate;
   struct FuncState funcstate;
   luaX_setinput(L, &lexstate, z);
   init_state(&lexstate, &funcstate, luaS_new(L, zname(z)));
   next(&lexstate);  /* read first token */
   chunk(&lexstate);
-  if (lexstate.token != EOS)
+  if (lexstate.token != TK_EOS)
     luaK_error(&lexstate, "<eof> expected");
   close_func(&lexstate);
   return funcstate.f;
@@ -401,8 +401,8 @@ static int explist1 (LexState *ls) {
 static int explist (LexState *ls) {
   /* explist -> [ explist1 ] */
   switch (ls->token) {
-    case ELSE: case ELSEIF: case END: case UNTIL:
-    case EOS: case ';': case ')':
+    case TK_ELSE: case TK_ELSEIF: case TK_END: case TK_UNTIL:
+    case TK_EOS: case ';': case ')':
       return 0;  /* empty list */
 
     default:
@@ -432,7 +432,7 @@ static void funcargs (LexState *ls, int slf) {
       constructor(ls);
       break;
 
-    case STRING:  /* funcargs -> STRING */
+    case TK_STRING:  /* funcargs -> STRING */
       code_string(ls, ls->seminfo.ts);  /* must use `seminfo' before `next' */
       next(ls);
       break;
@@ -442,7 +442,7 @@ static void funcargs (LexState *ls, int slf) {
       break;
   }
   fs->stacksize = slevel;  /* call will remove function and arguments */
-  luaK_AB(ls, CALL, slevel, MULT_RET, 0);
+  luaK_AB(ls, OP_CALL, slevel, MULT_RET, 0);
 }
 
 
@@ -469,14 +469,14 @@ static void var_or_func_tail (LexState *ls, expdesc *v) {
         next(ls);
         name = checkname(ls);
         luaK_tostack(ls, v, 1);  /* `v' must be on stack */
-        luaK_U(ls, PUSHSELF, name, 1);
+        luaK_U(ls, OP_PUSHSELF, name, 1);
         funcargs(ls, 1);
         v->k = VEXP;
         v->u.l.t = v->u.l.f = 0;
         break;
       }
 
-      case '(': case STRING: case '{':  /* var_or_func_tail -> funcargs */
+      case '(': case TK_STRING: case '{':  /* var_or_func_tail -> funcargs */
         luaK_tostack(ls, v, 1);  /* `v' must be on stack */
         funcargs(ls, 0);
         v->k = VEXP;
@@ -513,7 +513,7 @@ static void var_or_func (LexState *ls, expdesc *v) {
 static void recfield (LexState *ls) {
   /* recfield -> (NAME | '['exp1']') = exp1 */
   switch (ls->token) {
-    case NAME:
+    case TK_NAME:
       luaK_kstr(ls, checkname(ls));
       break;
 
@@ -541,12 +541,12 @@ static int recfields (LexState *ls) {
     recfield(ls);
     n++;
     if (++mod_n == RFIELDS_PER_FLUSH) {
-      luaK_U(ls, SETMAP, RFIELDS_PER_FLUSH-1, -2*RFIELDS_PER_FLUSH);
+      luaK_U(ls, OP_SETMAP, RFIELDS_PER_FLUSH-1, -2*RFIELDS_PER_FLUSH);
       mod_n = 0;
     }
   }
   if (mod_n)
-    luaK_U(ls, SETMAP, mod_n-1, -2*mod_n);
+    luaK_U(ls, OP_SETMAP, mod_n-1, -2*mod_n);
   return n;
 }
 
@@ -564,13 +564,13 @@ static int listfields (LexState *ls) {
     checklimit(ls, n, MAXARG_A*LFIELDS_PER_FLUSH,
                "items in a list initializer");
     if (++mod_n == LFIELDS_PER_FLUSH) {
-      luaK_AB(ls, SETLIST, n/LFIELDS_PER_FLUSH - 1, LFIELDS_PER_FLUSH-1,
+      luaK_AB(ls, OP_SETLIST, n/LFIELDS_PER_FLUSH - 1, LFIELDS_PER_FLUSH-1,
               -LFIELDS_PER_FLUSH);
       mod_n = 0;
     }
   }
   if (mod_n > 0)
-    luaK_AB(ls, SETLIST, n/LFIELDS_PER_FLUSH, mod_n-1, -mod_n);
+    luaK_AB(ls, OP_SETLIST, n/LFIELDS_PER_FLUSH, mod_n-1, -mod_n);
   return n;
 }
 
@@ -583,7 +583,7 @@ static void constructor_part (LexState *ls, constdesc *cd) {
       cd->k = ls->token;
       return;
 
-    case NAME: {
+    case TK_NAME: {
       expdesc v;
       expr(ls, &v);
       if (ls->token == '=') {
@@ -619,7 +619,7 @@ static void constructor_part (LexState *ls, constdesc *cd) {
 static void constructor (LexState *ls) {
   /* constructor -> '{' constructor_part [';' constructor_part] '}' */
   int line = ls->linenumber;
-  int pc = luaK_U(ls, CREATETABLE, 0, 1);
+  int pc = luaK_U(ls, OP_CREATETABLE, 0, 1);
   int nelems;
   constdesc cd;
   check(ls, '{');
@@ -653,19 +653,19 @@ static void constructor (LexState *ls) {
 static void simpleexp (LexState *ls, expdesc *v) {
   check_debugline(ls);
   switch (ls->token) {
-    case NUMBER: {  /* simpleexp -> NUMBER */
-      real r = ls->seminfo.r;
+    case TK_NUMBER: {  /* simpleexp -> NUMBER */
+      Number r = ls->seminfo.r;
       next(ls);
       luaK_number(ls, r);
       break;
     }
 
-    case STRING:  /* simpleexp -> STRING */
+    case TK_STRING:  /* simpleexp -> STRING */
       code_string(ls, ls->seminfo.ts);  /* must use `seminfo' before `next' */
       next(ls);
       break;
 
-    case NIL:  /* simpleexp -> NIL */
+    case TK_NIL:  /* simpleexp -> NIL */
       luaK_adjuststack(ls, -1);
       next(ls);
       break;
@@ -674,7 +674,7 @@ static void simpleexp (LexState *ls, expdesc *v) {
       constructor(ls);
       break;
 
-    case FUNCTION:  /* simpleexp -> FUNCTION body */
+    case TK_FUNCTION:  /* simpleexp -> FUNCTION body */
       next(ls);
       body(ls, 0, ls->linenumber);
       break;
@@ -685,7 +685,7 @@ static void simpleexp (LexState *ls, expdesc *v) {
       check(ls, ')');
       return;
 
-    case NAME: case '%':
+    case TK_NAME: case '%':
       var_or_func(ls, v);
       return;
 
@@ -720,12 +720,12 @@ static int get_priority (int op, int *rp) {
 
     case  '+': case  '-': *rp = 5; return 5;
 
-    case  CONC: *rp = 3; return 4;  /* right associative (?) */
+    case  TK_CONC: *rp = 3; return 4;  /* right associative (?) */
 
-    case EQ: case  NE: case  '>': case  '<': case  LE: case  GE:
+    case TK_EQ: case  TK_NE: case  '>': case  '<': case  TK_LE: case  TK_GE:
       *rp = 2; return 2;
 
-    case AND: case OR: *rp = 1; return 1;
+    case TK_AND: case TK_OR: *rp = 1; return 1;
 
     default: *rp = -1; return -1;
   }
@@ -738,7 +738,7 @@ static int get_priority (int op, int *rp) {
 */
 static void subexpr (LexState *ls, expdesc *v, int limit) {
   int rp;
-  if (ls->token == '-' || ls->token == NOT) {
+  if (ls->token == '-' || ls->token == TK_NOT) {
     int op = ls->token;  /* operator */
     next(ls);
     subexpr(ls, v, UNARY_PRIORITY);
@@ -806,7 +806,7 @@ static int assignment (LexState *ls, expdesc *v, int nvars) {
     luaK_storevar(ls, v);
   }
   else {  /* indexed var with values in between*/
-    luaK_U(ls, SETTABLE, left+(nvars-1), -1);
+    luaK_U(ls, OP_SETTABLE, left+(nvars-1), -1);
     left += 2;  /* table&index are not popped, because they aren't on top */
   }
   return left;
@@ -838,11 +838,11 @@ static void whilestat (LexState *ls, int line) {
   for (i=0; i<cond_size; i++) buffer[i] = fs->f->code[while_init+i];
   /* go back to state prior condition */
   fs->pc = while_init;
-  luaK_S(ls, JMP, 0, 0);  /* initial jump to condition */
-  check(ls, DO);
+  luaK_S(ls, OP_JMP, 0, 0);  /* initial jump to condition */
+  check(ls, TK_DO);
   loopentry = luaK_getlabel(ls);
   block(ls);
-  check_match(ls, END, WHILE, line);
+  check_match(ls, TK_END, TK_WHILE, line);
   cond_init = luaK_getlabel(ls);
   luaK_fixjump(ls, while_init, cond_init);
   /* correct `v' and  copy condition to new position */
@@ -859,7 +859,7 @@ static void repeatstat (LexState *ls, int line) {
   expdesc v;
   next(ls);
   block(ls);
-  check_match(ls, UNTIL, REPEAT, line);
+  check_match(ls, TK_UNTIL, TK_REPEAT, line);
   expr(ls, &v);
   luaK_goiftrue(ls, &v, 0);
   luaK_patchlist(ls, v.u.l.f, repeat_init);
@@ -958,16 +958,16 @@ static void ifpart (LexState *ls, int line) {
   next(ls);  /* skip IF or ELSEIF */
   expr(ls, &v);  /* cond */
   luaK_goiftrue(ls, &v, 0);
-  check(ls, THEN);
+  check(ls, TK_THEN);
   block(ls);  /* `then' part */
-  luaK_S(ls, JMP, 0, 0);  /* 2nd jump: over `else' part */
+  luaK_S(ls, OP_JMP, 0, 0);  /* 2nd jump: over `else' part */
   elseinit = luaK_getlabel(ls);  /* address of 2nd jump == elseinit-1 */
-  if (ls->token == ELSEIF)
+  if (ls->token == TK_ELSEIF)
     ifpart(ls, line);
   else {
-    if (optional(ls, ELSE))
+    if (optional(ls, TK_ELSE))
       block(ls);  /* `else' part */
-    check_match(ls, END, IF, line);
+    check_match(ls, TK_END, TK_IF, line);
   }
   if (fs->pc > elseinit) {  /* is there an `else' part? */
     luaK_fixjump(ls, elseinit-1, luaK_getlabel(ls));  /* fix 2nd jump */
@@ -983,38 +983,38 @@ static void ifpart (LexState *ls, int line) {
 static int stat (LexState *ls) {
   int line = ls->linenumber;  /* may be needed for error messages */
   switch (ls->token) {
-    case IF:  /* stat -> IF ifpart END */
+    case TK_IF:  /* stat -> IF ifpart END */
       ifpart(ls, line);
       return 1;
 
-    case WHILE:  /* stat -> whilestat */
+    case TK_WHILE:  /* stat -> whilestat */
       whilestat(ls, line);
       return 1;
 
-    case DO: {  /* stat -> DO block END */
+    case TK_DO: {  /* stat -> DO block END */
       next(ls);
       block(ls);
-      check_match(ls, END, DO, line);
+      check_match(ls, TK_END, TK_DO, line);
       return 1;
     }
 
-    case REPEAT:  /* stat -> repeatstat */
+    case TK_REPEAT:  /* stat -> repeatstat */
       repeatstat(ls, line);
       return 1;
 
-    case FUNCTION:  /* stat -> funcstat */
+    case TK_FUNCTION:  /* stat -> funcstat */
       return funcstat(ls, line);
 
-    case LOCAL:  /* stat -> localstat */
+    case TK_LOCAL:  /* stat -> localstat */
       localstat(ls);
       return 1;
 
-    case NAME: case '%':  /* stat -> namestat */
+    case TK_NAME: case '%':  /* stat -> namestat */
       namestat(ls);
       return 1;
 
-    case RETURN: case ';': case ELSE: case ELSEIF:
-    case END: case UNTIL: case EOS:  /* `stat' follow */
+    case TK_RETURN: case ';': case TK_ELSE: case TK_ELSEIF:
+    case TK_END: case TK_UNTIL: case TK_EOS:  /* `stat' follow */
       return 0;
 
     default:
@@ -1028,23 +1028,23 @@ static void parlist (LexState *ls) {
   int nparams = 0;
   int dots = 0;
   switch (ls->token) {
-    case DOTS:  /* parlist -> DOTS */
+    case TK_DOTS:  /* parlist -> DOTS */
       next(ls);
       dots = 1;
       break;
 
-    case NAME:  /* parlist, tailparlist -> NAME [',' tailparlist] */
+    case TK_NAME:  /* parlist, tailparlist -> NAME [',' tailparlist] */
       init:
       store_localvar(ls, str_checkname(ls), nparams++);
       if (ls->token == ',') {
         next(ls);
         switch (ls->token) {
-          case DOTS:  /* tailparlist -> DOTS */
+          case TK_DOTS:  /* tailparlist -> DOTS */
             next(ls);
             dots = 1;
             break;
 
-          case NAME:  /* tailparlist -> NAME [',' tailparlist] */
+          case TK_NAME:  /* tailparlist -> NAME [',' tailparlist] */
             goto init;
 
           default: luaK_error(ls, "<name> or `...' expected");
@@ -1071,7 +1071,7 @@ static void body (LexState *ls, int needself, int line) {
   parlist(ls);
   check(ls, ')');
   chunk(ls);
-  check_match(ls, END, FUNCTION, line);
+  check_match(ls, TK_END, TK_FUNCTION, line);
   close_func(ls);
   func_onstack(ls, &new_fs);
 }
@@ -1079,7 +1079,7 @@ static void body (LexState *ls, int needself, int line) {
 
 static void ret (LexState *ls) {
   /* ret -> [RETURN explist sc] */
-  if (ls->token == RETURN) {
+  if (ls->token == TK_RETURN) {
     int nexps;  /* number of expressions returned */
     check_debugline(ls);
     next(ls);
diff --git a/lparser.h b/lparser.h
index 01332478..36b76c97 100644
--- a/lparser.h
+++ b/lparser.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lparser.h,v 1.9 2000/03/03 18:53:17 roberto Exp roberto $
+** $Id: lparser.h,v 1.11 2000/03/09 13:57:37 roberto Exp roberto $
 ** LL(1) Parser and code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -68,7 +68,7 @@ typedef struct expdesc {
 
 /* state needed to generate code for a given function */
 typedef struct FuncState {
-  TProtoFunc *f;  /* current function header */
+  Proto *f;  /* current function header */
   struct FuncState *prev;  /* enclosing function */
   int pc;  /* next position to code */
   int lasttarget;   /* `pc' of last `jump target' */
@@ -78,11 +78,11 @@ typedef struct FuncState {
   int nvars;  /* number of entries in f->locvars (-1 if no debug information) */
   int lastsetline;  /* line where last SETLINE was issued */
   expdesc upvalues[MAXUPVALUES];  /* upvalues */
-  TaggedString *localvar[MAXLOCALS];  /* store local variable names */
+  TString *localvar[MAXLOCALS];  /* store local variable names */
 } FuncState;
 
 
-TProtoFunc *luaY_parser (lua_State *L, ZIO *z);
+Proto *luaY_parser (lua_State *L, ZIO *z);
 
 
 #endif
diff --git a/lref.c b/lref.c
index eeb720a2..b401a1b5 100644
--- a/lref.c
+++ b/lref.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lref.c,v 1.7 2000/02/08 16:34:31 roberto Exp roberto $
+** $Id: lref.c,v 1.8 2000/03/03 14:58:26 roberto Exp roberto $
 ** reference mechanism
 ** See Copyright Notice in lua.h
 */
@@ -17,7 +17,7 @@
 int lua_ref (lua_State *L,  int lock) {
   int ref;
   luaA_checkCargs(L, 1);
-  if (ttype(L->top-1) == LUA_T_NIL)
+  if (ttype(L->top-1) == TAG_NIL)
     ref = LUA_REFNIL;
   else {
     if (L->refFree != NONEXT) {  /* is there a free place? */
@@ -82,13 +82,13 @@ void lua_endblock (lua_State *L) {
 static int ismarked (const TObject *o) {
   /* valid only for locked objects */
   switch (o->ttype) {
-    case LUA_T_STRING: case LUA_T_USERDATA:
+    case TAG_STRING: case TAG_USERDATA:
       return o->value.ts->marked;
-    case LUA_T_ARRAY:
+    case TAG_ARRAY:
       return o->value.a->marked;
-    case LUA_T_LCLOSURE:  case LUA_T_CCLOSURE:
+    case TAG_LCLOSURE:  case TAG_CCLOSURE:
       return o->value.cl->marked;
-    case LUA_T_LPROTO:
+    case TAG_LPROTO:
       return o->value.tf->marked;
     default:  /* number or cproto */
       return 1;
diff --git a/lstate.h b/lstate.h
index da0f1681..bda30bb9 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lstate.h,v 1.28 2000/01/19 12:00:45 roberto Exp roberto $
+** $Id: lstate.h,v 1.29 2000/02/08 16:34:31 roberto Exp roberto $
 ** Global State
 ** See Copyright Notice in lua.h
 */
@@ -43,7 +43,7 @@ struct C_Lua_Stack {
 typedef struct stringtable {
   int size;
   int nuse;  /* number of elements (including EMPTYs) */
-  TaggedString **hash;
+  TString **hash;
 } stringtable;
 
 
@@ -63,7 +63,7 @@ struct lua_State {
   struct C_Lua_Stack *Cblocks;
   int numCblocks;  /* number of nested Cblocks */
   /* global state */
-  TProtoFunc *rootproto;  /* list of all prototypes */
+  Proto *rootproto;  /* list of all prototypes */
   Closure *rootcl;  /* list of all closures */
   Hash *roottable;  /* list of all tables */
   GlobalVar *rootglobal;  /* list of global variables */
diff --git a/lstring.c b/lstring.c
index 7e10da33..1dd4c9b9 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lstring.c,v 1.32 2000/03/03 14:58:26 roberto Exp roberto $
+** $Id: lstring.c,v 1.33 2000/03/10 14:38:10 roberto Exp roberto $
 ** String table (keeps all strings handled by Lua)
 ** See Copyright Notice in lua.h
 */
@@ -17,7 +17,7 @@
 
 
 
-#define gcsizestring(L, l)	numblocks(L, 0, sizeof(TaggedString)+l)
+#define gcsizestring(L, l)	numblocks(L, 0, sizeof(TString)+l)
 #define gcsizeudata		gcsizestring(L, 0)
 
 
@@ -28,7 +28,7 @@ void luaS_init (lua_State *L) {
   for (i=0; i<NUM_HASHS; i++) {
     L->string_root[i].size = 1;
     L->string_root[i].nuse = 0;
-    L->string_root[i].hash = luaM_newvector(L, 1, TaggedString *);;
+    L->string_root[i].hash = luaM_newvector(L, 1, TString *);;
     L->string_root[i].hash[0] = NULL;
   }
 }
@@ -54,14 +54,14 @@ static unsigned long hash_s (const char *s, long l) {
 
 
 void luaS_resize (lua_State *L, stringtable *tb, int newsize) {
-  TaggedString **newhash = luaM_newvector(L, newsize, TaggedString *);
+  TString **newhash = luaM_newvector(L, newsize, TString *);
   int i;
   for (i=0; i<newsize; i++) newhash[i] = NULL;
   /* rehash */
   for (i=0; i<tb->size; i++) {
-    TaggedString *p = tb->hash[i];
+    TString *p = tb->hash[i];
     while (p) {  /* for each node in the list */
-      TaggedString *next = p->nexthash;  /* save next */
+      TString *next = p->nexthash;  /* save next */
       int h = p->hash&(newsize-1);  /* new position */
       LUA_ASSERT(L, p->hash%newsize == (p->hash&(newsize-1)),
                     "a&(x-1) == a%x, for x power of 2");
@@ -76,9 +76,9 @@ void luaS_resize (lua_State *L, stringtable *tb, int newsize) {
 }
 
 
-static TaggedString *newone (lua_State *L, long l, unsigned long h) {
-  TaggedString *ts = (TaggedString *)luaM_malloc(L, 
-                                       sizeof(TaggedString)+l*sizeof(char));
+static TString *newone (lua_State *L, long l, unsigned long h) {
+  TString *ts = (TString *)luaM_malloc(L, 
+                                       sizeof(TString)+l*sizeof(char));
   ts->marked = 0;
   ts->nexthash = NULL;
   ts->hash = h;
@@ -86,9 +86,9 @@ static TaggedString *newone (lua_State *L, long l, unsigned long h) {
 }
 
 
-static TaggedString *newone_s (lua_State *L, const char *str,
+static TString *newone_s (lua_State *L, const char *str,
                                long l, unsigned long h) {
-  TaggedString *ts = newone(L, l, h);
+  TString *ts = newone(L, l, h);
   memcpy(ts->str, str, l);
   ts->str[l] = 0;  /* ending 0 */
   ts->u.s.gv = NULL;  /* no global value */
@@ -99,9 +99,9 @@ static TaggedString *newone_s (lua_State *L, const char *str,
 }
 
 
-static TaggedString *newone_u (lua_State *L, void *buff,
+static TString *newone_u (lua_State *L, void *buff,
                                int tag, unsigned long h) {
-  TaggedString *ts = newone(L, 0, h);
+  TString *ts = newone(L, 0, h);
   ts->u.d.value = buff;
   ts->u.d.tag = (tag == LUA_ANYTAG) ? 0 : tag;
   ts->constindex = -1;  /* tag -> this is a userdata */
@@ -110,7 +110,7 @@ static TaggedString *newone_u (lua_State *L, void *buff,
 }
 
 
-static void newentry (lua_State *L, stringtable *tb, TaggedString *ts, int h) {
+static void newentry (lua_State *L, stringtable *tb, TString *ts, int h) {
   ts->nexthash = tb->hash[h];  /* chain new entry */
   tb->hash[h] = ts;
   tb->nuse++;
@@ -119,12 +119,12 @@ static void newentry (lua_State *L, stringtable *tb, TaggedString *ts, int h) {
 }
 
 
-TaggedString *luaS_newlstr (lua_State *L, const char *str, long l) {
+TString *luaS_newlstr (lua_State *L, const char *str, long l) {
   unsigned long h = hash_s(str, l);
   stringtable *tb = &L->string_root[(l==0) ? 0 :
                          ((unsigned int)(str[0]+str[l-1]))&(NUM_HASHSTR-1)];
   int h1 = h&(tb->size-1);
-  TaggedString *ts;
+  TString *ts;
   for (ts = tb->hash[h1]; ts; ts = ts->nexthash) {
     if (ts->u.s.len == l && (memcmp(str, ts->str, l) == 0))
       return ts;
@@ -140,11 +140,11 @@ TaggedString *luaS_newlstr (lua_State *L, const char *str, long l) {
 ** uses '%' for one hashing with userdata because addresses are too regular,
 ** so two '&' operations would be highly correlated
 */
-TaggedString *luaS_createudata (lua_State *L, void *udata, int tag) {
+TString *luaS_createudata (lua_State *L, void *udata, int tag) {
   unsigned long h = IntPoint(L, udata);
   stringtable *tb = &L->string_root[(h%NUM_HASHUDATA)+NUM_HASHSTR];
   int h1 = h&(tb->size-1);
-  TaggedString *ts;
+  TString *ts;
   for (ts = tb->hash[h1]; ts; ts = ts->nexthash) {
     if (udata == ts->u.d.value && (tag == ts->u.d.tag || tag == LUA_ANYTAG))
       return ts;
@@ -156,18 +156,18 @@ TaggedString *luaS_createudata (lua_State *L, void *udata, int tag) {
 }
 
 
-TaggedString *luaS_new (lua_State *L, const char *str) {
+TString *luaS_new (lua_State *L, const char *str) {
   return luaS_newlstr(L, str, strlen(str));
 }
 
-TaggedString *luaS_newfixed (lua_State *L, const char *str) {
-  TaggedString *ts = luaS_new(L, str);
+TString *luaS_newfixed (lua_State *L, const char *str) {
+  TString *ts = luaS_new(L, str);
   if (ts->marked == 0) ts->marked = FIXMARK;  /* avoid GC */
   return ts;
 }
 
 
-void luaS_free (lua_State *L, TaggedString *t) {
+void luaS_free (lua_State *L, TString *t) {
   if (t->constindex == -1)  /* is userdata? */
     L->nblocks -= gcsizeudata;
   else {  /* is string */
@@ -178,11 +178,11 @@ void luaS_free (lua_State *L, TaggedString *t) {
 }
 
 
-GlobalVar *luaS_assertglobal (lua_State *L, TaggedString *ts) {
+GlobalVar *luaS_assertglobal (lua_State *L, TString *ts) {
   GlobalVar *gv = ts->u.s.gv;
   if (!gv) {  /* no global value yet? */
     gv = luaM_new(L, GlobalVar);
-    gv->value.ttype = LUA_T_NIL;  /* initial value */
+    gv->value.ttype = TAG_NIL;  /* initial value */
     gv->name = ts;
     gv->next = L->rootglobal;  /* chain in global list */
     L->rootglobal = gv; 
@@ -198,8 +198,8 @@ GlobalVar *luaS_assertglobalbyname (lua_State *L, const char *name) {
 
 
 int luaS_globaldefined (lua_State *L, const char *name) {
-  TaggedString *ts = luaS_new(L, name);
-  return ts->u.s.gv && ts->u.s.gv->value.ttype != LUA_T_NIL;
+  TString *ts = luaS_new(L, name);
+  return ts->u.s.gv && ts->u.s.gv->value.ttype != TAG_NIL;
 }
 
 
diff --git a/lstring.h b/lstring.h
index 226c02eb..80aa0b8f 100644
--- a/lstring.h
+++ b/lstring.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lstring.h,v 1.16 2000/03/03 14:58:26 roberto Exp roberto $
+** $Id: lstring.h,v 1.17 2000/03/10 14:38:10 roberto Exp roberto $
 ** String table (keep all strings handled by Lua)
 ** See Copyright Notice in lua.h
 */
@@ -27,13 +27,13 @@
 
 void luaS_init (lua_State *L);
 void luaS_resize (lua_State *L, stringtable *tb, int newsize);
-TaggedString *luaS_createudata (lua_State *L, void *udata, int tag);
+TString *luaS_createudata (lua_State *L, void *udata, int tag);
 void luaS_freeall (lua_State *L);
-void luaS_free (lua_State *L, TaggedString *ts);
-TaggedString *luaS_newlstr (lua_State *L, const char *str, long l);
-TaggedString *luaS_new (lua_State *L, const char *str);
-TaggedString *luaS_newfixed (lua_State *L, const char *str);
-GlobalVar *luaS_assertglobal (lua_State *L, TaggedString *ts);
+void luaS_free (lua_State *L, TString *ts);
+TString *luaS_newlstr (lua_State *L, const char *str, long l);
+TString *luaS_new (lua_State *L, const char *str);
+TString *luaS_newfixed (lua_State *L, const char *str);
+GlobalVar *luaS_assertglobal (lua_State *L, TString *ts);
 GlobalVar *luaS_assertglobalbyname (lua_State *L, const char *name);
 int luaS_globaldefined (lua_State *L, const char *name);
 
diff --git a/ltable.c b/ltable.c
index be45da44..d13002c9 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
 /*
-** $Id: ltable.c,v 1.34 2000/02/08 16:34:31 roberto Exp roberto $
+** $Id: ltable.c,v 1.35 2000/03/03 14:58:26 roberto Exp roberto $
 ** Lua tables (hash)
 ** See Copyright Notice in lua.h
 */
@@ -32,7 +32,7 @@
 
 
 
-#define TagDefault LUA_T_ARRAY
+#define TagDefault TAG_ARRAY
 
 
 
@@ -43,22 +43,22 @@
 Node *luaH_mainposition (const Hash *t, const TObject *key) {
   unsigned long h;
   switch (ttype(key)) {
-    case LUA_T_NUMBER:
+    case TAG_NUMBER:
       h = (unsigned long)(long)nvalue(key);
       break;
-    case LUA_T_STRING: case LUA_T_USERDATA:
+    case TAG_STRING: case TAG_USERDATA:
       h = tsvalue(key)->hash;
       break;
-    case LUA_T_ARRAY:
+    case TAG_ARRAY:
       h = IntPoint(L, avalue(key));
       break;
-    case LUA_T_LPROTO:
+    case TAG_LPROTO:
       h = IntPoint(L, tfvalue(key));
       break;
-    case LUA_T_CPROTO:
+    case TAG_CPROTO:
       h = IntPoint(L, fvalue(key));
       break;
-    case LUA_T_LCLOSURE:  case LUA_T_CCLOSURE:
+    case TAG_LCLOSURE:  case TAG_CCLOSURE:
       h = IntPoint(L, clvalue(key));
       break;
     default:
@@ -95,7 +95,7 @@ static Node *hashnodecreate (lua_State *L, int nhash) {
   Node *v = luaM_newvector(L, nhash, Node);
   int i;
   for (i=0; i<nhash; i++) {
-    ttype(&v[i].key) = ttype(&v[i].val) = LUA_T_NIL;
+    ttype(&v[i].key) = ttype(&v[i].val) = TAG_NIL;
     v[i].next = NULL;
   }
   return v;
@@ -134,7 +134,7 @@ static int newsize (const Hash *t) {
   int realuse = 0;
   int i;
   for (i=0; i<size; i++) {
-    if (ttype(&v[i].val) != LUA_T_NIL)
+    if (ttype(&v[i].val) != TAG_NIL)
       realuse++;
   }
   return luaO_power2(realuse+realuse/4+1);
@@ -149,7 +149,7 @@ static void rehash (lua_State *L, Hash *t) {
   setnodevector(L, t, newsize(t));  /* create new array of nodes */
   for (i=0; i<oldsize; i++) {
     Node *old = nold+i;
-    if (ttype(&old->val) != LUA_T_NIL)
+    if (ttype(&old->val) != TAG_NIL)
        luaH_set(L, t, &old->key, &old->val);
   }
   luaM_free(L, nold);  /* free old array */
@@ -182,7 +182,7 @@ void luaH_set (lua_State *L, Hash *t, const TObject *key, const TObject *val) {
     else n = n->next;
   } while (n);
   /* `key' not found; must insert it */
-  if (ttype(&mp->key) != LUA_T_NIL) {  /* main position is not free? */
+  if (ttype(&mp->key) != TAG_NIL) {  /* main position is not free? */
     Node *othern;  /* main position of colliding node */
     n = t->firstfree;  /* get a free place */
     /* is colliding node out of its main position? (can only happens if
@@ -204,7 +204,7 @@ void luaH_set (lua_State *L, Hash *t, const TObject *key, const TObject *val) {
   mp->key = *key;
   mp->val = *val;
   for (;;) {  /* check free places */
-    if (ttype(&(t->firstfree)->key) == LUA_T_NIL)
+    if (ttype(&(t->firstfree)->key) == TAG_NIL)
       return;  /* OK; table still has a free place */
     else if (t->firstfree == t->node) break;  /* cannot decrement from here */
     else (t->firstfree)--;
@@ -215,7 +215,7 @@ void luaH_set (lua_State *L, Hash *t, const TObject *key, const TObject *val) {
 
 void luaH_setint (lua_State *L, Hash *t, int key, const TObject *val) {
   TObject index;
-  ttype(&index) = LUA_T_NUMBER;
+  ttype(&index) = TAG_NUMBER;
   nvalue(&index) = key;
   luaH_set(L, t, &index, val);
 }
@@ -223,7 +223,7 @@ void luaH_setint (lua_State *L, Hash *t, int key, const TObject *val) {
 
 const TObject *luaH_getint (lua_State *L, const Hash *t, int key) {
   TObject index;
-  ttype(&index) = LUA_T_NUMBER;
+  ttype(&index) = TAG_NUMBER;
   nvalue(&index) = key;
   return luaH_get(L, t, &index);
 }
diff --git a/ltests.c b/ltests.c
index 90480097..8d712796 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
 /*
-** $Id: ltests.c,v 1.7 2000/02/08 16:34:31 roberto Exp roberto $
+** $Id: ltests.c,v 1.8 2000/02/21 18:30:06 roberto Exp roberto $
 ** Internal Module for Debugging of the Lua Implementation
 ** See Copyright Notice in lua.h
 */
@@ -39,7 +39,7 @@ static void mem_query (lua_State *L) {
 static void hash_query (lua_State *L) {
   lua_Object o = luaL_nonnullarg(L, 1);
   if (lua_getparam(L, 2) == LUA_NOOBJECT) {
-    luaL_arg_check(L, ttype(o) == LUA_T_STRING, 1, "string expected");
+    luaL_arg_check(L, ttype(o) == TAG_STRING, 1, "string expected");
     lua_pushnumber(L, tsvalue(o)->hash);
   }
   else {
@@ -75,7 +75,7 @@ static void query_strings (lua_State *L) {
     }
   }
   else {
-    TaggedString *ts = L->string_root[h].hash[s];
+    TString *ts = L->string_root[h].hash[s];
     for (ts = L->string_root[h].hash[s]; ts; ts = ts->nexthash) {
       if (ts->constindex == -1) lua_pushstring(L, "<USERDATA>");
       else lua_pushstring(L, ts->str);
diff --git a/ltm.c b/ltm.c
index 3a79d48b..6a73006e 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
 /*
-** $Id: ltm.c,v 1.32 2000/02/22 18:12:46 roberto Exp roberto $
+** $Id: ltm.c,v 1.33 2000/03/03 14:58:26 roberto Exp roberto $
 ** Tag methods
 ** See Copyright Notice in lua.h
 */
@@ -32,33 +32,33 @@ static int luaI_checkevent (lua_State *L, const char *name, const char *const li
 
 
 
-/* events in LUA_T_NIL are all allowed, since this is used as a
+/* events in TAG_NIL are all allowed, since this is used as a
 *  'placeholder' for "default" fallbacks
 */
 /* ORDER LUA_T, ORDER IM */
 static const char luaT_validevents[NUM_TAGS][IM_N] = {
-{1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1},  /* LUA_T_USERDATA */
-{1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1},  /* LUA_T_NUMBER */
-{1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},  /* LUA_T_STRING */
-{0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1},  /* LUA_T_ARRAY */
-{1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},  /* LUA_T_LPROTO */
-{1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},  /* LUA_T_CPROTO */
-{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}   /* LUA_T_NIL */
+{1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1},  /* TAG_USERDATA */
+{1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1},  /* TAG_NUMBER */
+{1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},  /* TAG_STRING */
+{0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1},  /* TAG_ARRAY */
+{1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},  /* TAG_LPROTO */
+{1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},  /* TAG_CPROTO */
+{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}   /* TAG_NIL */
 };
 
 int luaT_validevent (int t, int e) {  /* ORDER LUA_T */
 #ifdef LUA_COMPAT_GC
-  if (t == LUA_T_ARRAY && e == IM_GC)
+  if (t == TAG_ARRAY && e == IM_GC)
     return 1;  /* old versions allowed gc tag method for tables */
 #endif
-  return (t < LUA_T_NIL) ?  1 : luaT_validevents[-t][e];
+  return (t < TAG_NIL) ?  1 : luaT_validevents[-t][e];
 }
 
 
 static void init_entry (lua_State *L, int tag) {
   int i;
   for (i=0; i<IM_N; i++)
-    ttype(luaT_getim(L, tag, i)) = LUA_T_NIL;
+    ttype(luaT_getim(L, tag, i)) = TAG_NIL;
 }
 
 
@@ -85,7 +85,7 @@ static void checktag (lua_State *L, int tag) {
 }
 
 void luaT_realtag (lua_State *L, int tag) {
-  if (!(L->last_tag <= tag && tag < LUA_T_NIL))
+  if (!(L->last_tag <= tag && tag < TAG_NIL))
     luaL_verror(L, "tag %d was not created by `newtag'", tag);
 }
 
@@ -104,17 +104,17 @@ int lua_copytagmethods (lua_State *L, int tagto, int tagfrom) {
 
 int luaT_effectivetag (const TObject *o) {
   static const int realtag[] = {  /* ORDER LUA_T */
-    LUA_T_USERDATA, LUA_T_NUMBER, LUA_T_STRING, LUA_T_ARRAY,
-    LUA_T_LPROTO, LUA_T_CPROTO, LUA_T_NIL,
-    LUA_T_LPROTO, LUA_T_CPROTO,       /* LUA_T_LCLOSURE, LUA_T_CCLOSURE */
+    TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_ARRAY,
+    TAG_LPROTO, TAG_CPROTO, TAG_NIL,
+    TAG_LPROTO, TAG_CPROTO,       /* TAG_LCLOSURE, TAG_CCLOSURE */
   };
   int t;
   switch (t = ttype(o)) {
-    case LUA_T_USERDATA: {
+    case TAG_USERDATA: {
       int tag = o->value.ts->u.d.tag;
-      return (tag >= 0) ? LUA_T_USERDATA : tag;  /* deprecated test */
+      return (tag >= 0) ? TAG_USERDATA : tag;  /* deprecated test */
     }
-    case LUA_T_ARRAY:    return o->value.a->htag;
+    case TAG_ARRAY:    return o->value.a->htag;
     default:             return realtag[-t];
   }
 }
@@ -149,7 +149,7 @@ void luaT_settagmethod (lua_State *L, int t, const char *event, TObject *func) {
   if (!luaT_validevent(t, e))
     luaL_verror(L, "cannot change `%.20s' tag method for type `%.20s'%.20s",
                 luaT_eventname[e], luaO_typenames[-t],
-                (t == LUA_T_ARRAY || t == LUA_T_USERDATA) ? " with default tag"
+                (t == TAG_ARRAY || t == TAG_USERDATA) ? " with default tag"
                                                           : "");
   temp = *func;
   *func = *luaT_getim(L, t,e);
diff --git a/lundump.c b/lundump.c
index 7aa0a93d..3dd01ba4 100644
--- a/lundump.c
+++ b/lundump.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lundump.c,v 1.26 2000/02/17 19:17:44 lhf Exp lhf $
+** $Id: lundump.c,v 1.18 2000/03/03 14:58:26 roberto Exp roberto $
 ** load bytecodes from files
 ** See Copyright Notice in lua.h
 */
@@ -50,7 +50,7 @@ static unsigned long LoadLong (lua_State* L, ZIO* Z)
  return (hi<<16)|lo;
 }
 
-static real LoadNumber (lua_State* L, ZIO* Z)
+static Number LoadNumber (lua_State* L, ZIO* Z)
 {
  char b[256];
  int size=ezgetc(L,Z);
@@ -67,15 +67,15 @@ static int LoadInt (lua_State* L, ZIO* Z, const char* message)
  return i;
 }
 
-static void LoadCode (lua_State* L, TProtoFunc* tf, ZIO* Z)
+static void LoadCode (lua_State* L, Proto* tf, ZIO* Z)
 {
  int size=LoadInt(L,Z,"code too long (%lu bytes) in %.255s");
  tf->code=luaM_newvector(L,size,Instruction);
  LoadBlock(L,tf->code,size*sizeof(tf->code[0]),Z);
- if (tf->code[size-1]!=ENDCODE) luaL_verror(L,"bad code in %.255s",zname(Z));
+ if (tf->code[size-1]!=OP_END) luaL_verror(L,"bad code in %.255s",zname(Z));
 }
 
-static TaggedString* LoadString (lua_State* L, ZIO* Z)
+static TString* LoadString (lua_State* L, ZIO* Z)
 {
  long size=LoadLong(L,Z);
  if (size==0)
@@ -88,7 +88,7 @@ static TaggedString* LoadString (lua_State* L, ZIO* Z)
  }
 }
 
-static void LoadLocals (lua_State* L, TProtoFunc* tf, ZIO* Z)
+static void LoadLocals (lua_State* L, Proto* tf, ZIO* Z)
 {
  int i,n=LoadInt(L,Z,"too many locals (%lu) in %.255s");
  if (n==0) return;
@@ -102,21 +102,21 @@ static void LoadLocals (lua_State* L, TProtoFunc* tf, ZIO* Z)
  tf->locvars[i].varname=NULL;
 }
 
-static TProtoFunc* LoadFunction (lua_State* L, ZIO* Z, int native);
+static Proto* LoadFunction (lua_State* L, ZIO* Z, int native);
 
-static void LoadConstants (lua_State* L, TProtoFunc* tf, ZIO* Z, int native)
+static void LoadConstants (lua_State* L, Proto* tf, ZIO* Z, int native)
 {
  int i,n;
  tf->nkstr=n=LoadInt(L,Z,"too many strings (%lu) in %.255s");
  if (n>0)
  {
-  tf->kstr=luaM_newvector(L,n,TaggedString*);
+  tf->kstr=luaM_newvector(L,n,TString*);
   for (i=0; i<n; i++) tf->kstr[i]=LoadString(L,Z);
  }
  tf->nknum=n=LoadInt(L,Z,"too many numbers (%lu) in %.255s");
  if (n>0)
  {
-  tf->knum=luaM_newvector(L,n,real);
+  tf->knum=luaM_newvector(L,n,Number);
   if (native)
    LoadBlock(L,tf->knum,n*sizeof(tf->knum[0]),Z);
   else
@@ -125,14 +125,14 @@ static void LoadConstants (lua_State* L, TProtoFunc* tf, ZIO* Z, int native)
  tf->nkproto=n=LoadInt(L,Z,"too many functions (%lu) in %.255s");
  if (n>0)
  {
-  tf->kproto=luaM_newvector(L,n,TProtoFunc*);
+  tf->kproto=luaM_newvector(L,n,Proto*);
   for (i=0; i<n; i++) tf->kproto[i]=LoadFunction(L,Z,native);
  }
 }
 
-static TProtoFunc* LoadFunction (lua_State* L, ZIO* Z, int native)
+static Proto* LoadFunction (lua_State* L, ZIO* Z, int native)
 {
- TProtoFunc* tf=luaF_newproto(L);
+ Proto* tf=luaF_newproto(L);
  tf->lineDefined=LoadInt(L,Z,"lineDefined too large (%lu) in %.255s");
  tf->source=LoadString(L,Z);
  if (tf->source==NULL) tf->source=luaS_new(L,zname(Z));
@@ -172,12 +172,12 @@ static int LoadHeader (lua_State* L, ZIO* Z)
  native=(sizeofR!=0);
  if (native)				/* test number representation */
  {
-  if (sizeofR!=sizeof(real))
+  if (sizeofR!=sizeof(Number))
    luaL_verror(L,"unknown number size in %.255s: read %d; expected %d",
-	 zname(Z),sizeofR,(int)sizeof(real));
+	 zname(Z),sizeofR,(int)sizeof(Number));
   else
   {
-   real f=0,tf=TEST_NUMBER;
+   Number f=0,tf=TEST_NUMBER;
    LoadBlock(L,&f,sizeof(f),Z);
    if ((long)f!=(long)tf)		/* disregard errors in last bit of fraction */
     luaL_verror(L,"unknown number format in %.255s: "
@@ -188,7 +188,7 @@ static int LoadHeader (lua_State* L, ZIO* Z)
  return native;
 }
 
-static TProtoFunc* LoadChunk (lua_State* L, ZIO* Z)
+static Proto* LoadChunk (lua_State* L, ZIO* Z)
 {
  return LoadFunction(L,Z,LoadHeader(L,Z));
 }
@@ -197,7 +197,7 @@ static TProtoFunc* LoadChunk (lua_State* L, ZIO* Z)
 ** load one chunk from a file or buffer
 ** return main if ok and NULL at EOF
 */
-TProtoFunc* luaU_undump1 (lua_State* L, ZIO* Z)
+Proto* luaU_undump1 (lua_State* L, ZIO* Z)
 {
  int c=zgetc(Z);
  if (c==ID_CHUNK)
diff --git a/lundump.h b/lundump.h
index 4c582ad5..b3171a80 100644
--- a/lundump.h
+++ b/lundump.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lundump.h,v 1.18 2000/01/28 17:51:09 lhf Exp $
+** $Id: lundump.h,v 1.13 2000/03/03 14:58:26 roberto Exp roberto $
 ** load pre-compiled Lua chunks
 ** See Copyright Notice in lua.h
 */
@@ -11,11 +11,11 @@
 #include "lzio.h"
 
 /* load one chunk */
-TProtoFunc* luaU_undump1 (lua_State* L, ZIO* Z);
+Proto* luaU_undump1 (lua_State* L, ZIO* Z);
 
 /* handle cases that cannot happen */
 void luaU_badconstant (lua_State* L, const char* s, int i,
-			const TObject* o, const TProtoFunc* tf);
+			const TObject* o, const Proto* tf);
 
 /* convert number from text */
 double luaU_str2d (lua_State* L, const char* b, const char* where);
diff --git a/lvm.c b/lvm.c
index 71a97d83..62a24064 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lvm.c,v 1.93 2000/03/09 13:57:37 roberto Exp roberto $
+** $Id: lvm.c,v 1.94 2000/03/10 14:38:10 roberto Exp roberto $
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -33,32 +33,32 @@
 
 /*
 ** Extra stack size to run a function:
-** LUA_T_LINE(1), NAME(1), TM calls(3) (plus some extra...)
+** TAG_LINE(1), NAME(1), TM calls(3) (plus some extra...)
 */
 #define	EXTRA_STACK	8
 
 
 
 int luaV_tonumber (TObject *obj) {  /* LUA_NUMBER */
-  if (ttype(obj) != LUA_T_STRING)
+  if (ttype(obj) != TAG_STRING)
     return 1;
   else {
     if (!luaO_str2d(svalue(obj), &nvalue(obj)))
       return 2;
-    ttype(obj) = LUA_T_NUMBER;
+    ttype(obj) = TAG_NUMBER;
     return 0;
   }
 }
 
 
 int luaV_tostring (lua_State *L, TObject *obj) {  /* LUA_NUMBER */
-  if (ttype(obj) != LUA_T_NUMBER)
+  if (ttype(obj) != TAG_NUMBER)
     return 1;
   else {
     char s[32];  /* 16 digits, sign, point and \0  (+ some extra...) */
     sprintf(s, "%.16g", (double)nvalue(obj));
     tsvalue(obj) = luaS_new(L, s);
-    ttype(obj) = LUA_T_STRING;
+    ttype(obj) = TAG_STRING;
     return 0;
   }
 }
@@ -66,8 +66,8 @@ int luaV_tostring (lua_State *L, TObject *obj) {  /* LUA_NUMBER */
 
 void luaV_setn (lua_State *L, Hash *t, int val) {
   TObject index, value;
-  ttype(&index) = LUA_T_STRING; tsvalue(&index) = luaS_new(L, "n");
-  ttype(&value) = LUA_T_NUMBER; nvalue(&value) = val;
+  ttype(&index) = TAG_STRING; tsvalue(&index) = luaS_new(L, "n");
+  ttype(&value) = TAG_NUMBER; nvalue(&value) = val;
   luaH_set(L, t, &index, &value);
 }
 
@@ -79,8 +79,8 @@ void luaV_closure (lua_State *L, int nelems) {
     L->top -= nelems;
     while (nelems--)
       c->consts[nelems+1] = *(L->top-1+nelems);
-    ttype(L->top-1) = (ttype(&c->consts[0]) == LUA_T_CPROTO) ?
-                        LUA_T_CCLOSURE : LUA_T_LCLOSURE;
+    ttype(L->top-1) = (ttype(&c->consts[0]) == TAG_CPROTO) ?
+                        TAG_CCLOSURE : TAG_LCLOSURE;
     (L->top-1)->value.cl = c;
   }
 }
@@ -93,9 +93,9 @@ void luaV_closure (lua_State *L, int nelems) {
 void luaV_gettable (lua_State *L, StkId top) {
   TObject *table = top-2;
   const TObject *im;
-  if (ttype(table) != LUA_T_ARRAY) {  /* not a table, get gettable TM */
+  if (ttype(table) != TAG_ARRAY) {  /* not a table, get gettable TM */
     im = luaT_getimbyObj(L, table, IM_GETTABLE);
-    if (ttype(im) == LUA_T_NIL) {
+    if (ttype(im) == TAG_NIL) {
       L->top = top;
       luaG_indexerror(L, table);
     }
@@ -103,10 +103,10 @@ void luaV_gettable (lua_State *L, StkId top) {
   else {  /* object is a table... */
     int tg = table->value.a->htag;
     im = luaT_getim(L, tg, IM_GETTABLE);
-    if (ttype(im) == LUA_T_NIL) {  /* and does not have a `gettable' TM */
+    if (ttype(im) == TAG_NIL) {  /* and does not have a `gettable' TM */
       const TObject *h = luaH_get(L, avalue(table), table+1);
-      if (ttype(h) == LUA_T_NIL &&
-          (ttype(im=luaT_getim(L, tg, IM_INDEX)) != LUA_T_NIL)) {
+      if (ttype(h) == TAG_NIL &&
+          (ttype(im=luaT_getim(L, tg, IM_INDEX)) != TAG_NIL)) {
         /* result is nil and there is an `index' tag method */
         L->top = top;
         luaD_callTM(L, im, 2, 1);  /* calls it */
@@ -128,15 +128,15 @@ void luaV_gettable (lua_State *L, StkId top) {
 */
 void luaV_settable (lua_State *L, StkId t, StkId top) {
   const TObject *im;
-  if (ttype(t) != LUA_T_ARRAY) {  /* not a table, get `settable' method */
+  if (ttype(t) != TAG_ARRAY) {  /* not a table, get `settable' method */
     L->top = top;
     im = luaT_getimbyObj(L, t, IM_SETTABLE);
-    if (ttype(im) == LUA_T_NIL)
+    if (ttype(im) == TAG_NIL)
       luaG_indexerror(L, t);
   }
   else {  /* object is a table... */
     im = luaT_getim(L, avalue(t)->htag, IM_SETTABLE);
-    if (ttype(im) == LUA_T_NIL) {  /* and does not have a `settable' method */
+    if (ttype(im) == TAG_NIL) {  /* and does not have a `settable' method */
       luaH_set(L, avalue(t), t+1, top-1);
       return;
     }
@@ -155,7 +155,7 @@ void luaV_settable (lua_State *L, StkId t, StkId top) {
 
 
 void luaV_rawsettable (lua_State *L, StkId t) {
-  if (ttype(t) != LUA_T_ARRAY)
+  if (ttype(t) != TAG_ARRAY)
     lua_error(L, "indexed expression not a table");
   else {
     luaH_set(L, avalue(t), t+1, L->top-1);
@@ -167,12 +167,12 @@ void luaV_rawsettable (lua_State *L, StkId t) {
 void luaV_getglobal (lua_State *L, GlobalVar *gv, StkId top) {
   const TObject *value = &gv->value;
   TObject *im = luaT_getimbyObj(L, value, IM_GETGLOBAL);
-  if (ttype(im) == LUA_T_NIL)  /* is there a tag method? */
+  if (ttype(im) == TAG_NIL)  /* is there a tag method? */
     *top = *value;  /* default behavior */
   else {  /* tag method */
     luaD_checkstack(L, 3);
     *top = *im;
-    ttype(top+1) = LUA_T_STRING;
+    ttype(top+1) = TAG_STRING;
     tsvalue(top+1) = gv->name;  /* global name */
     *(top+2) = *value;
     L->top = top+3;
@@ -184,13 +184,13 @@ void luaV_getglobal (lua_State *L, GlobalVar *gv, StkId top) {
 void luaV_setglobal (lua_State *L, GlobalVar *gv, StkId top) {
   const TObject *oldvalue = &gv->value;
   const TObject *im = luaT_getimbyObj(L, oldvalue, IM_SETGLOBAL);
-  if (ttype(im) == LUA_T_NIL)  /* is there a tag method? */
+  if (ttype(im) == TAG_NIL)  /* is there a tag method? */
     gv->value = *(top-1);
   else {
     luaD_checkstack(L, 3);
     *(top+2) = *(top-1);  /* new value */
     *(top+1) = *oldvalue;
-    ttype(top) = LUA_T_STRING;
+    ttype(top) = TAG_STRING;
     tsvalue(top) = gv->name;
     *(top-1) = *im;
     L->top = top+3;
@@ -203,11 +203,11 @@ static void call_binTM (lua_State *L, StkId top, IMS event, const char *msg) {
   /* try first operand */
   const TObject *im = luaT_getimbyObj(L, top-2, event);
   L->top = top;
-  if (ttype(im) == LUA_T_NIL) {
+  if (ttype(im) == TAG_NIL) {
     im = luaT_getimbyObj(L, top-1, event);  /* try second operand */
-    if (ttype(im) == LUA_T_NIL) {
+    if (ttype(im) == TAG_NIL) {
       im = luaT_getim(L, 0, event);  /* try a `global' method */
-      if (ttype(im) == LUA_T_NIL)
+      if (ttype(im) == TAG_NIL)
         lua_error(L, msg);
     }
   }
@@ -221,7 +221,7 @@ static void call_arith (lua_State *L, StkId top, IMS event) {
 }
 
 
-static int luaV_strcomp (const TaggedString *ls, const TaggedString *rs) {
+static int luaV_strcomp (const TString *ls, const TString *rs) {
   const char *l = ls->str;
   long ll = ls->u.s.len;
   const char *r = rs->str;
@@ -243,9 +243,9 @@ static int luaV_strcomp (const TaggedString *ls, const TaggedString *rs) {
 
 
 int luaV_lessthan (lua_State *L, const TObject *l, const TObject *r, StkId top) {
-  if (ttype(l) == LUA_T_NUMBER && ttype(r) == LUA_T_NUMBER)
+  if (ttype(l) == TAG_NUMBER && ttype(r) == TAG_NUMBER)
     return (nvalue(l) < nvalue(r));
-  else if (ttype(l) == LUA_T_STRING && ttype(r) == LUA_T_STRING)
+  else if (ttype(l) == TAG_STRING && ttype(r) == TAG_STRING)
     return (luaV_strcomp(tsvalue(l), tsvalue(r)) < 0);
   else {  /* call TM */
     luaD_checkstack(L, 2);
@@ -253,14 +253,14 @@ int luaV_lessthan (lua_State *L, const TObject *l, const TObject *r, StkId top)
     *top++ = *r;
     call_binTM(L, top, IM_LT, "unexpected type in comparison");
     L->top--;
-    return (ttype(L->top) != LUA_T_NIL);
+    return (ttype(L->top) != TAG_NIL);
   }
 }
 
 
 #define setbool(o,cond) if (cond) { \
-                             ttype(o) = LUA_T_NUMBER; nvalue(o) = 1.0; } \
-                        else ttype(o) = LUA_T_NIL
+                             ttype(o) = TAG_NUMBER; nvalue(o) = 1.0; } \
+                        else ttype(o) = TAG_NIL
 
 
 static void strconc (lua_State *L, int total, StkId top) {
@@ -295,7 +295,7 @@ void luaV_pack (lua_State *L, StkId firstelem, int nvararg, TObject *tab) {
   int i;
   Hash *htab;
   htab = avalue(tab) = luaH_new(L, nvararg+1);  /* +1 for field `n' */
-  ttype(tab) = LUA_T_ARRAY;
+  ttype(tab) = TAG_ARRAY;
   for (i=0; i<nvararg; i++)
     luaH_setint(L, htab, i+1, firstelem+i);
   luaV_setn(L, htab, nvararg);  /* store counter in field `n' */
@@ -321,11 +321,11 @@ static void adjust_varargs (lua_State *L, StkId base, int nfixargs) {
 ** Executes the given Lua function. Parameters are between [base,top).
 ** Returns n such that the the results are between [n,top).
 */
-StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
+StkId luaV_execute (lua_State *L, const Closure *cl, const Proto *tf,
                     register StkId base) {
   register StkId top;  /* keep top local, for performance */
   register const Instruction *pc = tf->code;
-  TaggedString **kstr = tf->kstr;
+  TString **kstr = tf->kstr;
   if (L->callhook)
     luaD_callHook(L, base-1, L->callhook, "call");
   luaD_checkstack(L, tf->maxstacksize+EXTRA_STACK);
@@ -340,124 +340,124 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
     register Instruction i = *pc++;
     switch (GET_OPCODE(i)) {
 
-      case ENDCODE:
+      case OP_END:
         return L->top;  /* no results */
 
-      case RETCODE:
+      case OP_RETURN:
         L->top = top;
         return base+GETARG_U(i);
 
-      case CALL:
+      case OP_CALL:
         L->top = top;
         luaD_call(L, base+GETARG_A(i), GETARG_B(i));
         top = L->top;
         break;
 
-      case TAILCALL:
+      case OP_TAILCALL:
         L->top = top;
         luaD_call(L, base+GETARG_A(i), MULT_RET);
         return base+GETARG_B(i);
 
-      case PUSHNIL: {
+      case OP_PUSHNIL: {
         int n = GETARG_U(i);
         LUA_ASSERT(L, n>0, "invalid argument");
 		do {
-          ttype(top++) = LUA_T_NIL;
+          ttype(top++) = TAG_NIL;
 		} while (--n > 0);
         break;
       }
 
-      case POP:
+      case OP_POP:
         top -= GETARG_U(i);
         break;
 
-      case PUSHINT:
-        ttype(top) = LUA_T_NUMBER;
-        nvalue(top) = (real)GETARG_S(i);
+      case OP_PUSHINT:
+        ttype(top) = TAG_NUMBER;
+        nvalue(top) = (Number)GETARG_S(i);
         top++;
         break;
 
-      case PUSHSTRING:
-        ttype(top) = LUA_T_STRING;
+      case OP_PUSHSTRING:
+        ttype(top) = TAG_STRING;
         tsvalue(top) = kstr[GETARG_U(i)];
         top++;
         break;
 
-      case PUSHNUM:
-        ttype(top) = LUA_T_NUMBER;
+      case OP_PUSHNUM:
+        ttype(top) = TAG_NUMBER;
         nvalue(top) = tf->knum[GETARG_U(i)];
         top++;
         break;
 
-      case PUSHNEGNUM:
-        ttype(top) = LUA_T_NUMBER;
+      case OP_PUSHNEGNUM:
+        ttype(top) = TAG_NUMBER;
         nvalue(top) = -tf->knum[GETARG_U(i)];
         top++;
         break;
 
-      case PUSHUPVALUE:
+      case OP_PUSHUPVALUE:
         *top++ = cl->consts[GETARG_U(i)+1];
         break;
 
-      case PUSHLOCAL:
+      case OP_PUSHLOCAL:
         *top++ = *(base+GETARG_U(i));
         break;
 
-      case GETGLOBAL:
+      case OP_GETGLOBAL:
         luaV_getglobal(L, kstr[GETARG_U(i)]->u.s.gv, top);
         top++;
         break;
 
-      case GETTABLE:
+      case OP_GETTABLE:
         luaV_gettable(L, top);
         top--;
         break;
 
-      case GETDOTTED:
-        ttype(top) = LUA_T_STRING;
+      case OP_GETDOTTED:
+        ttype(top) = TAG_STRING;
         tsvalue(top++) = kstr[GETARG_U(i)];
         luaV_gettable(L, top);
         top--;
         break;
 
-      case PUSHSELF: {
+      case OP_PUSHSELF: {
         TObject receiver;
         receiver = *(top-1);
-        ttype(top) = LUA_T_STRING;
+        ttype(top) = TAG_STRING;
         tsvalue(top++) = kstr[GETARG_U(i)];
         luaV_gettable(L, top);
         *(top-1) = receiver;
         break;
       }
 
-      case CREATETABLE:
+      case OP_CREATETABLE:
         L->top = top;
         luaC_checkGC(L);
         avalue(top) = luaH_new(L, GETARG_U(i));
-        ttype(top) = LUA_T_ARRAY;
+        ttype(top) = TAG_ARRAY;
         top++;
         break;
 
-      case SETLOCAL:
+      case OP_SETLOCAL:
         *(base+GETARG_U(i)) = *(--top);
         break;
 
-      case SETGLOBAL:
+      case OP_SETGLOBAL:
         luaV_setglobal(L, kstr[GETARG_U(i)]->u.s.gv, top);
         top--;
         break;
 
-      case SETTABLEPOP:
+      case OP_SETTABLEPOP:
         luaV_settable(L, top-3, top);
         top -= 3;  /* pop table, index, and value */
         break;
 
-      case SETTABLE:
+      case OP_SETTABLE:
         luaV_settable(L, top-3-GETARG_U(i), top);
         top--;  /* pop value */
         break;
 
-      case SETLIST: {
+      case OP_SETLIST: {
         int aux = GETARG_A(i) * LFIELDS_PER_FLUSH;
         int n = GETARG_B(i)+1;
         Hash *arr = avalue(top-n-1);
@@ -467,7 +467,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
         break;
       }
 
-      case SETMAP: {
+      case OP_SETMAP: {
         int n = GETARG_U(i);
         StkId finaltop = top-2*(n+1);
         Hash *arr = avalue(finaltop-1);
@@ -479,7 +479,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
         break;
       }
 
-      case ADDOP:
+      case OP_ADD:
         if (tonumber(top-1) || tonumber(top-2))
           call_arith(L, top, IM_ADD);
         else
@@ -487,17 +487,17 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
         top--;
         break;
 
-      case ADDI:
+      case OP_ADDI:
         if (tonumber(top-1)) {
-          ttype(top) = LUA_T_NUMBER;
-          nvalue(top) = (real)GETARG_S(i);
+          ttype(top) = TAG_NUMBER;
+          nvalue(top) = (Number)GETARG_S(i);
           call_arith(L, top+1, IM_ADD);
         }
         else
-          nvalue(top-1) += (real)GETARG_S(i);
+          nvalue(top-1) += (Number)GETARG_S(i);
         break;
 
-      case SUBOP:
+      case OP_SUB:
         if (tonumber(top-1) || tonumber(top-2))
           call_arith(L, top, IM_SUB);
         else
@@ -505,7 +505,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
         top--;
         break;
 
-      case MULTOP:
+      case OP_MULT:
         if (tonumber(top-1) || tonumber(top-2))
           call_arith(L, top, IM_MUL);
         else
@@ -513,7 +513,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
         top--;
         break;
 
-      case DIVOP:
+      case OP_DIV:
         if (tonumber(top-1) || tonumber(top-2))
           call_arith(L, top, IM_DIV);
         else
@@ -521,12 +521,12 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
         top--;
         break;
 
-      case POWOP:
+      case OP_POW:
         call_binTM(L, top, IM_POW, "undefined operation");
         top--;
         break;
 
-      case CONCOP: {
+      case OP_CONC: {
         int n = GETARG_U(i);
         strconc(L, n, top);
         top -= n-1;
@@ -535,80 +535,80 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
         break;
       }
 
-      case MINUSOP:
+      case OP_MINUS:
         if (tonumber(top-1)) {
-          ttype(top) = LUA_T_NIL;
+          ttype(top) = TAG_NIL;
           call_arith(L, top+1, IM_UNM);
         }
         else
           nvalue(top-1) = -nvalue(top-1);
         break;
 
-      case NOTOP:
+      case OP_NOT:
         ttype(top-1) =
-           (ttype(top-1) == LUA_T_NIL) ? LUA_T_NUMBER : LUA_T_NIL;
+           (ttype(top-1) == TAG_NIL) ? TAG_NUMBER : TAG_NIL;
         nvalue(top-1) = 1;
         break;
 
-      case IFNEQJMP:
+      case OP_IFNEQJMP:
         top -= 2;
         if (!luaO_equalObj(top, top+1)) pc += GETARG_S(i);
         break;
 
-      case IFEQJMP:
+      case OP_IFEQJMP:
         top -= 2;
         if (luaO_equalObj(top, top+1)) pc += GETARG_S(i);
         break;
 
-      case IFLTJMP:
+      case OP_IFLTJMP:
         top -= 2;
         if (luaV_lessthan(L, top, top+1, top+2)) pc += GETARG_S(i);
         break;
 
-      case IFLEJMP:  /* a <= b  ===  !(b<a) */
+      case OP_IFLEJMP:  /* a <= b  ===  !(b<a) */
         top -= 2;
         if (!luaV_lessthan(L, top+1, top, top+2)) pc += GETARG_S(i);
         break;
 
-      case IFGTJMP:  /* a > b  ===  (b<a) */
+      case OP_IFGTJMP:  /* a > b  ===  (b<a) */
         top -= 2;
         if (luaV_lessthan(L, top+1, top, top+2)) pc += GETARG_S(i);
         break;
 
-      case IFGEJMP:  /* a >= b  ===  !(a<b) */
+      case OP_IFGEJMP:  /* a >= b  ===  !(a<b) */
         top -= 2;
         if (!luaV_lessthan(L, top, top+1, top+2)) pc += GETARG_S(i);
         break;
 
-      case IFTJMP:
-        if (ttype(--top) != LUA_T_NIL) pc += GETARG_S(i);
+      case OP_IFTJMP:
+        if (ttype(--top) != TAG_NIL) pc += GETARG_S(i);
         break;
 
-      case IFFJMP:
-        if (ttype(--top) == LUA_T_NIL) pc += GETARG_S(i);
+      case OP_IFFJMP:
+        if (ttype(--top) == TAG_NIL) pc += GETARG_S(i);
         break;
 
-      case ONTJMP:
-        if (ttype(top-1) != LUA_T_NIL) pc += GETARG_S(i);
+      case OP_ONTJMP:
+        if (ttype(top-1) != TAG_NIL) pc += GETARG_S(i);
         else top--;
         break;
 
-      case ONFJMP:
-        if (ttype(top-1) == LUA_T_NIL) pc += GETARG_S(i);
+      case OP_ONFJMP:
+        if (ttype(top-1) == TAG_NIL) pc += GETARG_S(i);
         else top--;
         break;
 
-      case JMP:
+      case OP_JMP:
         pc += GETARG_S(i);
         break;
 
-      case PUSHNILJMP:
-        ttype(top++) = LUA_T_NIL;
+      case OP_PUSHNILJMP:
+        ttype(top++) = TAG_NIL;
         pc++;
         break;
 
-      case CLOSURE:
-        ttype(top) = LUA_T_LPROTO;
+      case OP_CLOSURE:
+        ttype(top) = TAG_LPROTO;
         tfvalue(top) = tf->kproto[GETARG_A(i)];
         L->top = ++top;
         luaV_closure(L, GETARG_B(i));
@@ -616,14 +616,14 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf,
         luaC_checkGC(L);
         break;
 
-      case SETLINE:
-        if ((base-1)->ttype != LUA_T_LINE) {
+      case OP_SETLINE:
+        if ((base-1)->ttype != TAG_LINE) {
           /* open space for LINE value */
           int n = top-base;
           while (n--) base[n+1] = base[n];
           base++;
           top++;
-          (base-1)->ttype = LUA_T_LINE;
+          (base-1)->ttype = TAG_LINE;
         }
         (base-1)->value.i = GETARG_U(i);
         if (L->linehook) {
diff --git a/lvm.h b/lvm.h
index b3033200..1a733a44 100644
--- a/lvm.h
+++ b/lvm.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lvm.h,v 1.17 2000/03/03 14:58:26 roberto Exp $
+** $Id: lvm.h,v 1.18 2000/03/09 00:19:22 roberto Exp roberto $
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -13,8 +13,8 @@
 #include "ltm.h"
 
 
-#define tonumber(o)   ((ttype(o) != LUA_T_NUMBER) && (luaV_tonumber(o) != 0))
-#define tostring(L,o) ((ttype(o) != LUA_T_STRING) && (luaV_tostring(L, o) != 0))
+#define tonumber(o)   ((ttype(o) != TAG_NUMBER) && (luaV_tonumber(o) != 0))
+#define tostring(L,o) ((ttype(o) != TAG_STRING) && (luaV_tostring(L, o) != 0))
 
 
 void luaV_pack (lua_State *L, StkId firstel, int nvararg, TObject *tab);
@@ -26,7 +26,7 @@ void luaV_settable (lua_State *L, StkId t, StkId top);
 void luaV_rawsettable (lua_State *L, StkId t);
 void luaV_getglobal (lua_State *L, GlobalVar *gv, StkId top);
 void luaV_setglobal (lua_State *L, GlobalVar *gv, StkId top);
-StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, StkId base);
+StkId luaV_execute (lua_State *L, const Closure *cl, const Proto *tf, StkId base);
 void luaV_closure (lua_State *L, int nelems);
 int luaV_lessthan (lua_State *L, const TObject *l, const TObject *r, StkId top);
 
-- 
cgit v1.2.3-55-g6feb