summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-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 @@
26#include "lua.h" 26#include "lua.h"
27 27
28#include "lauxlib.h" 28#include "lauxlib.h"
29#include "rocklib_img.h"
30#include "rocklib.h" 29#include "rocklib.h"
31#include "lib/helper.h" 30#include "lib/helper.h"
32#include "lib/pluginlib_actions.h" 31#include "lib/pluginlib_actions.h"
@@ -416,7 +415,6 @@ static const luaL_Reg rocklib[] =
416#undef RB_FUNC 415#undef RB_FUNC
417 416
418extern const luaL_Reg rocklib_aux[]; 417extern const luaL_Reg rocklib_aux[];
419extern const luaL_Reg rocklib_img[];
420 418
421/* 419/*
422 ** Open Rockbox library 420 ** Open Rockbox library
@@ -425,8 +423,7 @@ LUALIB_API int luaopen_rock(lua_State *L)
425{ 423{
426 luaL_register(L, LUA_ROCKLIBNAME, rocklib); 424 luaL_register(L, LUA_ROCKLIBNAME, rocklib);
427 luaL_register(L, LUA_ROCKLIBNAME, rocklib_aux); 425 luaL_register(L, LUA_ROCKLIBNAME, rocklib_aux);
428 luaL_register(L, LUA_ROCKLIBNAME, rocklib_img); 426
429
430 static const struct lua_int_reg rlib_const_int[] = 427 static const struct lua_int_reg rlib_const_int[] =
431 { 428 {
432 /* useful integer constants */ 429 /* useful integer constants */
@@ -486,8 +483,6 @@ LUALIB_API int luaopen_rock(lua_State *L)
486 lua_setfield(L, -2, rlcs->name); 483 lua_setfield(L, -2, rlcs->name);
487 } 484 }
488 485
489 rli_init(L);
490
491 return 1; 486 return 1;
492} 487}
493 488
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$',
70 '^strl?+cat$', 70 '^strl?+cat$',
71 '^codec_', 71 '^codec_',
72 '^timer_', 72 '^timer_',
73 '^lcd_(mono_)?+bitmap',
73 '^__.+$', 74 '^__.+$',
74 '^.+_(un)?cached$', 75 '^.+_(un)?cached$',
75 '^audio_play$', 76 '^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)
1188#endif /* RLI_EXTENDED */ 1188#endif /* RLI_EXTENDED */
1189 1189
1190/* Rli Image methods exported to lua */ 1190/* Rli Image methods exported to lua */
1191const struct luaL_reg rli_lib [] = 1191static const struct luaL_reg rli_lib [] =
1192{ 1192{
1193 {"__tostring", rli_tostring}, 1193 {"__tostring", rli_tostring},
1194 {"_data", rli_raw}, 1194 {"_data", rli_raw},
@@ -1212,22 +1212,6 @@ const struct luaL_reg rli_lib [] =
1212 {NULL, NULL} 1212 {NULL, NULL}
1213}; 1213};
1214 1214
1215LUALIB_API int rli_init(lua_State *L)
1216{
1217 /* some devices need x | y coords shifted to match native format */
1218 /* conversion between packed native formats and individual pixel addressing */
1219 init_pixelmask(&x_shift, &y_shift, &xy_mask, &pixelmask);
1220
1221 luaL_newmetatable(L, ROCKLUA_IMAGE);
1222
1223 lua_pushvalue(L, -1); /* pushes the metatable */
1224 lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
1225
1226 luaL_register(L, NULL, rli_lib);
1227
1228 return 1;
1229}
1230
1231/* 1215/*
1232 * ----------------------------- 1216 * -----------------------------
1233 * 1217 *
@@ -1402,7 +1386,7 @@ RB_WRAP(read_bmp_file)
1402} 1386}
1403 1387
1404#define R(NAME) {#NAME, rock_##NAME} 1388#define R(NAME) {#NAME, rock_##NAME}
1405const luaL_Reg rocklib_img[] = 1389static const luaL_Reg rocklib_img[] =
1406{ 1390{
1407 /* Graphics */ 1391 /* Graphics */
1408#ifdef HAVE_LCD_BITMAP 1392#ifdef HAVE_LCD_BITMAP
@@ -1430,3 +1414,19 @@ const luaL_Reg rocklib_img[] =
1430}; 1414};
1431#undef R 1415#undef R
1432 1416
1417LUALIB_API int luaopen_rock_img(lua_State *L)
1418{
1419 /* some devices need x | y coords shifted to match native format */
1420 /* conversion between packed native formats and individual pixel addressing */
1421 init_pixelmask(&x_shift, &y_shift, &xy_mask, &pixelmask);
1422
1423 luaL_newmetatable(L, ROCKLUA_IMAGE);
1424
1425 lua_pushvalue(L, -1); /* pushes the metatable */
1426 lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
1427
1428 luaL_register(L, LUA_ROCKLIBNAME, rocklib_img);
1429 luaL_register(L, NULL, rli_lib);
1430
1431 return 1;
1432}
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 @@
26#define RLI_EXTENDED 26#define RLI_EXTENDED
27#endif 27#endif
28 28
29LUALIB_API int rli_init(lua_State *L); 29LUALIB_API int (luaopen_rock_img) (lua_State *L);
30 30
31#endif /* _ROCKLIB_IMG_H_ */ 31#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 @@
24#include "lauxlib.h" 24#include "lauxlib.h"
25#include "lualib.h" 25#include "lualib.h"
26#include "rocklib.h" 26#include "rocklib.h"
27#include "rocklib_img.h"
27#include "luadir.h" 28#include "luadir.h"
28 29
29 30
@@ -34,6 +35,7 @@ static const luaL_Reg lualibs[] = {
34 {LUA_STRLIBNAME, luaopen_string}, 35 {LUA_STRLIBNAME, luaopen_string},
35 {LUA_OSLIBNAME, luaopen_os}, 36 {LUA_OSLIBNAME, luaopen_os},
36 {LUA_ROCKLIBNAME, luaopen_rock}, 37 {LUA_ROCKLIBNAME, luaopen_rock},
38 {LUA_ROCKLIBNAME, luaopen_rock_img},
37 {LUA_BITLIBNAME, luaopen_bit}, 39 {LUA_BITLIBNAME, luaopen_bit},
38 {LUA_IOLIBNAME, luaopen_io}, 40 {LUA_IOLIBNAME, luaopen_io},
39 {LUA_LOADLIBNAME, luaopen_package}, 41 {LUA_LOADLIBNAME, luaopen_package},