no more L in numer-operator macros (some functions that use those macros

have no access to L)
This commit is contained in:
Roberto Ierusalimschy
2005-10-24 15:37:52 -02:00
parent c2bd68d2c3
commit 8e48ebb638
4 changed files with 41 additions and 41 deletions

42
lvm.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.56 2005/10/03 14:01:26 roberto Exp roberto $
** $Id: lvm.c,v 2.57 2005/10/13 12:21:26 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -225,7 +225,7 @@ int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
if (ttype(l) != ttype(r))
return luaG_ordererror(L, l, r);
else if (ttisnumber(l))
return luai_numlt(L, nvalue(l), nvalue(r));
return luai_numlt(nvalue(l), nvalue(r));
else if (ttisstring(l))
return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0;
else if ((res = call_orderTM(L, l, r, TM_LT)) != -1)
@@ -239,7 +239,7 @@ static int lessequal (lua_State *L, const TValue *l, const TValue *r) {
if (ttype(l) != ttype(r))
return luaG_ordererror(L, l, r);
else if (ttisnumber(l))
return luai_numle(L, nvalue(l), nvalue(r));
return luai_numle(nvalue(l), nvalue(r));
else if (ttisstring(l))
return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0;
else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */
@@ -255,7 +255,7 @@ int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
lua_assert(ttype(t1) == ttype(t2));
switch (ttype(t1)) {
case LUA_TNIL: return 1;
case LUA_TNUMBER: return luai_numeq(L, nvalue(t1), nvalue(t2));
case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
case LUA_TUSERDATA: {
@@ -318,13 +318,13 @@ static void Arith (lua_State *L, StkId ra, const TValue *rb,
(c = luaV_tonumber(rc, &tempc)) != NULL) {
lua_Number nb = nvalue(b), nc = nvalue(c);
switch (op) {
case TM_ADD: setnvalue(ra, luai_numadd(L, nb, nc)); break;
case TM_SUB: setnvalue(ra, luai_numsub(L, nb, nc)); break;
case TM_MUL: setnvalue(ra, luai_nummul(L, nb, nc)); break;
case TM_DIV: setnvalue(ra, luai_numdiv(L, nb, nc)); break;
case TM_MOD: setnvalue(ra, luai_nummod(L, nb, nc)); break;
case TM_POW: setnvalue(ra, luai_numpow(L, nb, nc)); break;
case TM_UNM: setnvalue(ra, luai_numunm(L, nb)); break;
case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break;
case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;
case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;
case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break;
case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break;
case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
default: lua_assert(0); break;
}
}
@@ -458,7 +458,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
TValue *rc = RKC(i);
if (ttisnumber(rb) && ttisnumber(rc)) {
lua_Number nb = nvalue(rb), nc = nvalue(rc);
setnvalue(ra, luai_numadd(L, nb, nc));
setnvalue(ra, luai_numadd(nb, nc));
}
else
Protect(Arith(L, ra, rb, rc, TM_ADD));
@@ -469,7 +469,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
TValue *rc = RKC(i);
if (ttisnumber(rb) && ttisnumber(rc)) {
lua_Number nb = nvalue(rb), nc = nvalue(rc);
setnvalue(ra, luai_numsub(L, nb, nc));
setnvalue(ra, luai_numsub(nb, nc));
}
else
Protect(Arith(L, ra, rb, rc, TM_SUB));
@@ -480,7 +480,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
TValue *rc = RKC(i);
if (ttisnumber(rb) && ttisnumber(rc)) {
lua_Number nb = nvalue(rb), nc = nvalue(rc);
setnvalue(ra, luai_nummul(L, nb, nc));
setnvalue(ra, luai_nummul(nb, nc));
}
else
Protect(Arith(L, ra, rb, rc, TM_MUL));
@@ -491,7 +491,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
TValue *rc = RKC(i);
if (ttisnumber(rb) && ttisnumber(rc)) {
lua_Number nb = nvalue(rb), nc = nvalue(rc);
setnvalue(ra, luai_numdiv(L, nb, nc));
setnvalue(ra, luai_numdiv(nb, nc));
}
else
Protect(Arith(L, ra, rb, rc, TM_DIV));
@@ -502,7 +502,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
TValue *rc = RKC(i);
if (ttisnumber(rb) && ttisnumber(rc)) {
lua_Number nb = nvalue(rb), nc = nvalue(rc);
setnvalue(ra, luai_nummod(L, nb, nc));
setnvalue(ra, luai_nummod(nb, nc));
}
else
Protect(Arith(L, ra, rb, rc, TM_MOD));
@@ -513,7 +513,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
TValue *rc = RKC(i);
if (ttisnumber(rb) && ttisnumber(rc)) {
lua_Number nb = nvalue(rb), nc = nvalue(rc);
setnvalue(ra, luai_numpow(L, nb, nc));
setnvalue(ra, luai_numpow(nb, nc));
}
else
Protect(Arith(L, ra, rb, rc, TM_POW));
@@ -523,7 +523,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
TValue *rb = RB(i);
if (ttisnumber(rb)) {
lua_Number nb = nvalue(rb);
setnvalue(ra, luai_numunm(L, nb));
setnvalue(ra, luai_numunm(nb));
}
else {
Protect(Arith(L, ra, rb, rb, TM_UNM));
@@ -677,9 +677,9 @@ void luaV_execute (lua_State *L, int nexeccalls) {
}
case OP_FORLOOP: {
lua_Number step = nvalue(ra+2);
lua_Number idx = luai_numadd(L, nvalue(ra), step); /* increment index */
lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */
lua_Number limit = nvalue(ra+1);
if (step > 0 ? luai_numle(L, idx, limit) : luai_numle(L, limit, idx)) {
if (step > 0 ? luai_numle(idx, limit) : luai_numle(limit, idx)) {
dojump(L, pc, GETARG_sBx(i)); /* jump back */
setnvalue(ra, idx); /* update internal index... */
setnvalue(ra+3, idx); /* ...and external index */
@@ -697,7 +697,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
luaG_runerror(L, LUA_QL("for") " limit must be a number");
else if (!tonumber(pstep, ra+2))
luaG_runerror(L, LUA_QL("for") " step must be a number");
setnvalue(ra, luai_numsub(L, nvalue(ra), nvalue(pstep)));
setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
dojump(L, pc, GETARG_sBx(i));
continue;
}