diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-07-28 12:51:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-07-28 12:51:59 -0300 |
commit | d447945685986f0b1a7bd5d7ed7746bf4ebd5914 (patch) | |
tree | f6439228bedf7b967cb7ff8dc26946732e96d8b5 | |
parent | 78f9635111ec647719bb1b1622b1cb6f47ef1be1 (diff) | |
download | lua-d447945685986f0b1a7bd5d7ed7746bf4ebd5914.tar.gz lua-d447945685986f0b1a7bd5d7ed7746bf4ebd5914.tar.bz2 lua-d447945685986f0b1a7bd5d7ed7746bf4ebd5914.zip |
'module'/'luaL_register' and associates are deprecated
-rw-r--r-- | lauxlib.c | 4 | ||||
-rw-r--r-- | liolib.c | 4 | ||||
-rw-r--r-- | loadlib.c | 20 | ||||
-rw-r--r-- | ltests.c | 6 | ||||
-rw-r--r-- | ltests.h | 5 | ||||
-rw-r--r-- | luaconf.h | 8 |
6 files changed, 33 insertions, 14 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.217 2010/07/02 11:38:13 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.218 2010/07/02 12:01:53 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -664,6 +664,7 @@ LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { | |||
664 | ** Compatibility with 5.1 module functions | 664 | ** Compatibility with 5.1 module functions |
665 | ** ======================================================= | 665 | ** ======================================================= |
666 | */ | 666 | */ |
667 | #if defined(LUA_COMPAT_MODULE) | ||
667 | 668 | ||
668 | static const char *luaL_findtablex (lua_State *L, int idx, | 669 | static const char *luaL_findtablex (lua_State *L, int idx, |
669 | const char *fname, int szhint) { | 670 | const char *fname, int szhint) { |
@@ -735,6 +736,7 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, | |||
735 | luaL_setfuncs(L, l, nup); | 736 | luaL_setfuncs(L, l, nup); |
736 | } | 737 | } |
737 | 738 | ||
739 | #endif | ||
738 | /* }====================================================== */ | 740 | /* }====================================================== */ |
739 | 741 | ||
740 | /* | 742 | /* |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.89 2010/07/02 11:38:13 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.90 2010/07/25 15:18:19 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -583,7 +583,7 @@ static void createmeta (lua_State *L) { | |||
583 | luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ | 583 | luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ |
584 | lua_pushvalue(L, -1); /* push metatable */ | 584 | lua_pushvalue(L, -1); /* push metatable */ |
585 | lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ | 585 | lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ |
586 | luaL_register(L, NULL, flib); /* add file methods to new metatable */ | 586 | luaL_setfuncs(L, flib, 0); /* add file methods to new metatable */ |
587 | lua_pop(L, 1); /* pop new metatable */ | 587 | lua_pop(L, 1); /* pop new metatable */ |
588 | } | 588 | } |
589 | 589 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loadlib.c,v 1.87 2010/07/02 11:38:13 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.88 2010/07/25 15:03:37 roberto Exp roberto $ |
3 | ** Dynamic library loader for Lua | 3 | ** Dynamic library loader for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | ** | 5 | ** |
@@ -495,11 +495,10 @@ static int ll_require (lua_State *L) { | |||
495 | ** 'module' function | 495 | ** 'module' function |
496 | ** ======================================================= | 496 | ** ======================================================= |
497 | */ | 497 | */ |
498 | 498 | #if defined(LUA_COMPAT_MODULE) | |
499 | 499 | ||
500 | /* | 500 | /* |
501 | ** FOR COMPATIBILITY ONLY: changes the _ENV variable of | 501 | ** changes the _ENV variable of calling function |
502 | ** calling function | ||
503 | */ | 502 | */ |
504 | static void set_env (lua_State *L) { | 503 | static void set_env (lua_State *L) { |
505 | lua_Debug ar; | 504 | lua_Debug ar; |
@@ -570,6 +569,17 @@ static int ll_seeall (lua_State *L) { | |||
570 | } | 569 | } |
571 | 570 | ||
572 | 571 | ||
572 | #else | ||
573 | |||
574 | static int ll_seeall (lua_State *L) { | ||
575 | return luaL_error(L, "deprecated function"); | ||
576 | } | ||
577 | |||
578 | static int ll_module (lua_State *L) { | ||
579 | return luaL_error(L, "deprecated function"); | ||
580 | } | ||
581 | |||
582 | #endif | ||
573 | /* }====================================================== */ | 583 | /* }====================================================== */ |
574 | 584 | ||
575 | 585 | ||
@@ -648,7 +658,7 @@ LUAMOD_API int luaopen_package (lua_State *L) { | |||
648 | lua_setfield(L, -2, "preload"); | 658 | lua_setfield(L, -2, "preload"); |
649 | lua_pushglobaltable(L); | 659 | lua_pushglobaltable(L); |
650 | lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */ | 660 | lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */ |
651 | luaL_openlib(L, NULL, ll_funcs, 1); /* open lib into global table */ | 661 | luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */ |
652 | lua_pop(L, 1); /* pop global table */ | 662 | lua_pop(L, 1); /* pop global table */ |
653 | return 1; /* return 'package' table */ | 663 | return 1; /* return 'package' table */ |
654 | } | 664 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.110 2010/06/25 12:18:10 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.111 2010/07/02 11:38:13 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1463,8 +1463,8 @@ int luaB_opentests (lua_State *L) { | |||
1463 | lua_assert(lua_getallocf(L, &ud) == debug_realloc); | 1463 | lua_assert(lua_getallocf(L, &ud) == debug_realloc); |
1464 | lua_assert(ud == cast(void *, &l_memcontrol)); | 1464 | lua_assert(ud == cast(void *, &l_memcontrol)); |
1465 | lua_setallocf(L, lua_getallocf(L, NULL), ud); | 1465 | lua_setallocf(L, lua_getallocf(L, NULL), ud); |
1466 | luaL_register(L, "T", tests_funcs); | 1466 | luaL_newlib(L, tests_funcs); |
1467 | return 0; | 1467 | return 1; |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | #endif | 1470 | #endif |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.h,v 2.31 2010/04/12 16:07:29 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 2.32 2010/04/19 17:40:13 roberto Exp roberto $ |
3 | ** Internal Header for Debugging of the Lua Implementation | 3 | ** Internal Header for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -73,7 +73,8 @@ int luaB_opentests (lua_State *L); | |||
73 | 73 | ||
74 | #if defined(lua_c) | 74 | #if defined(lua_c) |
75 | #define luaL_newstate() lua_newstate(debug_realloc, &l_memcontrol) | 75 | #define luaL_newstate() lua_newstate(debug_realloc, &l_memcontrol) |
76 | #define luaL_openlibs(L) { (luaL_openlibs)(L); luaB_opentests(L); } | 76 | #define luaL_openlibs(L) \ |
77 | { (luaL_openlibs)(L); luaL_requiref(L, "T", luaB_opentests, 1); } | ||
77 | #endif | 78 | #endif |
78 | 79 | ||
79 | 80 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.140 2010/07/18 14:34:45 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.141 2010/07/25 15:02:41 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 | */ |
@@ -273,6 +273,12 @@ | |||
273 | /* compatibility with previous wrong spelling */ | 273 | /* compatibility with previous wrong spelling */ |
274 | #define luaL_typerror luaL_typeerror | 274 | #define luaL_typerror luaL_typeerror |
275 | 275 | ||
276 | /* | ||
277 | @@ LUA_COMPAT_MODULE controls compatibility with previous | ||
278 | ** module functions 'module' (Lua) and 'luaL_register' (C). | ||
279 | */ | ||
280 | #define LUA_COMPAT_MODULE | ||
281 | |||
276 | #endif /* LUA_COMPAT_ALL */ | 282 | #endif /* LUA_COMPAT_ALL */ |
277 | 283 | ||
278 | /* }================================================================== */ | 284 | /* }================================================================== */ |