浏览代码

removed and deprecated functions really removed from the code base

Roberto Ierusalimschy 14 年之前
父节点
当前提交
79cbc3468c
共有 4 个文件被更改,包括 17 次插入46 次删除
  1. 4 17
      lbaselib.c
  2. 5 6
      lmathlib.c
  3. 5 12
      loadlib.c
  4. 3 11
      ltablib.c

+ 4 - 17
lbaselib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbaselib.c,v 1.262 2011/06/16 14:12:24 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.263 2011/07/02 15:56:43 roberto Exp roberto $
 ** Basic library
 ** See Copyright Notice in lua.h
 */
@@ -120,11 +120,6 @@ static int luaB_setmetatable (lua_State *L) {
 }
 
 
-static int luaB_removed (lua_State *L) {
-  return luaL_error(L, "removed function");
-}
-
-
 static int luaB_rawequal (lua_State *L) {
   luaL_checkany(L, 1);
   luaL_checkany(L, 2);
@@ -355,14 +350,6 @@ static int luaB_load (lua_State *L) {
   return load_aux(L, status);
 }
 
-
-#if defined(LUA_COMPAT_LOADSTRING)
-#define luaB_loadstring		luaB_load
-#else
-#define luaB_loadstring		luaB_removed
-#endif
-
-
 /* }====================================================== */
 
 
@@ -454,12 +441,13 @@ static const luaL_Reg base_funcs[] = {
   {"collectgarbage", luaB_collectgarbage},
   {"dofile", luaB_dofile},
   {"error", luaB_error},
-  {"getfenv", luaB_removed},
   {"getmetatable", luaB_getmetatable},
   {"ipairs", luaB_ipairs},
   {"loadfile", luaB_loadfile},
   {"load", luaB_load},
-  {"loadstring", luaB_loadstring},
+#if defined(LUA_COMPAT_LOADSTRING)
+  {"loadstring", luaB_load},
+#endif
   {"next", luaB_next},
   {"pairs", luaB_pairs},
   {"pcall", luaB_pcall},
@@ -469,7 +457,6 @@ static const luaL_Reg base_funcs[] = {
   {"rawget", luaB_rawget},
   {"rawset", luaB_rawset},
   {"select", luaB_select},
-  {"setfenv", luaB_removed},
   {"setmetatable", luaB_setmetatable},
   {"tonumber", luaB_tonumber},
   {"tostring", luaB_tostring},

+ 5 - 6
lmathlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lmathlib.c,v 1.78 2010/11/12 15:47:34 roberto Exp roberto $
+** $Id: lmathlib.c,v 1.79 2010/11/18 18:38:27 roberto Exp roberto $
 ** Standard mathematical library
 ** See Copyright Notice in lua.h
 */
@@ -134,15 +134,12 @@ static int math_log (lua_State *L) {
   return 1;
 }
 
+#if defined(LUA_COMPAT_LOG10)
 static int math_log10 (lua_State *L) {
-#if !defined(LUA_COMPAT_LOG10)
-  return luaL_error(L, "function " LUA_QL("log10")
-                       " is deprecated; use log(x, 10) instead");
-#else
   lua_pushnumber(L, l_tg(log10)(luaL_checknumber(L, 1)));
   return 1;
-#endif
 }
+#endif
 
 static int math_exp (lua_State *L) {
   lua_pushnumber(L, l_tg(exp)(luaL_checknumber(L, 1)));
@@ -252,7 +249,9 @@ static const luaL_Reg mathlib[] = {
   {"fmod",   math_fmod},
   {"frexp", math_frexp},
   {"ldexp", math_ldexp},
+#if defined(LUA_COMPAT_LOG10)
   {"log10", math_log10},
+#endif
   {"log",   math_log},
   {"max",   math_max},
   {"min",   math_min},

+ 5 - 12
loadlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: loadlib.c,v 1.98 2011/04/08 19:17:36 roberto Exp roberto $
+** $Id: loadlib.c,v 1.99 2011/06/28 17:13:28 roberto Exp roberto $
 ** Dynamic library loader for Lua
 ** See Copyright Notice in lua.h
 **
@@ -569,17 +569,6 @@ static int ll_seeall (lua_State *L) {
   return 0;
 }
 
-
-#else
-
-static int ll_seeall (lua_State *L) {
-  return luaL_error(L, "deprecated function");
-}
-
-static int ll_module (lua_State *L) {
-  return luaL_error(L, "deprecated function");
-}
-
 #endif
 /* }====================================================== */
 
@@ -610,13 +599,17 @@ static void setpath (lua_State *L, const char *fieldname, const char *envname1,
 static const luaL_Reg pk_funcs[] = {
   {"loadlib", ll_loadlib},
   {"searchpath", ll_searchpath},
+#if defined(LUA_COMPAT_MODULE)
   {"seeall", ll_seeall},
+#endif
   {NULL, NULL}
 };
 
 
 static const luaL_Reg ll_funcs[] = {
+#if defined(LUA_COMPAT_MODULE)
   {"module", ll_module},
+#endif
   {"require", ll_require},
   {NULL, NULL}
 };

+ 3 - 11
ltablib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltablib.c,v 1.59 2010/12/17 12:15:34 roberto Exp roberto $
+** $Id: ltablib.c,v 1.60 2011/07/02 16:01:44 roberto Exp roberto $
 ** Library for Table Manipulation
 ** See Copyright Notice in lua.h
 */
@@ -20,11 +20,6 @@
 	(luaL_checktype(L, n, LUA_TTABLE), luaL_len(L, n))
 
 
-static int removedfunc (lua_State *L) {
-  return luaL_error(L, "removed function");
-}
-
-
 #if defined(LUA_COMPAT_MAXN)
 static int maxn (lua_State *L) {
   lua_Number max = 0;
@@ -40,8 +35,6 @@ static int maxn (lua_State *L) {
   lua_pushnumber(L, max);
   return 1;
 }
-#else
-#define maxn	removedfunc
 #endif
 
 
@@ -267,10 +260,9 @@ static int sort (lua_State *L) {
 
 static const luaL_Reg tab_funcs[] = {
   {"concat", tconcat},
-  {"foreach", removedfunc},
-  {"foreachi", removedfunc},
-  {"getn", removedfunc},
+#if defined(LUA_COMPAT_MAXN)
   {"maxn", maxn},
+#endif
   {"insert", tinsert},
   {"pack", pack},
   {"unpack", unpack},