`luaconf.h´ exports all its definitions always (so all of them

must have a lua/LUA prefix).
This commit is contained in:
Roberto Ierusalimschy
2005-03-08 17:10:05 -03:00
parent d3902cfa81
commit f8df21bd20
16 changed files with 237 additions and 253 deletions

42
lvm.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.29 2005/03/08 18:00:16 roberto Exp roberto $
** $Id: lvm.c,v 2.30 2005/03/08 18:09:16 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -49,7 +49,7 @@ int luaV_tostring (lua_State *L, StkId obj) {
if (!ttisnumber(obj))
return 0;
else {
char s[MAX_NUMBER2STR];
char s[LUAC_MAXNUMBER2STR];
lua_number2str(s, nvalue(obj));
setsvalue2s(L, obj, luaS_new(L, s));
return 1;
@@ -243,7 +243,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 num_lt(nvalue(l), nvalue(r));
return luac_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)
@@ -257,7 +257,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 num_le(nvalue(l), nvalue(r));
return luac_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' */
@@ -273,7 +273,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 num_eq(nvalue(t1), nvalue(t2));
case LUA_TNUMBER: return luac_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: {
@@ -338,12 +338,12 @@ static StkId 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, num_add(nb, nc)); break;
case TM_SUB: setnvalue(ra, num_sub(nb, nc)); break;
case TM_MUL: setnvalue(ra, num_mul(nb, nc)); break;
case TM_DIV: setnvalue(ra, num_div(nb, nc)); break;
case TM_MOD: setnvalue(ra, num_mod(nb, nc)); break;
case TM_POW: setnvalue(ra, num_pow(nb, nc)); break;
case TM_ADD: setnvalue(ra, luac_numadd(nb, nc)); break;
case TM_SUB: setnvalue(ra, luac_numsub(nb, nc)); break;
case TM_MUL: setnvalue(ra, luac_nummul(nb, nc)); break;
case TM_DIV: setnvalue(ra, luac_numdiv(nb, nc)); break;
case TM_MOD: setnvalue(ra, luac_nummod(nb, nc)); break;
case TM_POW: setnvalue(ra, luac_numpow(nb, nc)); break;
default: lua_assert(0); break;
}
}
@@ -480,7 +480,7 @@ StkId 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, num_add(nb, nc));
setnvalue(ra, luac_numadd(nb, nc));
}
else
base = Arith(L, ra, rb, rc, TM_ADD, pc); /***/
@@ -491,7 +491,7 @@ StkId 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, num_sub(nb, nc));
setnvalue(ra, luac_numsub(nb, nc));
}
else
base = Arith(L, ra, rb, rc, TM_SUB, pc); /***/
@@ -502,7 +502,7 @@ StkId 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, num_mul(nb, nc));
setnvalue(ra, luac_nummul(nb, nc));
}
else
base = Arith(L, ra, rb, rc, TM_MUL, pc); /***/
@@ -513,7 +513,7 @@ StkId 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, num_div(nb, nc));
setnvalue(ra, luac_numdiv(nb, nc));
}
else
base = Arith(L, ra, rb, rc, TM_DIV, pc); /***/
@@ -524,7 +524,7 @@ StkId 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, num_mod(nb, nc));
setnvalue(ra, luac_nummod(nb, nc));
}
else
base = Arith(L, ra, rb, rc, TM_MOD, pc); /***/
@@ -535,7 +535,7 @@ StkId 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, num_pow(nb, nc));
setnvalue(ra, luac_numpow(nb, nc));
}
else
base = Arith(L, ra, rb, rc, TM_POW, pc); /***/
@@ -546,7 +546,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
TValue temp;
if (tonumber(rb, &temp)) {
lua_Number nb = nvalue(rb);
setnvalue(ra, num_unm(nb));
setnvalue(ra, luac_numunm(nb));
}
else {
setnilvalue(&temp);
@@ -682,9 +682,9 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
}
case OP_FORLOOP: {
lua_Number step = nvalue(ra+2);
lua_Number idx = num_add(nvalue(ra), step); /* increment index */
lua_Number idx = luac_numadd(nvalue(ra), step); /* increment index */
lua_Number limit = nvalue(ra+1);
if (step > 0 ? num_le(idx, limit) : num_le(limit, idx)) {
if (step > 0 ? luac_numle(idx, limit) : luac_numle(limit, idx)) {
dojump(L, pc, GETARG_sBx(i)); /* jump back */
setnvalue(ra, idx); /* update internal index... */
setnvalue(ra+3, idx); /* ...and external index */
@@ -702,7 +702,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
luaG_runerror(L, "`for' limit must be a number");
else if (!tonumber(pstep, ra+2))
luaG_runerror(L, "`for' step must be a number");
setnvalue(ra, num_sub(nvalue(ra), nvalue(pstep)));
setnvalue(ra, luac_numsub(nvalue(ra), nvalue(pstep)));
dojump(L, pc, GETARG_sBx(i));
continue;
}