summaryrefslogtreecommitdiffstats
path: root/apps/plugins
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-10-22 14:00:58 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2018-10-22 14:00:58 -0400
commit948984309a3c1dd6b92f018926e9831083c803e3 (patch)
treea79bda99ff3d905828f4ea407f912cc22c1c5a4f /apps/plugins
parent7a132a257a47be37daa2da97706745ca9182d14a (diff)
downloadrockbox-948984309a3c1dd6b92f018926e9831083c803e3.tar.gz
rockbox-948984309a3c1dd6b92f018926e9831083c803e3.zip
lua move rocklib_img to its own separate loadable module
allows rocklib_img to be excluded if needed stops rocklib_aux from generating redundant prototypes for lcd_mono_bitmap[_part] Change-Id: Ie208ad71ab5f9a7deb026dc01a5b0a0631a0d29c
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/lua/rocklib.c7
-rwxr-xr-xapps/plugins/lua/rocklib_aux.pl1
-rw-r--r--apps/plugins/lua/rocklib_img.c36
-rw-r--r--apps/plugins/lua/rocklib_img.h2
-rw-r--r--apps/plugins/lua/rocklua.c2
5 files changed, 23 insertions, 25 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index ffd449e9d4..82a03ab6b4 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -26,7 +26,6 @@
#include "lua.h"
#include "lauxlib.h"
-#include "rocklib_img.h"
#include "rocklib.h"
#include "lib/helper.h"
#include "lib/pluginlib_actions.h"
@@ -416,7 +415,6 @@ static const luaL_Reg rocklib[] =
#undef RB_FUNC
extern const luaL_Reg rocklib_aux[];
-extern const luaL_Reg rocklib_img[];
/*
** Open Rockbox library
@@ -425,8 +423,7 @@ LUALIB_API int luaopen_rock(lua_State *L)
{
luaL_register(L, LUA_ROCKLIBNAME, rocklib);
luaL_register(L, LUA_ROCKLIBNAME, rocklib_aux);
- luaL_register(L, LUA_ROCKLIBNAME, rocklib_img);
-
+
static const struct lua_int_reg rlib_const_int[] =
{
/* useful integer constants */
@@ -486,8 +483,6 @@ LUALIB_API int luaopen_rock(lua_State *L)
lua_setfield(L, -2, rlcs->name);
}
- rli_init(L);
-
return 1;
}
diff --git a/apps/plugins/lua/rocklib_aux.pl b/apps/plugins/lua/rocklib_aux.pl
index 8256b838ed..f04457f189 100755
--- a/apps/plugins/lua/rocklib_aux.pl
+++ b/apps/plugins/lua/rocklib_aux.pl
@@ -70,6 +70,7 @@ my @forbidden_functions = ('^open$',
'^strl?+cat$',
'^codec_',
'^timer_',
+ '^lcd_(mono_)?+bitmap',
'^__.+$',
'^.+_(un)?cached$',
'^audio_play$',
diff --git a/apps/plugins/lua/rocklib_img.c b/apps/plugins/lua/rocklib_img.c
index 39f6a51521..909f1b61b9 100644
--- a/apps/plugins/lua/rocklib_img.c
+++ b/apps/plugins/lua/rocklib_img.c
@@ -1188,7 +1188,7 @@ RLI_LUA rli_clear(lua_State *L)
#endif /* RLI_EXTENDED */
/* Rli Image methods exported to lua */
-const struct luaL_reg rli_lib [] =
+static const struct luaL_reg rli_lib [] =
{
{"__tostring", rli_tostring},
{"_data", rli_raw},
@@ -1212,22 +1212,6 @@ const struct luaL_reg rli_lib [] =
{NULL, NULL}
};
-LUALIB_API int rli_init(lua_State *L)
-{
- /* some devices need x | y coords shifted to match native format */
- /* conversion between packed native formats and individual pixel addressing */
- init_pixelmask(&x_shift, &y_shift, &xy_mask, &pixelmask);
-
- luaL_newmetatable(L, ROCKLUA_IMAGE);
-
- lua_pushvalue(L, -1); /* pushes the metatable */
- lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
-
- luaL_register(L, NULL, rli_lib);
-
- return 1;
-}
-
/*
* -----------------------------
*
@@ -1402,7 +1386,7 @@ RB_WRAP(read_bmp_file)
}
#define R(NAME) {#NAME, rock_##NAME}
-const luaL_Reg rocklib_img[] =
+static const luaL_Reg rocklib_img[] =
{
/* Graphics */
#ifdef HAVE_LCD_BITMAP
@@ -1430,3 +1414,19 @@ const luaL_Reg rocklib_img[] =
};
#undef R
+LUALIB_API int luaopen_rock_img(lua_State *L)
+{
+ /* some devices need x | y coords shifted to match native format */
+ /* conversion between packed native formats and individual pixel addressing */
+ init_pixelmask(&x_shift, &y_shift, &xy_mask, &pixelmask);
+
+ luaL_newmetatable(L, ROCKLUA_IMAGE);
+
+ lua_pushvalue(L, -1); /* pushes the metatable */
+ lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
+
+ luaL_register(L, LUA_ROCKLIBNAME, rocklib_img);
+ luaL_register(L, NULL, rli_lib);
+
+ return 1;
+}
diff --git a/apps/plugins/lua/rocklib_img.h b/apps/plugins/lua/rocklib_img.h
index 8b22806862..496bc8dd93 100644
--- a/apps/plugins/lua/rocklib_img.h
+++ b/apps/plugins/lua/rocklib_img.h
@@ -26,6 +26,6 @@
#define RLI_EXTENDED
#endif
-LUALIB_API int rli_init(lua_State *L);
+LUALIB_API int (luaopen_rock_img) (lua_State *L);
#endif /* _ROCKLIB_IMG_H_ */
diff --git a/apps/plugins/lua/rocklua.c b/apps/plugins/lua/rocklua.c
index 48b5d62c37..af87a0bfd7 100644
--- a/apps/plugins/lua/rocklua.c
+++ b/apps/plugins/lua/rocklua.c
@@ -24,6 +24,7 @@
#include "lauxlib.h"
#include "lualib.h"
#include "rocklib.h"
+#include "rocklib_img.h"
#include "luadir.h"
@@ -34,6 +35,7 @@ static const luaL_Reg lualibs[] = {
{LUA_STRLIBNAME, luaopen_string},
{LUA_OSLIBNAME, luaopen_os},
{LUA_ROCKLIBNAME, luaopen_rock},
+ {LUA_ROCKLIBNAME, luaopen_rock_img},
{LUA_BITLIBNAME, luaopen_bit},
{LUA_IOLIBNAME, luaopen_io},
{LUA_LOADLIBNAME, luaopen_package},