From 948984309a3c1dd6b92f018926e9831083c803e3 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Mon, 22 Oct 2018 14:00:58 -0400 Subject: 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 --- apps/plugins/lua/rocklib_img.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'apps/plugins/lua/rocklib_img.c') 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; +} -- cgit v1.2.3