History

Lua 5.1.3

Lua Team committed 18 years ago

Commit 6ff5b771 parent ebb42b73 files · +15 −18Browse files

Unified · Split

3 files
  1. etc/luavs.bat +1 −1
  2. src/lauxlib.c +5 −6
  3. src/ldblib.c +9 −11
etc/luavs.bat+1−1
@@ -1,7 +1,7 @@
1@rem Script to build Lua under "Visual Studio .NET Command Prompt".1@rem Script to build Lua under "Visual Studio .NET Command Prompt".
2@rem Do not run from this directory; run it from the toplevel: etc\luavs.bat .2@rem Do not run from this directory; run it from the toplevel: etc\luavs.bat .
3@rem It creates lua51.dll, lua51.lib, lua.exe, and luac.exe in src.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@setlocal6@setlocal
7@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE7@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE
src/lauxlib.c+5−6
@@ -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** Auxiliary functions for building Lua libraries3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h4** 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 return "\n";535 return "\n";
536 }536 }
537 if (feof(lf->f)) return NULL;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 return (*size > 0) ? lf->buff : NULL;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 while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */570 while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */
571 if (c == '\n') c = getc(lf.f);571 if (c == '\n') c = getc(lf.f);
572 }572 }
573 if (c == LUA_SIGNATURE[0] && lf.f != stdin) { /* binary file? */573 if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */
574 fclose(lf.f);574 lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
575 lf.f = fopen(filename, "rb"); /* reopen in binary mode */
576 if (lf.f == NULL) return errfile(L, "reopen", fnameindex);575 if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
577 /* skip eventual `#!...' */576 /* skip eventual `#!...' */
578 while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;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 ungetc(c, lf.f);580 ungetc(c, lf.f);
582 status = lua_load(L, getF, &lf, lua_tostring(L, -1));581 status = lua_load(L, getF, &lf, lua_tostring(L, -1));
583 readstatus = ferror(lf.f);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 if (readstatus) {584 if (readstatus) {
586 lua_settop(L, fnameindex); /* ignore results from `lua_load' */585 lua_settop(L, fnameindex); /* ignore results from `lua_load' */
587 return errfile(L, "read", fnameindex);586 return errfile(L, "read", fnameindex);
src/ldblib.c+9−11
@@ -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** Interface from Lua to its debug API3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -268,12 +268,11 @@ static int db_sethook (lua_State *L) { · 262 unmodified lines
268 count = luaL_optint(L, arg+3, 0);268 count = luaL_optint(L, arg+3, 0);
269 func = hookf; mask = makemask(smask, count);269 func = hookf; mask = makemask(smask, count);
270 }270 }
271 gethooktable(L1);271 gethooktable(L);
272 lua_pushlightuserdata(L1, L1);272 lua_pushlightuserdata(L, L1);
273 lua_pushvalue(L, arg+1);273 lua_pushvalue(L, arg+1);
274 lua_xmove(L, L1, 1);274 lua_rawset(L, -3); /* set new hook */
275 lua_rawset(L1, -3); /* set new hook */275 lua_pop(L, 1); /* remove hook table */
276 lua_pop(L1, 1); /* remove hook table */
277 lua_sethook(L1, func, mask, count); /* set hooks */276 lua_sethook(L1, func, mask, count); /* set hooks */
278 return 0;277 return 0;
279}278}
@@ -288,11 +287,10 @@ static int db_gethook (lua_State *L) { · 8 unmodified lines
288 if (hook != NULL && hook != hookf) /* external hook? */287 if (hook != NULL && hook != hookf) /* external hook? */
289 lua_pushliteral(L, "external hook");288 lua_pushliteral(L, "external hook");
290 else {289 else {
291 gethooktable(L1);290 gethooktable(L);
292 lua_pushlightuserdata(L1, L1);291 lua_pushlightuserdata(L, L1);
293 lua_rawget(L1, -2); /* get hook */292 lua_rawget(L, -2); /* get hook */
294 lua_remove(L1, -2); /* remove hook table */293 lua_remove(L, -2); /* remove hook table */
295 lua_xmove(L1, L, 1);
296 }294 }
297 lua_pushstring(L, unmakemask(mask, buff));295 lua_pushstring(L, unmakemask(mask, buff));
298 lua_pushinteger(L, lua_gethookcount(L1));296 lua_pushinteger(L, lua_gethookcount(L1));