A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

lua update to 5.1.5

Modify Rocklua towards upstream 5.1.5

Clean up some of the Rocklua implementation

Change-Id: Iac722e827899cf84f5ca004ef7ae7ddce5f7fbbe

+124 -105
+3 -4
apps/plugins/lua/lauxlib.c
··· 199 199 return luaL_opt(L, luaL_checkinteger, narg, def); 200 200 } 201 201 202 - 202 + /* ROCKLUA ADDED */ 203 203 LUALIB_API int luaL_checkboolean (lua_State *L, int narg) { 204 204 int b = lua_toboolean(L, narg); 205 205 if( b == 0 && !lua_isboolean(L, narg)) ··· 207 207 return b; 208 208 } 209 209 210 - 210 + /* ROCKLUA ADDED */ 211 211 LUALIB_API int luaL_optboolean (lua_State *L, int narg, int def) { 212 212 return luaL_opt(L, luaL_checkboolean, narg, def); 213 213 } ··· 538 538 char buff[LUAL_BUFFERSIZE]; 539 539 } LoadF; 540 540 541 - static const char *getF(lua_State *L, void *ud, size_t *size) { 541 + static const char *getF (lua_State *L, void *ud, size_t *size) { 542 542 LoadF *lf = (LoadF *)ud; 543 543 (void)L; 544 544 if (lf->extraline) { ··· 547 547 return "\n"; 548 548 } 549 549 *size = rb->read(lf->f, lf->buff, LUAL_BUFFERSIZE); 550 - if (*size <= 0) return NULL; 551 550 return (*size > 0) ? lf->buff : NULL; 552 551 } 553 552
+2 -2
apps/plugins/lua/lauxlib.h
··· 1 1 /* 2 - ** $Id$ 2 + ** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ 3 3 ** Auxiliary functions for building Lua libraries 4 4 ** See Copyright Notice in lua.h 5 5 */ ··· 58 58 LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, 59 59 lua_Integer def); 60 60 61 - LUALIB_API int (luaL_checkboolean) (lua_State *L, int numArg); 61 + LUALIB_API int (luaL_checkboolean) (lua_State *L, int nArg); 62 62 LUALIB_API int (luaL_optboolean) (lua_State *L, int nArg, 63 63 int def); 64 64
+25 -22
apps/plugins/lua/lbaselib.c
··· 225 225 } 226 226 227 227 228 + /** $Id: lbaselib.c,v 1.276.1.1 2013/04/12 18:48:47 roberto Exp $ */ 229 + static int pairsmeta (lua_State *L, const char *method, int iszero, 230 + lua_CFunction iter) { 231 + if (!luaL_getmetafield(L, 1, method)) { /* no metamethod? */ 232 + luaL_checktype(L, 1, LUA_TTABLE); /* argument must be a table */ 233 + lua_pushcfunction(L, iter); /* will return generator, */ 234 + lua_pushvalue(L, 1); /* state, */ 235 + if (iszero) lua_pushinteger(L, 0); /* and initial value */ 236 + else lua_pushnil(L); 237 + } 238 + else { 239 + lua_pushvalue(L, 1); /* argument 'self' to metamethod */ 240 + lua_call(L, 1, 3); /* get 3 values from metamethod */ 241 + } 242 + return 3; 243 + } 244 + 245 + 228 246 static int luaB_next (lua_State *L) { 229 247 luaL_checktype(L, 1, LUA_TTABLE); 230 248 lua_settop(L, 2); /* create a 2nd argument if there isn't one */ ··· 238 256 239 257 240 258 static int luaB_pairs (lua_State *L) { 241 - luaL_checktype(L, 1, LUA_TTABLE); 242 - lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ 243 - lua_pushvalue(L, 1); /* state, */ 244 - lua_pushnil(L); /* and initial value */ 245 - return 3; 259 + /* pairs function from lua 5.2 */ 260 + return pairsmeta(L, "__pairs", 0, luaB_next); 246 261 } 247 262 248 263 ··· 252 267 i++; /* next value */ 253 268 lua_pushinteger(L, i); 254 269 lua_rawgeti(L, 1, i); 255 - return (lua_isnil(L, -1)) ? 0 : 2; 270 + return (lua_isnil(L, -1)) ? 1 : 2; 256 271 } 257 272 258 273 259 274 static int luaB_ipairs (lua_State *L) { 260 - luaL_checktype(L, 1, LUA_TTABLE); 261 - lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ 262 - lua_pushvalue(L, 1); /* state, */ 263 - lua_pushinteger(L, 0); /* and initial value */ 264 - return 3; 275 + return pairsmeta(L, "__ipairs", 1, ipairsaux); 276 + /* ipairs function from lua 5.2 */ 265 277 } 266 278 267 279 ··· 454 466 {"gcinfo", luaB_gcinfo}, 455 467 {"getfenv", luaB_getfenv}, 456 468 {"getmetatable", luaB_getmetatable}, 469 + {"ipairs", luaB_ipairs}, 457 470 {"loadfile", luaB_loadfile}, 458 471 {"load", luaB_load}, 459 472 {"loadstring", luaB_loadstring}, 460 473 {"next", luaB_next}, 474 + {"pairs", luaB_pairs}, 461 475 {"pcall", luaB_pcall}, 462 476 #if 0 463 477 {"print", luaB_print}, ··· 619 633 /* }====================================================== */ 620 634 621 635 622 - static void auxopen (lua_State *L, const char *name, 623 - lua_CFunction f, lua_CFunction u) { 624 - lua_pushcfunction(L, u); 625 - lua_pushcclosure(L, f, 1); 626 - lua_setfield(L, -2, name); 627 - } 628 - 629 - 630 636 static void base_open (lua_State *L) { 631 637 /* set global _G */ 632 638 lua_pushvalue(L, LUA_GLOBALSINDEX); ··· 635 641 luaL_register(L, "_G", base_funcs); 636 642 lua_pushliteral(L, LUA_VERSION); 637 643 lua_setglobal(L, "_VERSION"); /* set global _VERSION */ 638 - /* `ipairs' and `pairs' need auxliliary functions as upvalues */ 639 - auxopen(L, "ipairs", luaB_ipairs, ipairsaux); 640 - auxopen(L, "pairs", luaB_pairs, luaB_next); 641 644 /* `newproxy' needs a weaktable as upvalue */ 642 645 lua_createtable(L, 0, 1); /* new table `w' */ 643 646 lua_pushvalue(L, -1); /* `w' will be its own metatable */
+4 -12
apps/plugins/lua/lcode.c
··· 1 1 /* 2 - ** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $ 2 + ** $Id: lcode.c,v 2.25.1.5 2011/01/31 14:53:16 roberto Exp $ 3 3 ** Code generator for Lua 4 4 ** See Copyright Notice in lua.h 5 5 */ ··· 544 544 pc = NO_JUMP; /* always true; do nothing */ 545 545 break; 546 546 } 547 - case VFALSE: { 548 - pc = luaK_jump(fs); /* always jump */ 549 - break; 550 - } 551 547 case VJMP: { 552 548 invertjump(fs, e); 553 549 pc = e->u.s.info; ··· 570 566 switch (e->k) { 571 567 case VNIL: case VFALSE: { 572 568 pc = NO_JUMP; /* always false; do nothing */ 573 - break; 574 - } 575 - case VTRUE: { 576 - pc = luaK_jump(fs); /* always jump */ 577 569 break; 578 570 } 579 571 case VJMP: { ··· 641 633 case OP_ADD: r = luai_numadd(v1, v2); break; 642 634 case OP_SUB: r = luai_numsub(v1, v2); break; 643 635 case OP_MUL: r = luai_nummul(v1, v2); break; 644 - case OP_DIV: 636 + case OP_DIV: /* ROCKLUA BUGFIX */ 645 637 if (v2 == 0) return -1; /* do not attempt to divide by 0 */ 646 638 r = luai_numdiv(v1, v2); break; 647 - case OP_MOD: 639 + case OP_MOD: /* ROCKLUA BUGFIX */ 648 640 if (v2 == 0) return -1; /* do not attempt to divide by 0 */ 649 641 r = luai_nummod(v1, v2); break; 650 642 case OP_POW: r = luai_numpow(v1, v2); break; ··· 659 651 660 652 661 653 static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { 662 - int resf = constfolding(op, e1, e2); 654 + int resf = constfolding(op, e1, e2); /* ROCKLUA BUGFIX */ 663 655 if (resf > 0) 664 656 return; 665 657 else if (resf == 0) {
+2 -1
apps/plugins/lua/ldo.c
··· 1 1 /* 2 - ** $Id: ldo.c,v 2.38.1.3 2008/01/18 22:31:22 roberto Exp $ 2 + ** $Id: ldo.c,v 2.38.1.4 2012/01/18 02:27:10 roberto Exp $ 3 3 ** Stack and Call structure of Lua 4 4 ** See Copyright Notice in lua.h 5 5 */ ··· 217 217 int nvar = actual - nfixargs; /* number of extra arguments */ 218 218 lua_assert(p->is_vararg & VARARG_HASARG); 219 219 luaC_checkGC(L); 220 + luaD_checkstack(L, p->maxstacksize); 220 221 htab = luaH_new(L, nvar, 1); /* create `arg' table */ 221 222 for (i=0; i<nvar; i++) /* put extra arguments into `arg' table */ 222 223 setobj2n(L, luaH_setnum(L, htab, i+1), L->top - nvar + i);
+1 -2
apps/plugins/lua/lgc.c
··· 1 1 /* 2 - ** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $ 2 + ** $Id: lgc.c,v 2.38.1.2 2011/03/18 18:05:38 roberto Exp $ 3 3 ** Garbage Collector 4 4 ** See Copyright Notice in lua.h 5 5 */ ··· 627 627 } 628 628 } 629 629 else { 630 - lua_assert(g->totalbytes >= g->estimate); 631 630 setthreshold(g); 632 631 } 633 632 }
+41 -32
apps/plugins/lua/liolib.c
··· 40 40 lua_pushfstring(L, "%s: %s", filename, strerror(en)); 41 41 else 42 42 lua_pushfstring(L, "%s", strerror(en)); 43 - lua_pushinteger(L, 0); 43 + lua_pushinteger(L, en); 44 44 return 3; 45 45 } 46 46 } ··· 51 51 luaL_argerror(L, arg, lua_tostring(L, -1)); 52 52 } 53 53 54 + #define tofilep(L) ((int*) luaL_checkudata(L, 1, LUA_FILEHANDLE)) 54 55 55 56 static int io_type (lua_State *L) { 56 57 void *ud; ··· 68 69 69 70 70 71 static int* tofile (lua_State *L) { 71 - int *f = (int*) luaL_checkudata(L, 1, LUA_FILEHANDLE); 72 + int *f = tofilep(L); 72 73 if (*f < 0) 73 74 luaL_error(L, "attempt to use a closed file"); 74 75 return f; ··· 115 116 116 117 117 118 static int io_gc (lua_State *L) { 118 - int f = *(int*) luaL_checkudata(L, 1, LUA_FILEHANDLE); 119 + int *f = tofilep(L); 119 120 /* ignore closed files */ 120 - if (f >= 0) 121 + if (*f >= 0) 121 122 aux_close(L); 122 123 return 0; 123 124 } 124 125 125 126 126 127 static int io_tostring (lua_State *L) { 127 - int f = *(int*) luaL_checkudata(L, 1, LUA_FILEHANDLE); 128 - if (f < 0) 128 + int *f = tofilep(L); 129 + if (*f < 0) 129 130 lua_pushliteral(L, "file (closed)"); 130 131 else 131 - lua_pushfstring(L, "file (%d)", f); 132 + lua_pushfstring(L, "file (%d)", *f); 132 133 return 1; 133 134 } 134 135 ··· 137 138 const char *filename = luaL_checkstring(L, 1); 138 139 const char *mode = luaL_optstring(L, 2, "r"); 139 140 int *pf = newfile(L); 140 - int flags = 0; 141 - if(*(mode+1) == '+') { 141 + int flags, wrmode; 142 + 143 + switch(*mode) { 144 + case 'r': 145 + flags = O_RDONLY; 146 + wrmode = 0; 147 + break; 148 + case 'w': 149 + flags = O_WRONLY; 150 + wrmode = O_CREAT | O_TRUNC; 151 + break; 152 + case 'a': 153 + flags = O_WRONLY; 154 + wrmode = O_CREAT | O_APPEND; 155 + break; 156 + default: 157 + flags = 0; 158 + wrmode = 0; 159 + return luaL_error(L, "invalid option " LUA_QL("%c") " to " 160 + LUA_QL("open"), *mode); 161 + } 162 + 163 + if(*(mode+1) == '+') 142 164 flags = O_RDWR; 143 - switch(*mode) { 144 - case 'w': 145 - flags |= O_TRUNC; break; 146 - case 'a': 147 - flags |= O_APPEND; break; 148 - } 149 - } 150 - else { 151 - switch(*mode) { 152 - case 'r': 153 - flags = O_RDONLY; break; 154 - case 'w': 155 - flags = O_WRONLY | O_TRUNC; break; 156 - case 'a': 157 - flags = O_WRONLY | O_APPEND; break; 158 - } 159 - } 160 - if((*mode == 'w' || *mode == 'a') && !rb->file_exists(filename)) 161 - flags |= O_CREAT; 165 + 166 + flags |= wrmode; 167 + 162 168 *pf = rb->open(filename, flags, 0666); 163 169 return (*pf < 0) ? pushresult(L, 0, filename) : 1; 164 170 } ··· 252 258 lua_pushnumber(L, d); 253 259 return 1; 254 260 } 255 - else return 0; /* read fails */ 261 + else { 262 + lua_pushnil(L); /* "result" to be removed */ 263 + return 0; /* read fails */ 264 + } 256 265 } 257 266 258 267 ··· 412 421 static int f_seek (lua_State *L) { 413 422 static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; 414 423 static const char *const modenames[] = {"set", "cur", "end", NULL}; 415 - int f = *tofile(L); 424 + int *f = tofile(L); 416 425 int op = luaL_checkoption(L, 2, "cur", modenames); 417 426 long offset = luaL_optlong(L, 3, 0); 418 - off_t size = rb->lseek(f, offset, mode[op]); 427 + off_t size = rb->lseek(*f, offset, mode[op]); 419 428 if (size < 0 || size > MAX_INT) /* signed limit */ 420 429 return pushresult(L, 0, NULL); /* error */ 421 430 else { 422 - lua_pushinteger(L, (LUA_INTEGER) size ); 431 + lua_pushinteger(L, (LUA_INTEGER) size ); 423 432 return 1; 424 433 } 425 434 }
+4 -2
apps/plugins/lua/llex.c
··· 1 1 /* 2 - ** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $ 2 + ** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $ 3 3 ** Lexical Analyzer 4 4 ** See Copyright Notice in lua.h 5 5 */ ··· 118 118 lua_State *L = ls->L; 119 119 TString *ts = luaS_newlstr(L, str, l); 120 120 TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ 121 - if (ttisnil(o)) 121 + if (ttisnil(o)) { 122 122 setbvalue(o, 1); /* make sure `str' will not be collected */ 123 + luaC_checkGC(L); 124 + } 123 125 return ts; 124 126 } 125 127
+11 -8
apps/plugins/lua/lmathlib.c
··· 82 82 lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); 83 83 return 1; 84 84 } 85 - #endif 86 85 87 86 static int math_ceil (lua_State *L) { 88 - /* Doesn't change anything in fixed point arithmetic */ 89 - lua_pushnumber(L, luaL_checknumber(L, 1)); 87 + lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); 90 88 return 1; 91 89 } 92 90 93 91 static int math_floor (lua_State *L) { 94 - /* Doesn't change anything in fixed point arithmetic */ 95 - lua_pushnumber(L, luaL_checknumber(L, 1)); 92 + lua_pushnumber(L, floor(luaL_checknumber(L, 1))); 96 93 return 1; 97 94 } 95 + #endif 98 96 99 97 static int math_fmod (lua_State *L) { 100 98 /* Was: lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); */ ··· 220 218 return 0; 221 219 } 222 220 221 + static int math_ident (lua_State *L) { /* ROCKLUA ADDED */ 222 + /* Ceil & floor Doesn't change anything in fixed point arithmetic */ 223 + lua_pushnumber(L, luaL_checknumber(L, 1)); 224 + return 1; 225 + } 223 226 224 227 static const luaL_Reg mathlib[] = { 225 228 {"abs", math_abs}, ··· 228 231 {"asin", math_asin}, 229 232 {"atan2", math_atan2}, 230 233 {"atan", math_atan}, 231 - #endif 232 234 {"ceil", math_ceil}, 233 - #if 0 234 235 {"cosh", math_cosh}, 235 236 {"cos", math_cos}, 236 237 #endif 237 238 {"deg", math_deg}, 238 239 #if 0 239 240 {"exp", math_exp}, 240 - #endif 241 241 {"floor", math_floor}, 242 + #endif 242 243 {"fmod", math_fmod}, 243 244 #if 0 244 245 {"frexp", math_frexp}, ··· 262 263 {"tanh", math_tanh}, 263 264 {"tan", math_tan}, 264 265 #endif 266 + {"ceil", math_ident}, 267 + {"floor", math_ident}, 265 268 {NULL, NULL} 266 269 }; 267 270
+6 -6
apps/plugins/lua/loadlib.c
··· 1 1 /* 2 - ** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $ 2 + ** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $ 3 3 ** Dynamic library loader for Lua 4 4 ** See Copyright Notice in lua.h 5 5 ** ··· 21 21 #include "lauxlib.h" 22 22 #include "lualib.h" 23 23 #include "rocklib.h" 24 - 24 + #include "rocklibc.h" 25 25 26 - #define setprogdir(L) ((void)0) 26 + #define setprogdir(L) ((void)0) /* ROCKLUA ADDED */ 27 27 28 28 29 29 /* ··· 54 54 55 55 static const char *findfile (lua_State *L, const char *name, 56 56 const char *pname) { 57 - get_current_path(L, 2); 57 + get_current_path(L, 2); /* ROCKLUA ADDED */ 58 58 const char *current_path = lua_tostring(L, -1); 59 59 const char *path; 60 60 ··· 196 196 lua_setfield(L, -2, "_M"); /* module._M = module */ 197 197 lua_pushstring(L, modname); 198 198 lua_setfield(L, -2, "_NAME"); 199 - dot = rb->strrchr(modname, '.'); /* look for last dot in module name */ 199 + dot = strrchr(modname, '.'); /* look for last dot in module name */ 200 200 if (dot == NULL) dot = modname; 201 201 else dot++; 202 202 /* set _PACKAGE as package name (full module name minus last part) */ ··· 292 292 lua_pushvalue(L, -1); 293 293 lua_replace(L, LUA_ENVIRONINDEX); 294 294 /* create `loaders' table */ 295 - lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1); 295 + lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0); 296 296 /* fill it with pre-defined loaders */ 297 297 for (i=0; loaders[i] != NULL; i++) { 298 298 lua_pushcfunction(L, loaders[i]);
+5 -5
apps/plugins/lua/lparser.c
··· 1 1 /* 2 - ** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $ 2 + ** $Id: lparser.c,v 2.42.1.4 2011/10/21 19:31:42 roberto Exp $ 3 3 ** Lua Parser 4 4 ** See Copyright Notice in lua.h 5 5 */ ··· 325 325 } 326 326 327 327 328 - static void lparser_open_func (LexState *ls, FuncState *fs) { 328 + static void open_func (LexState *ls, FuncState *fs) { 329 329 lua_State *L = ls->L; 330 330 Proto *f = luaF_newproto(L); 331 331 fs->f = f; ··· 374 374 lua_assert(luaG_checkcode(f)); 375 375 lua_assert(fs->bl == NULL); 376 376 ls->fs = fs->prev; 377 - L->top -= 2; /* remove table and prototype from the stack */ 378 377 /* last token read was anchored in defunct function; must reanchor it */ 379 378 if (fs) anchor_token(ls); 379 + L->top -= 2; /* remove table and prototype from the stack */ 380 380 } 381 381 382 382 ··· 385 385 struct FuncState funcstate; 386 386 lexstate.buff = buff; 387 387 luaX_setinput(L, &lexstate, z, luaS_new(L, name)); 388 - lparser_open_func(&lexstate, &funcstate); 388 + open_func(&lexstate, &funcstate); 389 389 funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ 390 390 luaX_next(&lexstate); /* read first token */ 391 391 chunk(&lexstate); ··· 576 576 static void body (LexState *ls, expdesc *e, int needself, int line) { 577 577 /* body -> `(' parlist `)' chunk END */ 578 578 FuncState new_fs; 579 - lparser_open_func(ls, &new_fs); 579 + open_func(ls, &new_fs); 580 580 new_fs.f->linedefined = line; 581 581 checknext(ls, '('); 582 582 if (needself) {
+6 -2
apps/plugins/lua/lstrlib.c
··· 1 1 /* 2 - ** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ 2 + ** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $ 3 3 ** Standard library for string operations and pattern-matching 4 4 ** See Copyright Notice in lua.h 5 5 */ ··· 754 754 755 755 756 756 static int str_format (lua_State *L) { 757 + int top = lua_gettop(L); 757 758 int arg = 1; 758 759 size_t sfl; 759 760 const char *strfrmt = luaL_checklstring(L, arg, &sfl); ··· 768 769 else { /* format item */ 769 770 char form[MAX_FORMAT]; /* to store the format (`%...') */ 770 771 char buff[MAX_ITEM]; /* to store the formatted item */ 771 - arg++; 772 + if (++arg > top) 773 + luaL_argerror(L, arg, "no value"); 772 774 strfrmt = scanformat(L, strfrmt, form); 773 775 switch (*strfrmt++) { 774 776 case 'c': { ··· 785 787 snprintf(buff, MAX_ITEM, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); 786 788 break; 787 789 } 790 + #if 0 /* ROCKLUA NO FLOATING POINT */ 788 791 case 'e': case 'E': case 'f': 789 792 case 'g': case 'G': { 790 793 snprintf(buff, MAX_ITEM, form, (double)luaL_checknumber(L, arg)); 791 794 break; 792 795 } 796 + #endif 793 797 case 'q': { 794 798 addquoted(L, &b, arg); 795 799 continue; /* skip the 'addsize' at the end */
+4 -4
apps/plugins/lua/lua.h
··· 1 1 /* 2 - ** $Id$ 2 + ** $Id: lua.h,v 1.218.1.7 2012/01/13 20:36:20 roberto Exp $ 3 3 ** Lua - An Extensible Extension Language 4 4 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) 5 5 ** See Copyright Notice at the end of this file ··· 17 17 18 18 19 19 #define LUA_VERSION "Lua 5.1" 20 - #define LUA_RELEASE "Lua 5.1.4" 20 + #define LUA_RELEASE "Lua 5.1.5" 21 21 #define LUA_VERSION_NUM 501 22 - #define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" 22 + #define LUA_COPYRIGHT "Copyright (C) 1994-2012 Lua.org, PUC-Rio" 23 23 #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" 24 24 25 25 ··· 362 362 363 363 364 364 /****************************************************************************** 365 - * Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved. 365 + * Copyright (C) 1994-2012 Lua.org, PUC-Rio. All rights reserved. 366 366 * 367 367 * Permission is hereby granted, free of charge, to any person obtaining 368 368 * a copy of this software and associated documentation files (the
+9 -3
apps/plugins/lua/lvm.c
··· 1 1 /* 2 - ** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $ 2 + ** $Id: lvm.c,v 2.63.1.5 2011/08/17 20:43:11 roberto Exp $ 3 3 ** Lua virtual machine 4 4 ** See Copyright Notice in lua.h 5 5 */ ··· 133 133 134 134 void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { 135 135 int loop; 136 + TValue temp; 136 137 for (loop = 0; loop < MAXTAGLOOP; loop++) { 137 138 const TValue *tm; 138 139 if (ttistable(t)) { /* `t' is a table? */ ··· 141 142 if (!ttisnil(oldval) || /* result is no nil? */ 142 143 (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ 143 144 setobj2t(L, oldval, val); 145 + h->flags = 0; 144 146 luaC_barriert(L, h, val); 145 147 return; 146 148 } ··· 152 154 callTM(L, tm, t, key, val); 153 155 return; 154 156 } 155 - t = tm; /* else repeat with `tm' */ 157 + /* else repeat with `tm' */ 158 + setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */ 159 + t = &temp; 156 160 } 157 161 luaG_runerror(L, "loop in settable"); 158 162 } ··· 480 484 continue; 481 485 } 482 486 case OP_DIV: { 487 + /* ROCKLUA INTEGER BUGFIX */ 483 488 TValue *rb = RKB(i); 484 489 TValue *rc = RKC(i); 485 490 if (ttisnumber(rb) && ttisnumber(rc)) { ··· 495 500 continue; 496 501 } 497 502 case OP_MOD: { 503 + /* ROCKLUA INTEGER BUGFIX */ 498 504 TValue *rb = RKB(i); 499 505 TValue *rc = RKC(i); 500 506 if (ttisnumber(rb) && ttisnumber(rc)) { ··· 508 514 Protect(Arith(L, ra, rb, rc, TM_MOD)); 509 515 510 516 continue; 511 - } 517 + } 512 518 case OP_POW: { 513 519 arith_op(luai_numpow, TM_POW); 514 520 continue;
+1
apps/plugins/lua/rocklibc.h
··· 42 42 /* Simple substitutions */ 43 43 #define memcmp rb->memcmp 44 44 #define strlen rb->strlen 45 + #define strrchr rb->strrchr 45 46 46 47 #endif /* _ROCKLIBC_H_ */ 47 48