diff --git a/lapi.c b/lapi.c index 7f85ebd5..5b866885 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.204 2014/04/15 14:29:30 roberto Exp roberto $ +** $Id: lapi.c,v 2.205 2014/04/15 16:32:49 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -339,7 +339,7 @@ LUA_API int lua_strtonum (lua_State *L, const char *s, size_t len) { setivalue(L->top, i); } else if (luaO_str2d(s, len, &n)) { /* else try as a float */ - setnvalue(L->top, n); + setfltvalue(L->top, n); } else return 0; /* conversion failed */ @@ -496,7 +496,7 @@ LUA_API void lua_pushnil (lua_State *L) { LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { lua_lock(L); - setnvalue(L->top, n); + setfltvalue(L->top, n); luai_checknum(L, L->top, luaG_runerror(L, "C API - attempt to push a signaling NaN")); api_incr_top(L); diff --git a/lcode.c b/lcode.c index b9e2c6f0..103bed14 100644 --- a/lcode.c +++ b/lcode.c @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 2.87 2014/04/02 16:44:42 roberto Exp roberto $ +** $Id: lcode.c,v 2.88 2014/04/27 14:41:11 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -46,7 +46,7 @@ static int tonumeral(expdesc *e, TValue *v) { if (v) setivalue(v, e->u.ival); return 1; case VKFLT: - if (v) setnvalue(v, e->u.nval); + if (v) setfltvalue(v, e->u.nval); return 1; default: return 0; } @@ -365,7 +365,7 @@ int luaK_intK (FuncState *fs, lua_Integer n) { static int luaK_numberK (FuncState *fs, lua_Number r) { TValue o; lua_assert(!luai_numisnan(r) && !isminuszero(r)); - setnvalue(&o, r); + setfltvalue(&o, r); return addk(fs, &o, &o); } diff --git a/lobject.c b/lobject.c index bfdb51dd..6034feaf 100644 --- a/lobject.c +++ b/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 2.80 2014/04/15 16:32:49 roberto Exp roberto $ +** $Id: lobject.c,v 2.81 2014/04/27 14:41:11 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -126,7 +126,7 @@ void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, case LUA_OPDIV: { /* operates only on floats */ lua_Number n1; lua_Number n2; if (tonumber(p1, &n1) && tonumber(p2, &n2)) { - setnvalue(res, numarith(L, op, n1, n2)); + setfltvalue(res, numarith(L, op, n1, n2)); return; } else break; /* go to the end */ @@ -139,7 +139,7 @@ void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, return; } else if (tonumber(p1, &n1) && tonumber(p2, &n2)) { - setnvalue(res, numarith(L, op, n1, n2)); + setfltvalue(res, numarith(L, op, n1, n2)); return; } else break; /* go to the end */ @@ -351,7 +351,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { break; } case 'f': { - setnvalue(L->top++, cast_num(va_arg(argp, l_uacNumber))); + setfltvalue(L->top++, cast_num(va_arg(argp, l_uacNumber))); break; } case 'p': { diff --git a/lobject.h b/lobject.h index 6dd741e1..8efac91f 100644 --- a/lobject.h +++ b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.85 2014/02/19 13:51:09 roberto Exp roberto $ +** $Id: lobject.h,v 2.86 2014/02/19 13:52:42 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -187,7 +187,7 @@ typedef struct lua_TValue TValue; /* Macros to set values */ #define settt_(o,t) ((o)->tt_=(t)) -#define setnvalue(obj,x) \ +#define setfltvalue(obj,x) \ { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } #define setivalue(obj,x) \ diff --git a/lundump.c b/lundump.c index 1a5c3ab3..b0c31c78 100644 --- a/lundump.c +++ b/lundump.c @@ -1,5 +1,5 @@ /* -** $Id: lundump.c,v 2.35 2014/03/27 15:58:05 roberto Exp roberto $ +** $Id: lundump.c,v 2.36 2014/04/01 14:39:55 roberto Exp roberto $ ** load precompiled Lua chunks ** See Copyright Notice in lua.h */ @@ -126,7 +126,7 @@ static void LoadConstants (LoadState *S, Proto *f) { setbvalue(o, LoadByte(S)); break; case LUA_TNUMFLT: - setnvalue(o, LoadNumber(S)); + setfltvalue(o, LoadNumber(S)); break; case LUA_TNUMINT: setivalue(o, LoadInteger(S)); diff --git a/lvm.c b/lvm.c index 91d414f0..17c34ee6 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.199 2014/04/27 14:41:11 roberto Exp roberto $ +** $Id: lvm.c,v 2.200 2014/04/29 18:11:57 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -669,7 +669,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(+, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numadd(L, nb, nc)); + setfltvalue(ra, luai_numadd(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } ) @@ -682,7 +682,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(-, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numsub(L, nb, nc)); + setfltvalue(ra, luai_numsub(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } ) @@ -695,7 +695,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(*, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_nummul(L, nb, nc)); + setfltvalue(ra, luai_nummul(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } ) @@ -704,7 +704,7 @@ void luaV_execute (lua_State *L) { TValue *rc = RKC(i); lua_Number nb; lua_Number nc; if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numdiv(L, nb, nc)); + setfltvalue(ra, luai_numdiv(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } ) @@ -773,7 +773,7 @@ void luaV_execute (lua_State *L) { else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { lua_Number m; luai_nummod(L, nb, nc, m); - setnvalue(ra, m); + setfltvalue(ra, m); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } ) @@ -787,7 +787,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, luaV_pow(ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numpow(L, nb, nc)); + setfltvalue(ra, luai_numpow(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } ) @@ -799,7 +799,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(-, 0, ib)); } else if (tonumber(rb, &nb)) { - setnvalue(ra, luai_numunm(L, nb)); + setfltvalue(ra, luai_numunm(L, nb)); } else { Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); @@ -955,8 +955,8 @@ void luaV_execute (lua_State *L) { if (luai_numlt(0, step) ? luai_numle(idx, limit) : luai_numle(limit, idx)) { ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - setnvalue(ra, idx); /* update internal index... */ - setnvalue(ra + 3, idx); /* ...and external index */ + setfltvalue(ra, idx); /* update internal index... */ + setfltvalue(ra + 3, idx); /* ...and external index */ } } ) @@ -975,13 +975,13 @@ void luaV_execute (lua_State *L) { lua_Number ninit; lua_Number nlimit; lua_Number nstep; if (!tonumber(plimit, &nlimit)) luaG_runerror(L, LUA_QL("for") " limit must be a number"); - setnvalue(plimit, nlimit); + setfltvalue(plimit, nlimit); if (!tonumber(pstep, &nstep)) luaG_runerror(L, LUA_QL("for") " step must be a number"); - setnvalue(pstep, nstep); + setfltvalue(pstep, nstep); if (!tonumber(init, &ninit)) luaG_runerror(L, LUA_QL("for") " initial value must be a number"); - setnvalue(init, luai_numsub(L, ninit, nstep)); + setfltvalue(init, luai_numsub(L, ninit, nstep)); } ci->u.l.savedpc += GETARG_sBx(i); )