Unified · Split
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | @rem Script to build Lua under "Visual Studio .NET Command Prompt". |
| 2 | 2 | @rem Do not run from this directory; run it from the toplevel: etc\luavs.bat . |
| 3 | 3 | @rem It creates lua51.dll, lua51.lib, lua.exe, and luac.exe in src. |
| 4 | −@rem David Manura <dm.lua@math2.org> and Mike Pall <mikelu-0801@mike.de> | |
| 4 | +@rem (contributed by David Manura and Mike Pall) | |
| 5 | 5 | |
| 6 | 6 | @setlocal |
| 7 | 7 | @set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lauxlib.c,v 1.159.1.2 2008/01/17 14:04:41 roberto Exp $ | |
| 2 | +** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $ | |
| 3 | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -535,7 +535,7 @@ static const char *getF (lua_State *L, void *ud, size_t *size) { · 529 unmodified lines | ||
| 535 | 535 | return "\n"; |
| 536 | 536 | } |
| 537 | 537 | if (feof(lf->f)) return NULL; |
| 538 | − *size = fread(lf->buff, 1, LUAL_BUFFERSIZE, lf->f); | |
| 538 | + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); | |
| 539 | 539 | return (*size > 0) ? lf->buff : NULL; |
| 540 | 540 | } |
| 541 | 541 | |
| @@ -570,9 +570,8 @@ LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { · 28 unmodified lines | ||
| 570 | 570 | while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */ |
| 571 | 571 | if (c == '\n') c = getc(lf.f); |
| 572 | 572 | } |
| 573 | − if (c == LUA_SIGNATURE[0] && lf.f != stdin) { /* binary file? */ | |
| 574 | − fclose(lf.f); | |
| 575 | − lf.f = fopen(filename, "rb"); /* reopen in binary mode */ | |
| 573 | + if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ | |
| 574 | + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ | |
| 576 | 575 | if (lf.f == NULL) return errfile(L, "reopen", fnameindex); |
| 577 | 576 | /* skip eventual `#!...' */ |
| 578 | 577 | while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; |
| @@ -581,7 +580,7 @@ LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { · 2 unmodified lines | ||
| 581 | 580 | ungetc(c, lf.f); |
| 582 | 581 | status = lua_load(L, getF, &lf, lua_tostring(L, -1)); |
| 583 | 582 | readstatus = ferror(lf.f); |
| 584 | − if (lf.f != stdin) fclose(lf.f); /* close file (even in case of errors) */ | |
| 583 | + if (filename) fclose(lf.f); /* close file (even in case of errors) */ | |
| 585 | 584 | if (readstatus) { |
| 586 | 585 | lua_settop(L, fnameindex); /* ignore results from `lua_load' */ |
| 587 | 586 | return errfile(L, "read", fnameindex); |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: ldblib.c,v 1.104.1.2 2008/01/18 16:39:45 roberto Exp $ | |
| 2 | +** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $ | |
| 3 | 3 | ** Interface from Lua to its debug API |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -268,12 +268,11 @@ static int db_sethook (lua_State *L) { · 262 unmodified lines | ||
| 268 | 268 | count = luaL_optint(L, arg+3, 0); |
| 269 | 269 | func = hookf; mask = makemask(smask, count); |
| 270 | 270 | } |
| 271 | − gethooktable(L1); | |
| 272 | − lua_pushlightuserdata(L1, L1); | |
| 271 | + gethooktable(L); | |
| 272 | + lua_pushlightuserdata(L, L1); | |
| 273 | 273 | lua_pushvalue(L, arg+1); |
| 274 | − lua_xmove(L, L1, 1); | |
| 275 | − lua_rawset(L1, -3); /* set new hook */ | |
| 276 | − lua_pop(L1, 1); /* remove hook table */ | |
| 274 | + lua_rawset(L, -3); /* set new hook */ | |
| 275 | + lua_pop(L, 1); /* remove hook table */ | |
| 277 | 276 | lua_sethook(L1, func, mask, count); /* set hooks */ |
| 278 | 277 | return 0; |
| 279 | 278 | } |
| @@ -288,11 +287,10 @@ static int db_gethook (lua_State *L) { · 8 unmodified lines | ||
| 288 | 287 | if (hook != NULL && hook != hookf) /* external hook? */ |
| 289 | 288 | lua_pushliteral(L, "external hook"); |
| 290 | 289 | else { |
| 291 | − gethooktable(L1); | |
| 292 | − lua_pushlightuserdata(L1, L1); | |
| 293 | − lua_rawget(L1, -2); /* get hook */ | |
| 294 | − lua_remove(L1, -2); /* remove hook table */ | |
| 295 | − lua_xmove(L1, L, 1); | |
| 290 | + gethooktable(L); | |
| 291 | + lua_pushlightuserdata(L, L1); | |
| 292 | + lua_rawget(L, -2); /* get hook */ | |
| 293 | + lua_remove(L, -2); /* remove hook table */ | |
| 296 | 294 | } |
| 297 | 295 | lua_pushstring(L, unmakemask(mask, buff)); |
| 298 | 296 | lua_pushinteger(L, lua_gethookcount(L1)); |