luaa: add more deprecation information

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-11-14 12:09:35 +01:00
parent 15f1200f66
commit 3ebcc1aa5a
12 changed files with 26 additions and 21 deletions

View File

@ -943,7 +943,7 @@ luaA_client_visible_get(lua_State *L)
luaA_checkscreen(screen);
deprecate(L);
deprecate(L, "awful.client.visible()");
lua_newtable(L);
@ -1186,7 +1186,7 @@ luaA_client_geometry(lua_State *L)
static int
luaA_client_coords(lua_State *L)
{
deprecate(L);
deprecate(L, "client:geometry()");
return luaA_client_geometry(L);
}
@ -1227,7 +1227,7 @@ luaA_client_fullgeometry(lua_State *L)
static int
luaA_client_fullcoords(lua_State *L)
{
deprecate(L);
deprecate(L, "client:fullgeometry()");
return luaA_client_fullgeometry(L);
}

View File

@ -98,7 +98,7 @@ luaA_hooks_mouse_enter(lua_State *L)
static int
luaA_hooks_mouseover(lua_State *L)
{
deprecate(L);
deprecate(L, "mouse_enter hook");
return luaA_hooks_mouse_enter(L);
}

View File

@ -307,12 +307,12 @@ function focus.bydirection(dir, c)
end
function focusbydirection(dir, c)
util.deprecate()
util.deprecate("focus.bydirection()")
return focus.bydirection(dir, c)
end
function focusbyidx(i, c)
util.deprecate()
util.deprecate("focus.byidx()")
return focus.byidx(i, c)
end
@ -354,7 +354,7 @@ end
-- Compatibility
local function __swap(self, i, c)
util.deprecate()
util.deprecate("swap.byidx()")
swap.byidx(i, c)
end
setmetatable(swap, { __call = __swap })
@ -369,7 +369,7 @@ end
--- Get the master window, deprecated, see getmaster().
function master(screen)
util.deprecate()
util.deprecate("getmaster()")
return getmaster(screen)
end

View File

@ -37,7 +37,7 @@ local deprecated_functions =
for k, v in ipairs(deprecated_functions) do
_M[v] = function (...)
util.deprecate()
util.deprecate("awful.util functions")
util[v](unpack(arg))
end
end

View File

@ -22,8 +22,12 @@ local capi =
--- Utility module for awful
module("awful.util")
function deprecate()
function deprecate(see)
io.stderr:write("W: awful: function is deprecated")
if see then
io.stderr:write(", see " .. see)
end
io.stderr:write("\n")
io.stderr:write(debug.traceback())
end

6
luaa.c
View File

@ -152,7 +152,7 @@ luaA_restart(lua_State *L __attribute__ ((unused)))
static int
luaA_font_set(lua_State *L)
{
deprecate(L);
deprecate(L, "awesome.font attribute");
if(lua_gettop(L) == 1)
{
const char *newfont = luaL_checkstring(L, 1);
@ -176,7 +176,7 @@ luaA_font_set(lua_State *L)
static int
luaA_colors(lua_State *L)
{
deprecate(L);
deprecate(L, "awesome.fg and awesome.bg attributes");
if(lua_gettop(L) == 1)
{
const char *buf;
@ -728,7 +728,7 @@ luaA_spawn(lua_State *L)
static int
luaA_mouse_add(lua_State *L)
{
deprecate(L);
deprecate(L, "awesome.buttons()");
return 0;
}

5
luaa.h
View File

@ -35,8 +35,9 @@
/** Type for Lua function */
typedef int luaA_ref;
#define deprecate(L) luaA_warn(L, "%s: This function is deprecated and will be removed.", \
__FUNCTION__)
#define deprecate(L, repl) \
luaA_warn(L, "%s: This function is deprecated and will be removed, see %s", \
__FUNCTION__, repl)
#define DO_LUA_NEW(decl, type, prefix, lua_type, type_ref) \
decl int \

View File

@ -1378,7 +1378,7 @@ luaA_mouse_coords(lua_State *L)
static int
luaA_mouse_new(lua_State *L)
{
deprecate(L);
deprecate(L, "button()");
return luaA_button_new(L);
}

View File

@ -502,7 +502,7 @@ luaA_screen_index(lua_State *L)
switch(a_tokenize(buf, len))
{
case A_TK_COORDS:
deprecate(L);
deprecate(L, "geometry attribute");
case A_TK_GEOMETRY:
luaA_pusharea(L, s->geometry);
break;

View File

@ -33,7 +33,7 @@
static int
luaA_statusbar_new(lua_State *L)
{
deprecate(L);
deprecate(L, "wibox");
return luaA_wibox_new(L);
}

View File

@ -157,7 +157,7 @@ titlebar_geometry_compute(client_t *c, area_t geometry, area_t *res)
static int
luaA_titlebar_new(lua_State *L)
{
deprecate(L);
deprecate(L, "wibox");
return luaA_wibox_new(L);
}

View File

@ -358,7 +358,7 @@ widget_invalidate_bywidget(widget_t *widget)
static int
luaA_widget_mouse_add(lua_State *L)
{
deprecate(L);
deprecate(L, "widget:buttons()");
return 0;
}
@ -392,7 +392,7 @@ luaA_widget_new(lua_State *L)
if(!a_strcmp(type, "tasklist")
|| !a_strcmp(type, "taglist"))
{
deprecate(L);
deprecate(L, "awful.widget.tasklist and awful.widget.taglist");
luaA_warn(L, "requesting old widgets, return a table to allow smooth execution.\n");
lua_newtable(L);
lua_pushcfunction(L, luaA_widget_mouse_add);