Author: cazfi Date: Mon Apr 20 22:46:16 2015 New Revision: 28830 URL: http://svn.gna.org/viewcvs/freeciv?rev=28830&view=rev Log: Applied lua.org patch 3 to included lua-5.3.0
See patch #6005 Modified: branches/S2_6/dependencies/lua-5.3/Version branches/S2_6/dependencies/lua-5.3/src/lstate.h branches/S2_6/dependencies/lua-5.3/src/lvm.c Modified: branches/S2_6/dependencies/lua-5.3/Version URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/dependencies/lua-5.3/Version?rev=28830&r1=28829&r2=28830&view=diff ============================================================================== --- branches/S2_6/dependencies/lua-5.3/Version (original) +++ branches/S2_6/dependencies/lua-5.3/Version Mon Apr 20 22:46:16 2015 @@ -1,6 +1,6 @@ Sources here are from lua-5.3.0 (http://www.lua.org/ftp/lua-5.3.0.tar.gz) -All applicable official lua.org patches, as of 01-Mar-15, have been applied. -That's patches 1-2. +All applicable official lua.org patches, as of 16-Apr-15, have been applied. +That's patches 1-3. Not entire lua distribution directory hierarchy is included here, and some files needed for Freeciv usage have been added. Modified: branches/S2_6/dependencies/lua-5.3/src/lstate.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/dependencies/lua-5.3/src/lstate.h?rev=28830&r1=28829&r2=28830&view=diff ============================================================================== --- branches/S2_6/dependencies/lua-5.3/src/lstate.h (original) +++ branches/S2_6/dependencies/lua-5.3/src/lstate.h Mon Apr 20 22:46:16 2015 @@ -94,6 +94,7 @@ #define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ #define CIST_TAIL (1<<5) /* call was tail called */ #define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ +#define CIST_LEQ (1<<7) /* using __lt for __le */ #define isLua(ci) ((ci)->callstatus & CIST_LUA) Modified: branches/S2_6/dependencies/lua-5.3/src/lvm.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/dependencies/lua-5.3/src/lvm.c?rev=28830&r1=28829&r2=28830&view=diff ============================================================================== --- branches/S2_6/dependencies/lua-5.3/src/lvm.c (original) +++ branches/S2_6/dependencies/lua-5.3/src/lvm.c Mon Apr 20 22:46:16 2015 @@ -292,9 +292,14 @@ return l_strcmp(tsvalue(l), tsvalue(r)) <= 0; else if ((res = luaT_callorderTM(L, l, r, TM_LE)) >= 0) /* first try 'le' */ return res; - else if ((res = luaT_callorderTM(L, r, l, TM_LT)) < 0) /* else try 'lt' */ - luaG_ordererror(L, l, r); - return !res; + else { /* try 'lt': */ + L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ + res = luaT_callorderTM(L, r, l, TM_LT); + L->ci->callstatus ^= CIST_LEQ; /* clear mark */ + if (res < 0) + luaG_ordererror(L, l, r); + return !res; /* result is negated */ + } } @@ -553,11 +558,11 @@ case OP_LE: case OP_LT: case OP_EQ: { int res = !l_isfalse(L->top - 1); L->top--; - /* metamethod should not be called when operand is K */ - lua_assert(!ISK(GETARG_B(inst))); - if (op == OP_LE && /* "<=" using "<" instead? */ - ttisnil(luaT_gettmbyobj(L, base + GETARG_B(inst), TM_LE))) - res = !res; /* invert result */ + if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ + lua_assert(op == OP_LE); + ci->callstatus ^= CIST_LEQ; /* clear mark */ + res = !res; /* negate result */ + } lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); if (res != GETARG_A(inst)) /* condition failed? */ ci->u.l.savedpc++; /* skip jump instruction */ _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits