aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-29 15:14:16 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-29 15:14:16 -0300
commitffa43df3cd0593a3fb92fe0411a81a9ae6eb3c1d (patch)
tree951d914937967b00d1739d477f7183ef7fe2667e
parent9c4398de8f334ffaeb805450f158f89db8fd53c0 (diff)
downloadlua-ffa43df3cd0593a3fb92fe0411a81a9ae6eb3c1d.tar.gz
lua-ffa43df3cd0593a3fb92fe0411a81a9ae6eb3c1d.tar.bz2
lua-ffa43df3cd0593a3fb92fe0411a81a9ae6eb3c1d.zip
'setnvalue' -> 'setfltvalue' (for consitency with 'fltvalue')
-rw-r--r--lapi.c6
-rw-r--r--lcode.c6
-rw-r--r--lobject.c8
-rw-r--r--lobject.h4
-rw-r--r--lundump.c4
-rw-r--r--lvm.c26
6 files changed, 27 insertions, 27 deletions
diff --git a/lapi.c b/lapi.c
index 7f85ebd5..5b866885 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.204 2014/04/15 14:29:30 roberto Exp roberto $ 2** $Id: lapi.c,v 2.205 2014/04/15 16:32:49 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -339,7 +339,7 @@ LUA_API int lua_strtonum (lua_State *L, const char *s, size_t len) {
339 setivalue(L->top, i); 339 setivalue(L->top, i);
340 } 340 }
341 else if (luaO_str2d(s, len, &n)) { /* else try as a float */ 341 else if (luaO_str2d(s, len, &n)) { /* else try as a float */
342 setnvalue(L->top, n); 342 setfltvalue(L->top, n);
343 } 343 }
344 else 344 else
345 return 0; /* conversion failed */ 345 return 0; /* conversion failed */
@@ -496,7 +496,7 @@ LUA_API void lua_pushnil (lua_State *L) {
496 496
497LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { 497LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
498 lua_lock(L); 498 lua_lock(L);
499 setnvalue(L->top, n); 499 setfltvalue(L->top, n);
500 luai_checknum(L, L->top, 500 luai_checknum(L, L->top,
501 luaG_runerror(L, "C API - attempt to push a signaling NaN")); 501 luaG_runerror(L, "C API - attempt to push a signaling NaN"));
502 api_incr_top(L); 502 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 @@
1/* 1/*
2** $Id: lcode.c,v 2.87 2014/04/02 16:44:42 roberto Exp roberto $ 2** $Id: lcode.c,v 2.88 2014/04/27 14:41:11 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -46,7 +46,7 @@ static int tonumeral(expdesc *e, TValue *v) {
46 if (v) setivalue(v, e->u.ival); 46 if (v) setivalue(v, e->u.ival);
47 return 1; 47 return 1;
48 case VKFLT: 48 case VKFLT:
49 if (v) setnvalue(v, e->u.nval); 49 if (v) setfltvalue(v, e->u.nval);
50 return 1; 50 return 1;
51 default: return 0; 51 default: return 0;
52 } 52 }
@@ -365,7 +365,7 @@ int luaK_intK (FuncState *fs, lua_Integer n) {
365static int luaK_numberK (FuncState *fs, lua_Number r) { 365static int luaK_numberK (FuncState *fs, lua_Number r) {
366 TValue o; 366 TValue o;
367 lua_assert(!luai_numisnan(r) && !isminuszero(r)); 367 lua_assert(!luai_numisnan(r) && !isminuszero(r));
368 setnvalue(&o, r); 368 setfltvalue(&o, r);
369 return addk(fs, &o, &o); 369 return addk(fs, &o, &o);
370} 370}
371 371
diff --git a/lobject.c b/lobject.c
index bfdb51dd..6034feaf 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 2.80 2014/04/15 16:32:49 roberto Exp roberto $ 2** $Id: lobject.c,v 2.81 2014/04/27 14:41:11 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -126,7 +126,7 @@ void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2,
126 case LUA_OPDIV: { /* operates only on floats */ 126 case LUA_OPDIV: { /* operates only on floats */
127 lua_Number n1; lua_Number n2; 127 lua_Number n1; lua_Number n2;
128 if (tonumber(p1, &n1) && tonumber(p2, &n2)) { 128 if (tonumber(p1, &n1) && tonumber(p2, &n2)) {
129 setnvalue(res, numarith(L, op, n1, n2)); 129 setfltvalue(res, numarith(L, op, n1, n2));
130 return; 130 return;
131 } 131 }
132 else break; /* go to the end */ 132 else break; /* go to the end */
@@ -139,7 +139,7 @@ void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2,
139 return; 139 return;
140 } 140 }
141 else if (tonumber(p1, &n1) && tonumber(p2, &n2)) { 141 else if (tonumber(p1, &n1) && tonumber(p2, &n2)) {
142 setnvalue(res, numarith(L, op, n1, n2)); 142 setfltvalue(res, numarith(L, op, n1, n2));
143 return; 143 return;
144 } 144 }
145 else break; /* go to the end */ 145 else break; /* go to the end */
@@ -351,7 +351,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
351 break; 351 break;
352 } 352 }
353 case 'f': { 353 case 'f': {
354 setnvalue(L->top++, cast_num(va_arg(argp, l_uacNumber))); 354 setfltvalue(L->top++, cast_num(va_arg(argp, l_uacNumber)));
355 break; 355 break;
356 } 356 }
357 case 'p': { 357 case 'p': {
diff --git a/lobject.h b/lobject.h
index 6dd741e1..8efac91f 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 2.85 2014/02/19 13:51:09 roberto Exp roberto $ 2** $Id: lobject.h,v 2.86 2014/02/19 13:52:42 roberto Exp roberto $
3** Type definitions for Lua objects 3** Type definitions for Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -187,7 +187,7 @@ typedef struct lua_TValue TValue;
187/* Macros to set values */ 187/* Macros to set values */
188#define settt_(o,t) ((o)->tt_=(t)) 188#define settt_(o,t) ((o)->tt_=(t))
189 189
190#define setnvalue(obj,x) \ 190#define setfltvalue(obj,x) \
191 { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } 191 { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); }
192 192
193#define setivalue(obj,x) \ 193#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 @@
1/* 1/*
2** $Id: lundump.c,v 2.35 2014/03/27 15:58:05 roberto Exp roberto $ 2** $Id: lundump.c,v 2.36 2014/04/01 14:39:55 roberto Exp roberto $
3** load precompiled Lua chunks 3** load precompiled Lua chunks
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -126,7 +126,7 @@ static void LoadConstants (LoadState *S, Proto *f) {
126 setbvalue(o, LoadByte(S)); 126 setbvalue(o, LoadByte(S));
127 break; 127 break;
128 case LUA_TNUMFLT: 128 case LUA_TNUMFLT:
129 setnvalue(o, LoadNumber(S)); 129 setfltvalue(o, LoadNumber(S));
130 break; 130 break;
131 case LUA_TNUMINT: 131 case LUA_TNUMINT:
132 setivalue(o, LoadInteger(S)); 132 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 @@
1/* 1/*
2** $Id: lvm.c,v 2.199 2014/04/27 14:41:11 roberto Exp roberto $ 2** $Id: lvm.c,v 2.200 2014/04/29 18:11:57 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -669,7 +669,7 @@ void luaV_execute (lua_State *L) {
669 setivalue(ra, intop(+, ib, ic)); 669 setivalue(ra, intop(+, ib, ic));
670 } 670 }
671 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { 671 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
672 setnvalue(ra, luai_numadd(L, nb, nc)); 672 setfltvalue(ra, luai_numadd(L, nb, nc));
673 } 673 }
674 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } 674 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); }
675 ) 675 )
@@ -682,7 +682,7 @@ void luaV_execute (lua_State *L) {
682 setivalue(ra, intop(-, ib, ic)); 682 setivalue(ra, intop(-, ib, ic));
683 } 683 }
684 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { 684 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
685 setnvalue(ra, luai_numsub(L, nb, nc)); 685 setfltvalue(ra, luai_numsub(L, nb, nc));
686 } 686 }
687 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } 687 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); }
688 ) 688 )
@@ -695,7 +695,7 @@ void luaV_execute (lua_State *L) {
695 setivalue(ra, intop(*, ib, ic)); 695 setivalue(ra, intop(*, ib, ic));
696 } 696 }
697 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { 697 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
698 setnvalue(ra, luai_nummul(L, nb, nc)); 698 setfltvalue(ra, luai_nummul(L, nb, nc));
699 } 699 }
700 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } 700 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); }
701 ) 701 )
@@ -704,7 +704,7 @@ void luaV_execute (lua_State *L) {
704 TValue *rc = RKC(i); 704 TValue *rc = RKC(i);
705 lua_Number nb; lua_Number nc; 705 lua_Number nb; lua_Number nc;
706 if (tonumber(rb, &nb) && tonumber(rc, &nc)) { 706 if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
707 setnvalue(ra, luai_numdiv(L, nb, nc)); 707 setfltvalue(ra, luai_numdiv(L, nb, nc));
708 } 708 }
709 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } 709 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); }
710 ) 710 )
@@ -773,7 +773,7 @@ void luaV_execute (lua_State *L) {
773 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { 773 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
774 lua_Number m; 774 lua_Number m;
775 luai_nummod(L, nb, nc, m); 775 luai_nummod(L, nb, nc, m);
776 setnvalue(ra, m); 776 setfltvalue(ra, m);
777 } 777 }
778 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } 778 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); }
779 ) 779 )
@@ -787,7 +787,7 @@ void luaV_execute (lua_State *L) {
787 setivalue(ra, luaV_pow(ib, ic)); 787 setivalue(ra, luaV_pow(ib, ic));
788 } 788 }
789 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { 789 else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
790 setnvalue(ra, luai_numpow(L, nb, nc)); 790 setfltvalue(ra, luai_numpow(L, nb, nc));
791 } 791 }
792 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } 792 else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); }
793 ) 793 )
@@ -799,7 +799,7 @@ void luaV_execute (lua_State *L) {
799 setivalue(ra, intop(-, 0, ib)); 799 setivalue(ra, intop(-, 0, ib));
800 } 800 }
801 else if (tonumber(rb, &nb)) { 801 else if (tonumber(rb, &nb)) {
802 setnvalue(ra, luai_numunm(L, nb)); 802 setfltvalue(ra, luai_numunm(L, nb));
803 } 803 }
804 else { 804 else {
805 Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); 805 Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM));
@@ -955,8 +955,8 @@ void luaV_execute (lua_State *L) {
955 if (luai_numlt(0, step) ? luai_numle(idx, limit) 955 if (luai_numlt(0, step) ? luai_numle(idx, limit)
956 : luai_numle(limit, idx)) { 956 : luai_numle(limit, idx)) {
957 ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ 957 ci->u.l.savedpc += GETARG_sBx(i); /* jump back */
958 setnvalue(ra, idx); /* update internal index... */ 958 setfltvalue(ra, idx); /* update internal index... */
959 setnvalue(ra + 3, idx); /* ...and external index */ 959 setfltvalue(ra + 3, idx); /* ...and external index */
960 } 960 }
961 } 961 }
962 ) 962 )
@@ -975,13 +975,13 @@ void luaV_execute (lua_State *L) {
975 lua_Number ninit; lua_Number nlimit; lua_Number nstep; 975 lua_Number ninit; lua_Number nlimit; lua_Number nstep;
976 if (!tonumber(plimit, &nlimit)) 976 if (!tonumber(plimit, &nlimit))
977 luaG_runerror(L, LUA_QL("for") " limit must be a number"); 977 luaG_runerror(L, LUA_QL("for") " limit must be a number");
978 setnvalue(plimit, nlimit); 978 setfltvalue(plimit, nlimit);
979 if (!tonumber(pstep, &nstep)) 979 if (!tonumber(pstep, &nstep))
980 luaG_runerror(L, LUA_QL("for") " step must be a number"); 980 luaG_runerror(L, LUA_QL("for") " step must be a number");
981 setnvalue(pstep, nstep); 981 setfltvalue(pstep, nstep);
982 if (!tonumber(init, &ninit)) 982 if (!tonumber(init, &ninit))
983 luaG_runerror(L, LUA_QL("for") " initial value must be a number"); 983 luaG_runerror(L, LUA_QL("for") " initial value must be a number");
984 setnvalue(init, luai_numsub(L, ninit, nstep)); 984 setfltvalue(init, luai_numsub(L, ninit, nstep));
985 } 985 }
986 ci->u.l.savedpc += GETARG_sBx(i); 986 ci->u.l.savedpc += GETARG_sBx(i);
987 ) 987 )