diff options
| -rw-r--r-- | lapi.c | 4 | ||||
| -rw-r--r-- | lcode.c | 6 | ||||
| -rw-r--r-- | lobject.c | 16 | ||||
| -rw-r--r-- | ltable.c | 4 | ||||
| -rw-r--r-- | luaconf.h | 22 | ||||
| -rw-r--r-- | lvm.c | 28 |
6 files changed, 40 insertions, 40 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.191 2013/12/04 12:15:22 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.192 2013/12/30 20:47:58 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 | */ |
| @@ -389,7 +389,7 @@ LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *pisnum) { | |||
| 389 | n = -n; | 389 | n = -n; |
| 390 | } | 390 | } |
| 391 | n = l_mathop(fmod)(n, twop); | 391 | n = l_mathop(fmod)(n, twop); |
| 392 | if (luai_numisnan(L,n)) /* not a number? */ | 392 | if (luai_numisnan(n)) /* not a number? */ |
| 393 | break; /* not an integer, too */ | 393 | break; /* not an integer, too */ |
| 394 | res = cast_unsigned(n); | 394 | res = cast_unsigned(n); |
| 395 | if (neg) res = 0u - res; | 395 | if (neg) res = 0u - res; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lcode.c,v 2.76 2013/12/18 18:44:42 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.77 2013/12/30 20:47:58 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 | */ |
| @@ -364,7 +364,7 @@ int luaK_intK (FuncState *fs, lua_Integer n) { | |||
| 364 | */ | 364 | */ |
| 365 | static int luaK_numberK (FuncState *fs, lua_Number r) { | 365 | static int luaK_numberK (FuncState *fs, lua_Number r) { |
| 366 | TValue o; | 366 | TValue o; |
| 367 | lua_assert(!luai_numisnan(NULL, r) && !isminuszero(r)); | 367 | lua_assert(!luai_numisnan(r) && !isminuszero(r)); |
| 368 | setnvalue(&o, r); | 368 | setnvalue(&o, r); |
| 369 | return addk(fs, &o, &o); | 369 | return addk(fs, &o, &o); |
| 370 | } | 370 | } |
| @@ -779,7 +779,7 @@ static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { | |||
| 779 | } | 779 | } |
| 780 | else { | 780 | else { |
| 781 | lua_Number n = fltvalue(&res); | 781 | lua_Number n = fltvalue(&res); |
| 782 | if (luai_numisnan(NULL, n) || isminuszero(n)) | 782 | if (luai_numisnan(n) || isminuszero(n)) |
| 783 | return 0; /* folds neither NaN nor -0 */ | 783 | return 0; /* folds neither NaN nor -0 */ |
| 784 | e1->k = VKFLT; | 784 | e1->k = VKFLT; |
| 785 | e1->u.nval = n; | 785 | e1->u.nval = n; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 2.70 2013/12/18 14:12:03 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.71 2013/12/30 20:47:58 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 | */ |
| @@ -93,13 +93,13 @@ static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, | |||
| 93 | 93 | ||
| 94 | static lua_Number numarith (int op, lua_Number v1, lua_Number v2) { | 94 | static lua_Number numarith (int op, lua_Number v1, lua_Number v2) { |
| 95 | switch (op) { | 95 | switch (op) { |
| 96 | case LUA_OPADD: return luai_numadd(NULL, v1, v2); | 96 | case LUA_OPADD: return luai_numadd(v1, v2); |
| 97 | case LUA_OPSUB: return luai_numsub(NULL, v1, v2); | 97 | case LUA_OPSUB: return luai_numsub(v1, v2); |
| 98 | case LUA_OPMUL: return luai_nummul(NULL, v1, v2); | 98 | case LUA_OPMUL: return luai_nummul(v1, v2); |
| 99 | case LUA_OPDIV: return luai_numdiv(NULL, v1, v2); | 99 | case LUA_OPDIV: return luai_numdiv(v1, v2); |
| 100 | case LUA_OPMOD: return luai_nummod(NULL, v1, v2); | 100 | case LUA_OPMOD: return luai_nummod(v1, v2); |
| 101 | case LUA_OPPOW: return luai_numpow(NULL, v1, v2); | 101 | case LUA_OPPOW: return luai_numpow(v1, v2); |
| 102 | case LUA_OPUNM: return luai_numunm(NULL, v1); | 102 | case LUA_OPUNM: return luai_numunm(v1); |
| 103 | default: lua_assert(0); return 0; | 103 | default: lua_assert(0); return 0; |
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 2.82 2013/08/29 13:49:57 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.83 2013/09/11 12:26:14 roberto Exp roberto $ |
| 3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -421,7 +421,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { | |||
| 421 | else if (ttisfloat(key)) { | 421 | else if (ttisfloat(key)) { |
| 422 | lua_Number n = fltvalue(key); | 422 | lua_Number n = fltvalue(key); |
| 423 | lua_Integer k; | 423 | lua_Integer k; |
| 424 | if (luai_numisnan(L, n)) | 424 | if (luai_numisnan(n)) |
| 425 | luaG_runerror(L, "table index is NaN"); | 425 | luaG_runerror(L, "table index is NaN"); |
| 426 | if (numisinteger(n, &k)) { /* index is int? */ | 426 | if (numisinteger(n, &k)) { /* index is int? */ |
| 427 | setivalue(&aux, k); | 427 | setivalue(&aux, k); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luaconf.h,v 1.187 2013/10/10 15:45:03 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.188 2013/11/21 17:23:14 roberto Exp roberto $ |
| 3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -488,21 +488,21 @@ | |||
| 488 | /* the following operations need the math library */ | 488 | /* the following operations need the math library */ |
| 489 | #if defined(lobject_c) || defined(lvm_c) | 489 | #if defined(lobject_c) || defined(lvm_c) |
| 490 | #include <math.h> | 490 | #include <math.h> |
| 491 | #define luai_nummod(L,a,b) ((a) - l_floor((a)/(b))*(b)) | 491 | #define luai_nummod(a,b) ((a) - l_floor((a)/(b))*(b)) |
| 492 | #define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) | 492 | #define luai_numpow(a,b) (l_mathop(pow)(a,b)) |
| 493 | #endif | 493 | #endif |
| 494 | 494 | ||
| 495 | /* these are quite standard operations */ | 495 | /* these are quite standard operations */ |
| 496 | #if defined(LUA_CORE) | 496 | #if defined(LUA_CORE) |
| 497 | #define luai_numadd(L,a,b) ((a)+(b)) | 497 | #define luai_numadd(a,b) ((a)+(b)) |
| 498 | #define luai_numsub(L,a,b) ((a)-(b)) | 498 | #define luai_numsub(a,b) ((a)-(b)) |
| 499 | #define luai_nummul(L,a,b) ((a)*(b)) | 499 | #define luai_nummul(a,b) ((a)*(b)) |
| 500 | #define luai_numdiv(L,a,b) ((a)/(b)) | 500 | #define luai_numdiv(a,b) ((a)/(b)) |
| 501 | #define luai_numunm(L,a) (-(a)) | 501 | #define luai_numunm(a) (-(a)) |
| 502 | #define luai_numeq(a,b) ((a)==(b)) | 502 | #define luai_numeq(a,b) ((a)==(b)) |
| 503 | #define luai_numlt(L,a,b) ((a)<(b)) | 503 | #define luai_numlt(a,b) ((a)<(b)) |
| 504 | #define luai_numle(L,a,b) ((a)<=(b)) | 504 | #define luai_numle(a,b) ((a)<=(b)) |
| 505 | #define luai_numisnan(L,a) (!luai_numeq((a), (a))) | 505 | #define luai_numisnan(a) (!luai_numeq((a), (a))) |
| 506 | #endif | 506 | #endif |
| 507 | 507 | ||
| 508 | 508 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.183 2013/12/30 20:47:58 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.184 2014/01/22 20:02:04 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 | */ |
| @@ -193,7 +193,7 @@ int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { | |||
| 193 | if (ttisinteger(l) && ttisinteger(r)) | 193 | if (ttisinteger(l) && ttisinteger(r)) |
| 194 | return (ivalue(l) < ivalue(r)); | 194 | return (ivalue(l) < ivalue(r)); |
| 195 | else if (tonumber(l, &nl) && tonumber(r, &nr)) | 195 | else if (tonumber(l, &nl) && tonumber(r, &nr)) |
| 196 | return luai_numlt(L, nl, nr); | 196 | return luai_numlt(nl, nr); |
| 197 | else if (ttisstring(l) && ttisstring(r)) | 197 | else if (ttisstring(l) && ttisstring(r)) |
| 198 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; | 198 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; |
| 199 | else if ((res = luaT_callorderTM(L, l, r, TM_LT)) < 0) | 199 | else if ((res = luaT_callorderTM(L, l, r, TM_LT)) < 0) |
| @@ -208,7 +208,7 @@ int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { | |||
| 208 | if (ttisinteger(l) && ttisinteger(r)) | 208 | if (ttisinteger(l) && ttisinteger(r)) |
| 209 | return (ivalue(l) <= ivalue(r)); | 209 | return (ivalue(l) <= ivalue(r)); |
| 210 | else if (tonumber(l, &nl) && tonumber(r, &nr)) | 210 | else if (tonumber(l, &nl) && tonumber(r, &nr)) |
| 211 | return luai_numle(L, nl, nr); | 211 | return luai_numle(nl, nr); |
| 212 | else if (ttisstring(l) && ttisstring(r)) | 212 | else if (ttisstring(l) && ttisstring(r)) |
| 213 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; | 213 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; |
| 214 | else if ((res = luaT_callorderTM(L, l, r, TM_LE)) >= 0) /* first try `le' */ | 214 | else if ((res = luaT_callorderTM(L, l, r, TM_LE)) >= 0) /* first try `le' */ |
| @@ -641,7 +641,7 @@ void luaV_execute (lua_State *L) { | |||
| 641 | setivalue(ra, intop(+, ib, ic)); | 641 | setivalue(ra, intop(+, ib, ic)); |
| 642 | } | 642 | } |
| 643 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 643 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
| 644 | setnvalue(ra, luai_numadd(L, nb, nc)); | 644 | setnvalue(ra, luai_numadd(nb, nc)); |
| 645 | } | 645 | } |
| 646 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } | 646 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } |
| 647 | ) | 647 | ) |
| @@ -654,7 +654,7 @@ void luaV_execute (lua_State *L) { | |||
| 654 | setivalue(ra, intop(-, ib, ic)); | 654 | setivalue(ra, intop(-, ib, ic)); |
| 655 | } | 655 | } |
| 656 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 656 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
| 657 | setnvalue(ra, luai_numsub(L, nb, nc)); | 657 | setnvalue(ra, luai_numsub(nb, nc)); |
| 658 | } | 658 | } |
| 659 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } | 659 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } |
| 660 | ) | 660 | ) |
| @@ -667,7 +667,7 @@ void luaV_execute (lua_State *L) { | |||
| 667 | setivalue(ra, intop(*, ib, ic)); | 667 | setivalue(ra, intop(*, ib, ic)); |
| 668 | } | 668 | } |
| 669 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 669 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
| 670 | setnvalue(ra, luai_nummul(L, nb, nc)); | 670 | setnvalue(ra, luai_nummul(nb, nc)); |
| 671 | } | 671 | } |
| 672 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } | 672 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } |
| 673 | ) | 673 | ) |
| @@ -676,7 +676,7 @@ void luaV_execute (lua_State *L) { | |||
| 676 | TValue *rc = RKC(i); | 676 | TValue *rc = RKC(i); |
| 677 | lua_Number nb; lua_Number nc; | 677 | lua_Number nb; lua_Number nc; |
| 678 | if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 678 | if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
| 679 | setnvalue(ra, luai_numdiv(L, nb, nc)); | 679 | setnvalue(ra, luai_numdiv(nb, nc)); |
| 680 | } | 680 | } |
| 681 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } | 681 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } |
| 682 | ) | 682 | ) |
| @@ -743,7 +743,7 @@ void luaV_execute (lua_State *L) { | |||
| 743 | setivalue(ra, luaV_mod(L, ib, ic)); | 743 | setivalue(ra, luaV_mod(L, ib, ic)); |
| 744 | } | 744 | } |
| 745 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 745 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
| 746 | setnvalue(ra, luai_nummod(L, nb, nc)); | 746 | setnvalue(ra, luai_nummod(nb, nc)); |
| 747 | } | 747 | } |
| 748 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } | 748 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } |
| 749 | ) | 749 | ) |
| @@ -756,7 +756,7 @@ void luaV_execute (lua_State *L) { | |||
| 756 | setivalue(ra, luaV_pow(L, ib, ic)); | 756 | setivalue(ra, luaV_pow(L, ib, ic)); |
| 757 | } | 757 | } |
| 758 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 758 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
| 759 | setnvalue(ra, luai_numpow(L, nb, nc)); | 759 | setnvalue(ra, luai_numpow(nb, nc)); |
| 760 | } | 760 | } |
| 761 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } | 761 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } |
| 762 | ) | 762 | ) |
| @@ -768,7 +768,7 @@ void luaV_execute (lua_State *L) { | |||
| 768 | setivalue(ra, intop(-, 0, ib)); | 768 | setivalue(ra, intop(-, 0, ib)); |
| 769 | } | 769 | } |
| 770 | else if (tonumber(rb, &nb)) { | 770 | else if (tonumber(rb, &nb)) { |
| 771 | setnvalue(ra, luai_numunm(L, nb)); | 771 | setnvalue(ra, luai_numunm(nb)); |
| 772 | } | 772 | } |
| 773 | else { | 773 | else { |
| 774 | Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); | 774 | Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); |
| @@ -919,10 +919,10 @@ void luaV_execute (lua_State *L) { | |||
| 919 | } | 919 | } |
| 920 | else { /* floating count */ | 920 | else { /* floating count */ |
| 921 | lua_Number step = fltvalue(ra + 2); | 921 | lua_Number step = fltvalue(ra + 2); |
| 922 | lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */ | 922 | lua_Number idx = luai_numadd(fltvalue(ra), step); /* inc. index */ |
| 923 | lua_Number limit = fltvalue(ra + 1); | 923 | lua_Number limit = fltvalue(ra + 1); |
| 924 | if (luai_numlt(L, 0, step) ? luai_numle(L, idx, limit) | 924 | if (luai_numlt(0, step) ? luai_numle(idx, limit) |
| 925 | : luai_numle(L, limit, idx)) { | 925 | : luai_numle(limit, idx)) { |
| 926 | ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ | 926 | ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ |
| 927 | setnvalue(ra, idx); /* update internal index... */ | 927 | setnvalue(ra, idx); /* update internal index... */ |
| 928 | setnvalue(ra + 3, idx); /* ...and external index */ | 928 | setnvalue(ra + 3, idx); /* ...and external index */ |
| @@ -946,7 +946,7 @@ void luaV_execute (lua_State *L) { | |||
| 946 | setnvalue(pstep, nstep); | 946 | setnvalue(pstep, nstep); |
| 947 | if (!tonumber(init, &ninit)) | 947 | if (!tonumber(init, &ninit)) |
| 948 | luaG_runerror(L, LUA_QL("for") " initial value must be a number"); | 948 | luaG_runerror(L, LUA_QL("for") " initial value must be a number"); |
| 949 | setnvalue(ra, luai_numsub(L, ninit, nstep)); | 949 | setnvalue(ra, luai_numsub(ninit, nstep)); |
| 950 | } | 950 | } |
| 951 | ci->u.l.savedpc += GETARG_sBx(i); | 951 | ci->u.l.savedpc += GETARG_sBx(i); |
| 952 | ) | 952 | ) |
