From 1f691a4fcd32b706c79e4c8cbff17c6ae985bc34 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 28 Jan 2000 14:53:00 -0200 Subject: renaming of some opcodes and fields --- ldebug.c | 4 ++-- lfunc.c | 20 ++++++++++---------- lgc.c | 10 +++++----- lobject.h | 14 +++++++------- lopcodes.h | 18 +++++++++--------- lparser.c | 58 +++++++++++++++++++++++++++++----------------------------- lvm.c | 34 +++++++++++++++++----------------- 7 files changed, 79 insertions(+), 79 deletions(-) diff --git a/ldebug.c b/ldebug.c index 48694847..a28b8ff9 100644 --- a/ldebug.c +++ b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 1.5 2000/01/19 12:00:45 roberto Exp roberto $ +** $Id: ldebug.c,v 1.6 2000/01/25 13:57:18 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -94,7 +94,7 @@ static const char *luaG_getname (lua_State *L, const char **name, StkId top) { if (ttype(f) == LUA_T_LCLMARK) f = protovalue(f); LUA_ASSERT(L, ttype(f) == LUA_T_LMARK, "must be a Lua function"); - *name = tfvalue(f)->strcnst[i]->str; + *name = tfvalue(f)->kstr[i]->str; return luaO_typename(f+2); } } diff --git a/lfunc.c b/lfunc.c index 65d99d9d..c2ea14f4 100644 --- a/lfunc.c +++ b/lfunc.c @@ -1,5 +1,5 @@ /* -** $Id: lfunc.c,v 1.16 1999/12/27 17:33:22 roberto Exp roberto $ +** $Id: lfunc.c,v 1.17 2000/01/25 13:57:18 roberto Exp roberto $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ @@ -34,12 +34,12 @@ TProtoFunc *luaF_newproto (lua_State *L) { f->code = NULL; f->lineDefined = 0; f->source = NULL; - f->strcnst = NULL; - f->nstrcnst = 0; - f->numcnst = NULL; - f->nnumcnst = 0; - f->protocnst = NULL; - f->nprotocnst = 0; + f->kstr = NULL; + f->nkstr = 0; + f->knum = NULL; + f->nknum = 0; + f->kproto = NULL; + f->nkproto = 0; f->locvars = NULL; f->next = L->rootproto; L->rootproto = f; @@ -53,9 +53,9 @@ void luaF_freeproto (lua_State *L, TProtoFunc *f) { L->nblocks -= gcsizeproto(L, f); luaM_free(L, f->code); luaM_free(L, f->locvars); - luaM_free(L, f->strcnst); - luaM_free(L, f->numcnst); - luaM_free(L, f->protocnst); + luaM_free(L, f->kstr); + luaM_free(L, f->knum); + luaM_free(L, f->kproto); luaM_free(L, f); } diff --git a/lgc.c b/lgc.c index 0dda7d8d..4fbe7230 100644 --- a/lgc.c +++ b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 1.39 1999/12/27 17:33:22 roberto Exp roberto $ +** $Id: lgc.c,v 1.40 2000/01/25 13:57:18 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -33,10 +33,10 @@ static void protomark (lua_State *L, TProtoFunc *f) { int i; f->marked = 1; strmark(L, f->source); - for (i=f->nstrcnst-1; i>=0; i--) - strmark(L, f->strcnst[i]); - for (i=f->nprotocnst-1; i>=0; i--) - protomark(L, f->protocnst[i]); + for (i=f->nkstr-1; i>=0; i--) + strmark(L, f->kstr[i]); + for (i=f->nkproto-1; i>=0; i--) + protomark(L, f->kproto[i]); } } diff --git a/lobject.h b/lobject.h index 0c2253f3..aeaac517 100644 --- a/lobject.h +++ b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 1.43 1999/12/29 16:31:15 roberto Exp roberto $ +** $Id: lobject.h,v 1.44 2000/01/25 13:57:18 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -154,12 +154,12 @@ typedef struct TaggedString { typedef struct TProtoFunc { struct TProtoFunc *next; int marked; - struct TaggedString **strcnst; - int nstrcnst; - real *numcnst; - int nnumcnst; - struct TProtoFunc **protocnst; - int nprotocnst; + struct TaggedString **kstr; /* strings used by the function */ + int nkstr; /* size of `kstr' */ + real *knum; /* real numbers used by the function */ + int nknum; /* size of `knum' */ + struct TProtoFunc **kproto; /* functions defined inside the function */ + int nkproto; /* size of `kproto' */ Byte *code; /* ends with opcode ENDCODE */ int lineDefined; TaggedString *source; diff --git a/lopcodes.h b/lopcodes.h index 27417410..c1ab4092 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.36 1999/12/29 16:31:15 roberto Exp roberto $ +** $Id: lopcodes.h,v 1.37 2000/01/25 13:57:18 roberto Exp roberto $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -27,16 +27,16 @@ TAILCALL,/* b c v_c-v_1 f (return) f(v1,...,v_c) */ PUSHNIL,/* b - nil_0-nil_b */ POP,/* b a_b-a_1 - */ -PUSHNUMBERW,/* w - (float)w */ -PUSHNUMBER,/* b - (float)b */ +PUSHINTW,/* w - (float)w */ +PUSHINT,/* b - (float)b */ -PUSHNUMBERNEGW,/* w - (float)-w */ -PUSHNUMBERNEG,/* b - (float)-b */ +PUSHINTNEGW,/* w - (float)-w */ +PUSHINTNEG,/* b - (float)-b */ -PUSHSTRCNSTW,/* w - STRCNST[w] */ -PUSHSTRCNST,/* b - STRCNST[b] */ -PUSHNUMCNSTW,/* w - NUMCNST[w] */ -PUSHNUMCNST,/* b - NUMCNST[b] */ +PUSHSTRINGW,/* w - KSTR[w] */ +PUSHSTRING,/* b - KSTR[b] */ +PUSHNUMBERW,/* w - KNUM[w] */ +PUSHNUMBER,/* b - KNUM[b] */ PUSHUPVALUE,/* b - Closure[b] */ diff --git a/lparser.c b/lparser.c index ec655a99..7c702a4d 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 1.55 2000/01/25 13:57:18 roberto Exp roberto $ +** $Id: lparser.c,v 1.56 2000/01/25 18:44:21 roberto Exp roberto $ ** LL(1) Parser and code generator for Lua ** See Copyright Notice in lua.h */ @@ -150,7 +150,7 @@ static void deltastack (LexState *ls, int delta) { fs->stacksize += delta; if (fs->stacksize > fs->maxstacksize) { if (fs->stacksize > MAX_BYTE) - luaY_error(ls, "function/expression too complex"); + luaY_error(ls, "function or expression too complex"); fs->maxstacksize = fs->stacksize; } } @@ -214,24 +214,24 @@ static void code_opcode (LexState *ls, OpCode op, int delta) { } -static void code_strcnst (LexState *ls, int c) { - code_oparg(ls, PUSHSTRCNST, c, 1); +static void code_kstr (LexState *ls, int c) { + code_oparg(ls, PUSHSTRING, c, 1); } static void assertglobal (LexState *ls, int index) { - luaS_assertglobal(ls->L, ls->fs->f->strcnst[index]); + luaS_assertglobal(ls->L, ls->fs->f->kstr[index]); } static int string_constant (LexState *ls, FuncState *fs, TaggedString *s) { TProtoFunc *f = fs->f; int c = s->constindex; - if (c >= f->nstrcnst || f->strcnst[c] != s) { - luaM_growvector(ls->L, f->strcnst, f->nstrcnst, 1, + if (c >= f->nkstr || f->kstr[c] != s) { + luaM_growvector(ls->L, f->kstr, f->nkstr, 1, TaggedString *, constantEM, MAX_ARG); - c = f->nstrcnst++; - f->strcnst[c] = s; + c = f->nkstr++; + f->kstr[c] = s; s->constindex = c; /* hint for next time */ } return c; @@ -239,7 +239,7 @@ static int string_constant (LexState *ls, FuncState *fs, TaggedString *s) { static void code_string (LexState *ls, TaggedString *s) { - code_strcnst(ls, string_constant(ls, ls->fs, s)); + code_kstr(ls, string_constant(ls, ls->fs, s)); } @@ -247,15 +247,15 @@ static void code_string (LexState *ls, TaggedString *s) { static int real_constant (LexState *ls, real r) { /* check whether `r' has appeared within the last LIM entries */ TProtoFunc *f = ls->fs->f; - int c = f->nnumcnst; + int c = f->nknum; int lim = c < LIM ? 0 : c-LIM; while (--c >= lim) - if (f->numcnst[c] == r) return c; + if (f->knum[c] == r) return c; /* not found; create a new entry */ - luaM_growvector(ls->L, f->numcnst, f->nnumcnst, 1, + luaM_growvector(ls->L, f->knum, f->nknum, 1, real, constantEM, MAX_ARG); - c = f->nnumcnst++; - f->numcnst[c] = r; + c = f->nknum++; + f->knum[c] = r; return c; } @@ -264,10 +264,10 @@ static void code_number (LexState *ls, real f) { real af = (f<0) ? -f : f; if (0 <= af && af <= (real)MAX_WORD && (int)af == af) { /* abs(f) has a short integer value */ - code_oparg(ls, (f<0) ? PUSHNUMBERNEG : PUSHNUMBER, (int)af, 1); + code_oparg(ls, (f<0) ? PUSHINTNEG : PUSHINT, (int)af, 1); } else - code_oparg(ls, PUSHNUMCNST, real_constant(ls, f), 1); + code_oparg(ls, PUSHNUMBER, real_constant(ls, f), 1); } @@ -469,7 +469,7 @@ static void code_args (LexState *ls, int nparams, int dots) { static void unloaddot (LexState *ls, vardesc *v) { /* dotted variables must be stored as regular indexed vars */ if (v->k == VDOT) { - code_strcnst(ls, v->info); + code_kstr(ls, v->info); v->k = VINDEXED; } } @@ -551,13 +551,13 @@ static void func_onstack (LexState *ls, FuncState *func) { FuncState *fs = ls->fs; TProtoFunc *f = fs->f; int i; - luaM_growvector(ls->L, f->protocnst, f->nprotocnst, 1, + luaM_growvector(ls->L, f->kproto, f->nkproto, 1, TProtoFunc *, constantEM, MAX_ARG); - f->protocnst[f->nprotocnst] = func->f; + f->kproto[f->nkproto] = func->f; for (i=0; inupvalues; i++) lua_pushvar(ls, &func->upvalues[i]); - deltastack(ls, 1); /* CLOSURE puts one extra element (before poping) */ - code_oparg(ls, CLOSURE, f->nprotocnst++, -func->nupvalues); + deltastack(ls, 1); /* CLOSURE puts one extra element (before popping) */ + code_oparg(ls, CLOSURE, f->nkproto++, -func->nupvalues); code_byte(ls, (Byte)func->nupvalues); } @@ -592,9 +592,9 @@ static void close_func (LexState *ls) { code_opcode(ls, ENDCODE, 0); f->code[0] = (Byte)fs->maxstacksize; luaM_reallocvector(ls->L, f->code, fs->pc, Byte); - luaM_reallocvector(ls->L, f->strcnst, f->nstrcnst, TaggedString *); - luaM_reallocvector(ls->L, f->numcnst, f->nnumcnst, real); - luaM_reallocvector(ls->L, f->protocnst, f->nprotocnst, TProtoFunc *); + 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 *); if (fs->nvars != -1) { /* debug information? */ luaI_registerlocalvar(ls, NULL, -1); /* flag end of vector */ luaM_reallocvector(ls->L, f->locvars, fs->nvars, LocVar); @@ -661,7 +661,7 @@ static int checkname (LexState *ls) { static TaggedString *str_checkname (LexState *ls) { int i = checkname(ls); /* this call may realloc `f->consts' */ - return ls->fs->f->strcnst[i]; + return ls->fs->f->kstr[i]; } @@ -853,7 +853,7 @@ static void recfield (LexState *ls) { /* recfield -> (NAME | '['exp1']') = exp1 */ switch (ls->token) { case NAME: - code_strcnst(ls, checkname(ls)); + code_kstr(ls, checkname(ls)); break; case '[': @@ -917,7 +917,7 @@ static void constructor_part (LexState *ls, constdesc *cd) { if (ls->token == '=') { switch (v.k) { case VGLOBAL: - code_strcnst(ls, v.info); + code_kstr(ls, v.info); break; case VLOCAL: code_string(ls, ls->fs->localvar[v.info]); @@ -1291,7 +1291,7 @@ static int funcname (LexState *ls, vardesc *v) { needself = (ls->token == ':'); next(ls); lua_pushvar(ls, v); - code_strcnst(ls, checkname(ls)); + code_kstr(ls, checkname(ls)); v->k = VINDEXED; } return needself; diff --git a/lvm.c b/lvm.c index 990896c7..463373b3 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 1.82 2000/01/24 20:14:07 roberto Exp roberto $ +** $Id: lvm.c,v 1.83 2000/01/25 13:57:18 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -314,7 +314,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, StkId base) { register StkId top; /* keep top local, for performance */ register const Byte *pc = tf->code; - TaggedString **strcnst = tf->strcnst; + TaggedString **kstr = tf->kstr; if (L->callhook) luaD_callHook(L, base-1, L->callhook, "call"); luaD_checkstack(L, (*pc++)+EXTRA_STACK); @@ -358,31 +358,31 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, top -= aux; break; - case PUSHNUMBERW: aux += highbyte(L, *pc++); - case PUSHNUMBER: aux += *pc++; + case PUSHINTW: aux += highbyte(L, *pc++); + case PUSHINT: aux += *pc++; ttype(top) = LUA_T_NUMBER; nvalue(top) = aux; top++; break; - case PUSHNUMBERNEGW: aux += highbyte(L, *pc++); - case PUSHNUMBERNEG: aux += *pc++; + case PUSHINTNEGW: aux += highbyte(L, *pc++); + case PUSHINTNEG: aux += *pc++; ttype(top) = LUA_T_NUMBER; nvalue(top) = -aux; top++; break; - case PUSHSTRCNSTW: aux += highbyte(L, *pc++); - case PUSHSTRCNST: aux += *pc++; + case PUSHSTRINGW: aux += highbyte(L, *pc++); + case PUSHSTRING: aux += *pc++; ttype(top) = LUA_T_STRING; - tsvalue(top) = strcnst[aux]; + tsvalue(top) = kstr[aux]; top++; break; - case PUSHNUMCNSTW: aux += highbyte(L, *pc++); - case PUSHNUMCNST: aux += *pc++; + case PUSHNUMBERW: aux += highbyte(L, *pc++); + case PUSHNUMBER: aux += *pc++; ttype(top) = LUA_T_NUMBER; - nvalue(top) = tf->numcnst[aux]; + nvalue(top) = tf->knum[aux]; top++; break; @@ -396,7 +396,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, case GETGLOBALW: aux += highbyte(L, *pc++); case GETGLOBAL: aux += *pc++; - luaV_getglobal(L, strcnst[aux]->u.s.gv, top); + luaV_getglobal(L, kstr[aux]->u.s.gv, top); top++; break; @@ -408,7 +408,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, case GETDOTTEDW: aux += highbyte(L, *pc++); case GETDOTTED: aux += *pc++; ttype(top) = LUA_T_STRING; - tsvalue(top++) = strcnst[aux]; + tsvalue(top++) = kstr[aux]; luaV_gettable(L, top); top--; break; @@ -418,7 +418,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, TObject receiver; receiver = *(top-1); ttype(top) = LUA_T_STRING; - tsvalue(top++) = strcnst[aux]; + tsvalue(top++) = kstr[aux]; luaV_gettable(L, top); *(top-1) = receiver; break; @@ -439,7 +439,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, case SETGLOBALW: aux += highbyte(L, *pc++); case SETGLOBAL: aux += *pc++; - luaV_setglobal(L, strcnst[aux]->u.s.gv, top); + luaV_setglobal(L, kstr[aux]->u.s.gv, top); top--; break; @@ -632,7 +632,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, case CLOSUREW: aux += highbyte(L, *pc++); case CLOSURE: aux += *pc++; ttype(top) = LUA_T_LPROTO; - tfvalue(top) = tf->protocnst[aux]; + tfvalue(top) = tf->kproto[aux]; L->top = ++top; aux = *pc++; /* number of upvalues */ luaV_closure(L, aux); -- cgit v1.2.3-55-g6feb