summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-05-31 14:15:05 +0200
committerWilliam Wilgus <me.theuser@yahoo.com>2018-05-31 14:15:28 +0200
commit4508ee9dbbe704b1e845ba9b15e0f66f2484c308 (patch)
tree8a5ca476d682160b1a4ff2bc2a7f89fb96d19cb2
parent37a20dffb6c285e625f049820a6aaadbbd7952aa (diff)
downloadrockbox-4508ee9dbbe704b1e845ba9b15e0f66f2484c308.tar.gz
rockbox-4508ee9dbbe704b1e845ba9b15e0f66f2484c308.zip
Revert "Rocklua -- Clean-up source"
This reverts commit 0565f671181f10e6eb38156d9f409825e2513290. Removing Typedef from rliimage Change-Id: Ib14241785c73de8ba6dc18ac76bec35eaed4661d
-rw-r--r--apps/plugins/lua/rocklib.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 12ec9c38d7..4b3117243c 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -38,7 +38,7 @@
38 * from Lua in its stack in direct order (the first argument is pushed first). To return values to Lua, 38 * from Lua in its stack in direct order (the first argument is pushed first). To return values to Lua,
39 * a C function just pushes them onto the stack, in direct order (the first result is pushed first), 39 * a C function just pushes them onto the stack, in direct order (the first result is pushed first),
40 * and returns the number of results. Any other value in the stack below the results will be properly 40 * and returns the number of results. Any other value in the stack below the results will be properly
41 * discarded by Lua. Like a Lua function, a C function called by Lua can also return many results. 41 * discarded by Lua. Like a Lua function, a C function called by Lua can also return many results.
42 * 42 *
43 * When porting new functions, don't forget to check rocklib_aux.pl whether it automatically creates 43 * When porting new functions, don't forget to check rocklib_aux.pl whether it automatically creates
44 * wrappers for the function and if so, add the function names to @forbidden_functions. This is to 44 * wrappers for the function and if so, add the function names to @forbidden_functions. This is to
@@ -61,11 +61,11 @@ typedef struct rocklua_image
61 int height; 61 int height;
62 fb_data *data; 62 fb_data *data;
63 fb_data dummy[1][1]; 63 fb_data dummy[1][1];
64} rocklua_image; 64};
65 65
66static void rli_wrap(lua_State *L, fb_data *src, int width, int height) 66static void rli_wrap(lua_State *L, fb_data *src, int width, int height)
67{ 67{
68 rocklua_image *a = (rocklua_image *)lua_newuserdata(L, sizeof(rocklua_image)); 68 struct rocklua_image *a = (struct rocklua_image *)lua_newuserdata(L, sizeof(struct rocklua_image));
69 69
70 luaL_getmetatable(L, ROCKLUA_IMAGE); 70 luaL_getmetatable(L, ROCKLUA_IMAGE);
71 lua_setmetatable(L, -2); 71 lua_setmetatable(L, -2);
@@ -77,8 +77,8 @@ static void rli_wrap(lua_State *L, fb_data *src, int width, int height)
77 77
78static fb_data* rli_alloc(lua_State *L, int width, int height) 78static fb_data* rli_alloc(lua_State *L, int width, int height)
79{ 79{
80 size_t nbytes = sizeof(rocklua_image) + ((width*height) - 1) * sizeof(fb_data); 80 size_t nbytes = sizeof(struct rocklua_image) + ((width*height) - 1) * sizeof(fb_data);
81 rocklua_image *a = (rocklua_image *)lua_newuserdata(L, nbytes); 81 struct rocklua_image *a = (struct rocklua_image *)lua_newuserdata(L, nbytes);
82 82
83 luaL_getmetatable(L, ROCKLUA_IMAGE); 83 luaL_getmetatable(L, ROCKLUA_IMAGE);
84 lua_setmetatable(L, -2); 84 lua_setmetatable(L, -2);
@@ -100,30 +100,30 @@ static int rli_new(lua_State *L)
100 return 1; 100 return 1;
101} 101}
102 102
103static rocklua_image* rli_checktype(lua_State *L, int arg) 103static struct rocklua_image* rli_checktype(lua_State *L, int arg)
104{ 104{
105 void *ud = luaL_checkudata(L, arg, ROCKLUA_IMAGE); 105 void *ud = luaL_checkudata(L, arg, ROCKLUA_IMAGE);
106 luaL_argcheck(L, ud != NULL, arg, "'" ROCKLUA_IMAGE "' expected"); 106 luaL_argcheck(L, ud != NULL, arg, "'" ROCKLUA_IMAGE "' expected");
107 return (rocklua_image*) ud; 107 return (struct rocklua_image*) ud;
108} 108}
109 109
110static int rli_width(lua_State *L) 110static int rli_width(lua_State *L)
111{ 111{
112 rocklua_image *a = rli_checktype(L, 1); 112 struct rocklua_image *a = rli_checktype(L, 1);
113 lua_pushnumber(L, a->width); 113 lua_pushnumber(L, a->width);
114 return 1; 114 return 1;
115} 115}
116 116
117static int rli_height(lua_State *L) 117static int rli_height(lua_State *L)
118{ 118{
119 rocklua_image *a = rli_checktype(L, 1); 119 struct rocklua_image *a = rli_checktype(L, 1);
120 lua_pushnumber(L, a->height); 120 lua_pushnumber(L, a->height);
121 return 1; 121 return 1;
122} 122}
123 123
124static fb_data* rli_element(lua_State *L) 124static fb_data* rli_element(lua_State *L)
125{ 125{
126 rocklua_image *a = rli_checktype(L, 1); 126 struct rocklua_image *a = rli_checktype(L, 1);
127 int x = luaL_checkint(L, 2); 127 int x = luaL_checkint(L, 2);
128 int y = luaL_checkint(L, 3); 128 int y = luaL_checkint(L, 3);
129 129
@@ -151,7 +151,7 @@ static int rli_get(lua_State *L)
151 151
152static int rli_tostring(lua_State *L) 152static int rli_tostring(lua_State *L)
153{ 153{
154 rocklua_image *a = rli_checktype(L, 1); 154 struct rocklua_image *a = rli_checktype(L, 1);
155 lua_pushfstring(L, ROCKLUA_IMAGE ": %dx%d", a->width, a->height); 155 lua_pushfstring(L, ROCKLUA_IMAGE ": %dx%d", a->width, a->height);
156 return 1; 156 return 1;
157} 157}
@@ -269,7 +269,7 @@ RB_WRAP(lcd_framebuffer)
269 269
270RB_WRAP(lcd_mono_bitmap_part) 270RB_WRAP(lcd_mono_bitmap_part)
271{ 271{
272 rocklua_image *src = rli_checktype(L, 1); 272 struct rocklua_image *src = rli_checktype(L, 1);
273 int src_x = luaL_checkint(L, 2); 273 int src_x = luaL_checkint(L, 2);
274 int src_y = luaL_checkint(L, 3); 274 int src_y = luaL_checkint(L, 3);
275 int stride = luaL_checkint(L, 4); 275 int stride = luaL_checkint(L, 4);
@@ -285,7 +285,7 @@ RB_WRAP(lcd_mono_bitmap_part)
285 285
286RB_WRAP(lcd_mono_bitmap) 286RB_WRAP(lcd_mono_bitmap)
287{ 287{
288 rocklua_image *src = rli_checktype(L, 1); 288 struct rocklua_image *src = rli_checktype(L, 1);
289 int x = luaL_checkint(L, 2); 289 int x = luaL_checkint(L, 2);
290 int y = luaL_checkint(L, 3); 290 int y = luaL_checkint(L, 3);
291 int width = luaL_checkint(L, 4); 291 int width = luaL_checkint(L, 4);
@@ -299,7 +299,7 @@ RB_WRAP(lcd_mono_bitmap)
299#if LCD_DEPTH > 1 299#if LCD_DEPTH > 1
300RB_WRAP(lcd_bitmap_part) 300RB_WRAP(lcd_bitmap_part)
301{ 301{
302 rocklua_image *src = rli_checktype(L, 1); 302 struct rocklua_image *src = rli_checktype(L, 1);
303 int src_x = luaL_checkint(L, 2); 303 int src_x = luaL_checkint(L, 2);
304 int src_y = luaL_checkint(L, 3); 304 int src_y = luaL_checkint(L, 3);
305 int stride = luaL_checkint(L, 4); 305 int stride = luaL_checkint(L, 4);
@@ -315,7 +315,7 @@ RB_WRAP(lcd_bitmap_part)
315 315
316RB_WRAP(lcd_bitmap) 316RB_WRAP(lcd_bitmap)
317{ 317{
318 rocklua_image *src = rli_checktype(L, 1); 318 struct rocklua_image *src = rli_checktype(L, 1);
319 int x = luaL_checkint(L, 2); 319 int x = luaL_checkint(L, 2);
320 int y = luaL_checkint(L, 3); 320 int y = luaL_checkint(L, 3);
321 int width = luaL_checkint(L, 4); 321 int width = luaL_checkint(L, 4);
@@ -341,7 +341,7 @@ RB_WRAP(lcd_get_backdrop)
341#if LCD_DEPTH == 16 341#if LCD_DEPTH == 16
342RB_WRAP(lcd_bitmap_transparent_part) 342RB_WRAP(lcd_bitmap_transparent_part)
343{ 343{
344 rocklua_image *src = rli_checktype(L, 1); 344 struct rocklua_image *src = rli_checktype(L, 1);
345 int src_x = luaL_checkint(L, 2); 345 int src_x = luaL_checkint(L, 2);
346 int src_y = luaL_checkint(L, 3); 346 int src_y = luaL_checkint(L, 3);
347 int stride = luaL_checkint(L, 4); 347 int stride = luaL_checkint(L, 4);
@@ -357,7 +357,7 @@ RB_WRAP(lcd_bitmap_transparent_part)
357 357
358RB_WRAP(lcd_bitmap_transparent) 358RB_WRAP(lcd_bitmap_transparent)
359{ 359{
360 rocklua_image *src = rli_checktype(L, 1); 360 struct rocklua_image *src = rli_checktype(L, 1);
361 int x = luaL_checkint(L, 2); 361 int x = luaL_checkint(L, 2);
362 int y = luaL_checkint(L, 3); 362 int y = luaL_checkint(L, 3);
363 int width = luaL_checkint(L, 4); 363 int width = luaL_checkint(L, 4);
@@ -434,7 +434,7 @@ RB_WRAP(font_getstringsize)
434 int fontnumber = luaL_checkint(L, 2); 434 int fontnumber = luaL_checkint(L, 2);
435 int w, h; 435 int w, h;
436 436
437 if(fontnumber == FONT_UI) 437 if (fontnumber == FONT_UI)
438 fontnumber = rb->global_status->font_id[SCREEN_MAIN]; 438 fontnumber = rb->global_status->font_id[SCREEN_MAIN];
439 else 439 else
440 fontnumber = FONT_SYSFIXED; 440 fontnumber = FONT_SYSFIXED;
@@ -670,7 +670,7 @@ RB_WRAP(get_plugin_action)
670#ifdef HAVE_REMOTE_LCD 670#ifdef HAVE_REMOTE_LCD
671 static const struct button_mapping *m2[] = { pla_main_ctx, pla_remote_ctx }; 671 static const struct button_mapping *m2[] = { pla_main_ctx, pla_remote_ctx };
672 bool with_remote = luaL_optint(L, 2, 0); 672 bool with_remote = luaL_optint(L, 2, 0);
673 if(with_remote) 673 if (with_remote)
674 btn = pluginlib_getaction(timeout, m2, 2); 674 btn = pluginlib_getaction(timeout, m2, 2);
675 else 675 else
676#endif 676#endif