diff options
author | João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com> | 2020-09-21 17:59:09 -0300 |
---|---|---|
committer | Felipe Magno de Almeida <felipe@expertise.dev> | 2021-01-31 11:40:45 -0300 |
commit | 9031750e627107ea10657ef99fdfe080eb830c25 (patch) | |
tree | 6734da1633e7e109dbc777df3ef4ca29302be78b | |
parent | e92f822fc8cf49fee57da88267db6c237f54f2d0 (diff) |
efl: Make lua support optionaldevs/felipealmeida/delivered
-rw-r--r-- | meson.build | 80 | ||||
-rw-r--r-- | meson_options.txt | 2 | ||||
-rw-r--r-- | src/bin/edje/edje_cc_handlers.c | 12 | ||||
-rw-r--r-- | src/bin/edje/edje_cc_out.c | 10 | ||||
-rw-r--r-- | src/examples/edje/meson.build | 9 | ||||
-rw-r--r-- | src/lib/edje/edje_cache.c | 2 | ||||
-rw-r--r-- | src/lib/edje/edje_data.c | 2 | ||||
-rw-r--r-- | src/lib/edje/edje_load.c | 8 | ||||
-rw-r--r-- | src/lib/edje/edje_message_queue.c | 2 | ||||
-rw-r--r-- | src/lib/edje/edje_private.h | 12 | ||||
-rw-r--r-- | src/lib/edje/edje_program.c | 2 | ||||
-rw-r--r-- | src/lib/edje/edje_smart.c | 12 | ||||
-rw-r--r-- | src/lib/edje/meson.build | 11 | ||||
-rw-r--r-- | src/lib/evas/filters/evas_filter_parser.c | 53 | ||||
-rw-r--r-- | src/lib/evas/filters/meson.build | 8 | ||||
-rw-r--r-- | src/tests/evas/evas_suite.c | 2 |
16 files changed, 179 insertions, 48 deletions
diff --git a/meson.build b/meson.build index a4ca8e9a82..7ba71a2533 100644 --- a/meson.build +++ b/meson.build | |||
@@ -261,47 +261,53 @@ ecore_evas_wayland_engine_include_dir = [] | |||
261 | 261 | ||
262 | evas_static_list = [] | 262 | evas_static_list = [] |
263 | 263 | ||
264 | luaold_interpreters = [ | ||
265 | ['lua', ['>=5.1.0', '<5.3.0']], | ||
266 | ['lua51', ['>=5.1.0', '<5.2.0']], | ||
267 | ['lua-5.1', ['>=5.1.0', '<5.2.0']], | ||
268 | ['lua5.1', ['>=5.1.0', '<5.2.0']], | ||
269 | ['lua52', ['>=5.2.0', '<5.3.0']], | ||
270 | ['lua-5.2', ['>=5.2.0', '<5.3.0']], | ||
271 | ['lua5.2', ['>=5.2.0', '<5.3.0']], | ||
272 | ] | ||
273 | |||
274 | lua_pc_name = '' | ||
275 | have_elua = get_option('elua') | 264 | have_elua = get_option('elua') |
276 | 265 | if get_option('lua-interpreter') == 'none' | |
277 | if get_option('lua-interpreter') == 'lua' | 266 | lua_pc_name = [] |
278 | config_h.set('ENABLE_LUA_OLD', '1') | 267 | lua = declare_dependency() |
279 | foreach l : luaold_interpreters | 268 | else |
280 | lua = dependency(l[0], version: l[1], required:false) | 269 | config_h.set('HAVE_LUA', 1) |
281 | lua_pc_name = l[0] | 270 | luaold_interpreters = [ |
282 | if lua.found() | 271 | ['lua', ['>=5.1.0', '<5.3.0']], |
283 | break | 272 | ['lua51', ['>=5.1.0', '<5.2.0']], |
273 | ['lua-5.1', ['>=5.1.0', '<5.2.0']], | ||
274 | ['lua5.1', ['>=5.1.0', '<5.2.0']], | ||
275 | ['lua52', ['>=5.2.0', '<5.3.0']], | ||
276 | ['lua-5.2', ['>=5.2.0', '<5.3.0']], | ||
277 | ['lua5.2', ['>=5.2.0', '<5.3.0']], | ||
278 | ] | ||
279 | |||
280 | lua_pc_name = '' | ||
281 | |||
282 | if get_option('lua-interpreter') == 'lua' | ||
283 | config_h.set('ENABLE_LUA_OLD', '1') | ||
284 | foreach l : luaold_interpreters | ||
285 | lua = dependency(l[0], version: l[1], required:false) | ||
286 | lua_pc_name = l[0] | ||
287 | if lua.found() | ||
288 | break | ||
289 | endif | ||
290 | endforeach | ||
291 | if not lua.found() | ||
292 | error('Lua not found') | ||
284 | endif | 293 | endif |
285 | endforeach | 294 | if have_elua |
286 | if not lua.found() | 295 | message('Using experimental Elua with interpreter support...') |
287 | error('Lua not found') | 296 | endif |
288 | endif | 297 | else |
289 | if have_elua | 298 | lua = dependency(get_option('lua-interpreter')) |
290 | message('Using experimental Elua with interpreter support...') | 299 | lua_pc_name = 'luajit' |
291 | endif | 300 | endif |
292 | else | ||
293 | lua = dependency(get_option('lua-interpreter')) | ||
294 | lua_pc_name = 'luajit' | ||
295 | endif | ||
296 | 301 | ||
297 | if sys_osx and get_option('lua-interpreter') == 'luajit' | 302 | if sys_osx and get_option('lua-interpreter') == 'luajit' |
298 | # luajit on macro is broken, this means we need to generate our own | 303 | # luajit on macro is broken, this means we need to generate our own |
299 | # dependency with our arguments, a library later still needs to link to | 304 | # dependency with our arguments, a library later still needs to link to |
300 | # luajit for the pagesize argument thingy | 305 | # luajit for the pagesize argument thingy |
301 | lua = declare_dependency( | 306 | lua = declare_dependency( |
302 | include_directories: include_directories(lua.get_pkgconfig_variable('includedir')), | 307 | include_directories: include_directories(lua.get_pkgconfig_variable('includedir')), |
303 | link_args: ['-L' + lua.get_pkgconfig_variable('libdir'), '-l' + lua.get_pkgconfig_variable('libname')] | 308 | link_args: ['-L' + lua.get_pkgconfig_variable('libdir'), '-l' + lua.get_pkgconfig_variable('libname')] |
304 | ) | 309 | ) |
310 | endif | ||
305 | endif | 311 | endif |
306 | 312 | ||
307 | subprojects = [ | 313 | subprojects = [ |
diff --git a/meson_options.txt b/meson_options.txt index b1299b9049..995fe2dd89 100644 --- a/meson_options.txt +++ b/meson_options.txt | |||
@@ -341,7 +341,7 @@ option('dotnet', | |||
341 | 341 | ||
342 | option('lua-interpreter', | 342 | option('lua-interpreter', |
343 | type: 'combo', | 343 | type: 'combo', |
344 | choices: ['luajit', 'lua'], | 344 | choices: ['luajit', 'lua', 'none'], |
345 | value: 'luajit', | 345 | value: 'luajit', |
346 | description: 'Which Lua back-end library to use in efl' | 346 | description: 'Which Lua back-end library to use in efl' |
347 | ) | 347 | ) |
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 0ced3e3308..32271549ca 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c | |||
@@ -265,7 +265,9 @@ static void st_collections_group_inherit(void); | |||
265 | static void st_collections_group_program_source(void); | 265 | static void st_collections_group_program_source(void); |
266 | static void st_collections_group_part_remove(void); | 266 | static void st_collections_group_part_remove(void); |
267 | static void st_collections_group_program_remove(void); | 267 | static void st_collections_group_program_remove(void); |
268 | #ifdef HAVE_LUA | ||
268 | static void st_collections_group_lua_script_only(void); | 269 | static void st_collections_group_lua_script_only(void); |
270 | #endif | ||
269 | static void st_collections_group_script_recursion(void); | 271 | static void st_collections_group_script_recursion(void); |
270 | static void st_collections_group_alias(void); | 272 | static void st_collections_group_alias(void); |
271 | static void st_collections_group_min(void); | 273 | static void st_collections_group_min(void); |
@@ -281,7 +283,9 @@ static void st_collections_group_limits_vertical(void); | |||
281 | static void st_collections_group_limits_horizontal(void); | 283 | static void st_collections_group_limits_horizontal(void); |
282 | 284 | ||
283 | static void ob_collections_group_script(void); | 285 | static void ob_collections_group_script(void); |
286 | #ifdef HAVE_LUA | ||
284 | static void ob_collections_group_lua_script(void); | 287 | static void ob_collections_group_lua_script(void); |
288 | #endif | ||
285 | 289 | ||
286 | static void st_collections_group_parts_alias(void); | 290 | static void st_collections_group_parts_alias(void); |
287 | 291 | ||
@@ -674,7 +678,9 @@ New_Statement_Handler statement_handlers[] = | |||
674 | {"collections.group.target_group", st_collections_group_target_group}, /* dup */ | 678 | {"collections.group.target_group", st_collections_group_target_group}, /* dup */ |
675 | {"collections.group.part_remove", st_collections_group_part_remove}, | 679 | {"collections.group.part_remove", st_collections_group_part_remove}, |
676 | {"collections.group.program_remove", st_collections_group_program_remove}, | 680 | {"collections.group.program_remove", st_collections_group_program_remove}, |
681 | #ifdef HAVE_LUA | ||
677 | {"collections.group.lua_script_only", st_collections_group_lua_script_only}, | 682 | {"collections.group.lua_script_only", st_collections_group_lua_script_only}, |
683 | #endif | ||
678 | {"collections.group.script_recursion", st_collections_group_script_recursion}, | 684 | {"collections.group.script_recursion", st_collections_group_script_recursion}, |
679 | {"collections.group.alias", st_collections_group_alias}, | 685 | {"collections.group.alias", st_collections_group_alias}, |
680 | {"collections.group.min", st_collections_group_min}, | 686 | {"collections.group.min", st_collections_group_min}, |
@@ -1371,7 +1377,9 @@ New_Object_Handler object_handlers[] = | |||
1371 | {"collections.group.data", NULL}, | 1377 | {"collections.group.data", NULL}, |
1372 | {"collections.group.limits", NULL}, | 1378 | {"collections.group.limits", NULL}, |
1373 | {"collections.group.script", ob_collections_group_script}, | 1379 | {"collections.group.script", ob_collections_group_script}, |
1380 | #ifdef HAVE_LUA | ||
1374 | {"collections.group.lua_script", ob_collections_group_lua_script}, | 1381 | {"collections.group.lua_script", ob_collections_group_lua_script}, |
1382 | #endif | ||
1375 | {"collections.group.externals", NULL}, /* dup */ | 1383 | {"collections.group.externals", NULL}, /* dup */ |
1376 | {"collections.group.set", ob_images_set}, /* dup */ | 1384 | {"collections.group.set", ob_images_set}, /* dup */ |
1377 | {"collections.group.set.image", ob_images_set_image}, /* dup */ | 1385 | {"collections.group.set.image", ob_images_set_image}, /* dup */ |
@@ -4851,7 +4859,9 @@ st_collections_group_inherit(void) | |||
4851 | pc->prop.min.h = pc2->prop.min.h; | 4859 | pc->prop.min.h = pc2->prop.min.h; |
4852 | pc->prop.orientation = pc2->prop.orientation; | 4860 | pc->prop.orientation = pc2->prop.orientation; |
4853 | 4861 | ||
4862 | #ifdef HAVE_LUA | ||
4854 | pc->lua_script_only = pc2->lua_script_only; | 4863 | pc->lua_script_only = pc2->lua_script_only; |
4864 | #endif | ||
4855 | pc->use_custom_seat_names = pc2->use_custom_seat_names; | 4865 | pc->use_custom_seat_names = pc2->use_custom_seat_names; |
4856 | 4866 | ||
4857 | pcp = (Edje_Part_Collection_Parser *)pc; | 4867 | pcp = (Edje_Part_Collection_Parser *)pc; |
@@ -5034,6 +5044,7 @@ st_collections_group_inherit(void) | |||
5034 | Defaults: off | 5044 | Defaults: off |
5035 | @endproperty | 5045 | @endproperty |
5036 | */ | 5046 | */ |
5047 | #ifdef HAVE_LUA | ||
5037 | static void | 5048 | static void |
5038 | st_collections_group_lua_script_only(void) | 5049 | st_collections_group_lua_script_only(void) |
5039 | { | 5050 | { |
@@ -5044,6 +5055,7 @@ st_collections_group_lua_script_only(void) | |||
5044 | pc = eina_list_data_get(eina_list_last(edje_collections)); | 5055 | pc = eina_list_data_get(eina_list_last(edje_collections)); |
5045 | pc->lua_script_only = parse_bool(0); | 5056 | pc->lua_script_only = parse_bool(0); |
5046 | } | 5057 | } |
5058 | #endif | ||
5047 | 5059 | ||
5048 | /** | 5060 | /** |
5049 | @page edcref | 5061 | @page edcref |
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index dfe41afe50..35e342d10c 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c | |||
@@ -23,8 +23,10 @@ | |||
23 | #include "edje_convert.h" | 23 | #include "edje_convert.h" |
24 | #include "edje_multisense_convert.h" | 24 | #include "edje_multisense_convert.h" |
25 | 25 | ||
26 | #ifdef HAVE_LUA | ||
26 | #include <lua.h> | 27 | #include <lua.h> |
27 | #include <lauxlib.h> | 28 | #include <lauxlib.h> |
29 | #endif | ||
28 | 30 | ||
29 | typedef struct _External_Lookup External_Lookup; | 31 | typedef struct _External_Lookup External_Lookup; |
30 | typedef struct _Part_Lookup Part_Lookup; | 32 | typedef struct _Part_Lookup Part_Lookup; |
@@ -105,6 +107,7 @@ struct _Code_Lookup | |||
105 | Eina_Bool set; | 107 | Eina_Bool set; |
106 | }; | 108 | }; |
107 | 109 | ||
110 | #ifdef HAVE_LUA | ||
108 | typedef struct _Script_Lua_Writer Script_Lua_Writer; | 111 | typedef struct _Script_Lua_Writer Script_Lua_Writer; |
109 | 112 | ||
110 | struct _Script_Lua_Writer | 113 | struct _Script_Lua_Writer |
@@ -112,6 +115,7 @@ struct _Script_Lua_Writer | |||
112 | char *buf; | 115 | char *buf; |
113 | int size; | 116 | int size; |
114 | }; | 117 | }; |
118 | #endif | ||
115 | 119 | ||
116 | typedef struct _Script_Write Script_Write; | 120 | typedef struct _Script_Write Script_Write; |
117 | typedef struct _Head_Write Head_Write; | 121 | typedef struct _Head_Write Head_Write; |
@@ -2438,6 +2442,7 @@ data_write_scripts(Eet_File *ef) | |||
2438 | } | 2442 | } |
2439 | } | 2443 | } |
2440 | 2444 | ||
2445 | #ifdef HAVE_LUA | ||
2441 | #ifdef LUA_BINARY | 2446 | #ifdef LUA_BINARY |
2442 | static int | 2447 | static int |
2443 | _edje_lua_script_writer(lua_State *L EINA_UNUSED, const void *chunk_buf, size_t chunk_size, void *_data) | 2448 | _edje_lua_script_writer(lua_State *L EINA_UNUSED, const void *chunk_buf, size_t chunk_size, void *_data) |
@@ -2637,6 +2642,7 @@ data_write_lua_scripts(Eet_File *ef) | |||
2637 | } | 2642 | } |
2638 | } | 2643 | } |
2639 | } | 2644 | } |
2645 | #endif | ||
2640 | 2646 | ||
2641 | static void | 2647 | static void |
2642 | data_thread_source(void *data, Ecore_Thread *thread EINA_UNUSED) | 2648 | data_thread_source(void *data, Ecore_Thread *thread EINA_UNUSED) |
@@ -2871,8 +2877,10 @@ data_write(void) | |||
2871 | INF("groups: %3.5f", ecore_time_get() - t); t = ecore_time_get(); | 2877 | INF("groups: %3.5f", ecore_time_get() - t); t = ecore_time_get(); |
2872 | data_write_scripts(ef); | 2878 | data_write_scripts(ef); |
2873 | INF("scripts: %3.5f", ecore_time_get() - t); t = ecore_time_get(); | 2879 | INF("scripts: %3.5f", ecore_time_get() - t); t = ecore_time_get(); |
2880 | #ifdef HAVE_LUA | ||
2874 | data_write_lua_scripts(ef); | 2881 | data_write_lua_scripts(ef); |
2875 | INF("lua scripts: %3.5f", ecore_time_get() - t); t = ecore_time_get(); | 2882 | INF("lua scripts: %3.5f", ecore_time_get() - t); t = ecore_time_get(); |
2883 | #endif | ||
2876 | 2884 | ||
2877 | if (!no_save) | 2885 | if (!no_save) |
2878 | { | 2886 | { |
@@ -3795,8 +3803,10 @@ data_process_lookups(void) | |||
3795 | unsigned int count = 0; | 3803 | unsigned int count = 0; |
3796 | unsigned int i; | 3804 | unsigned int i; |
3797 | 3805 | ||
3806 | #ifdef HAVE_LUA | ||
3798 | if (pc->lua_script_only) | 3807 | if (pc->lua_script_only) |
3799 | is_lua = EINA_TRUE; | 3808 | is_lua = EINA_TRUE; |
3809 | #endif | ||
3800 | #define PROGRAM_ID_SET(Type, Pc, It, Count) \ | 3810 | #define PROGRAM_ID_SET(Type, Pc, It, Count) \ |
3801 | for (It = 0; It < Pc->programs.Type ## _count; ++It) \ | 3811 | for (It = 0; It < Pc->programs.Type ## _count; ++It) \ |
3802 | { \ | 3812 | { \ |
diff --git a/src/examples/edje/meson.build b/src/examples/edje/meson.build index ff57a6e29e..f60835e6f6 100644 --- a/src/examples/edje/meson.build +++ b/src/examples/edje/meson.build | |||
@@ -28,7 +28,6 @@ edc_files = [ | |||
28 | 'external_elm_panes.edc', | 28 | 'external_elm_panes.edc', |
29 | 'external_emotion_elm.edc', | 29 | 'external_emotion_elm.edc', |
30 | 'focus.edc', | 30 | 'focus.edc', |
31 | 'lua_script.edc', | ||
32 | 'messages_echo.edc', | 31 | 'messages_echo.edc', |
33 | 'multiseat.edc', | 32 | 'multiseat.edc', |
34 | 'multiseat_custom_names.edc', | 33 | 'multiseat_custom_names.edc', |
@@ -36,7 +35,6 @@ edc_files = [ | |||
36 | 'perspective.edc', | 35 | 'perspective.edc', |
37 | 'signals-messages.edc', | 36 | 'signals-messages.edc', |
38 | 'signalsBubble.edc', | 37 | 'signalsBubble.edc', |
39 | 'sigtest.edc', | ||
40 | 'svg.edc', | 38 | 'svg.edc', |
41 | 'swallow.edc', | 39 | 'swallow.edc', |
42 | 'table.edc', | 40 | 'table.edc', |
@@ -47,6 +45,13 @@ edc_files = [ | |||
47 | 'center_zoom.edc', | 45 | 'center_zoom.edc', |
48 | ] | 46 | ] |
49 | 47 | ||
48 | if get_option('lua-interpreter') != 'none' | ||
49 | edc_files += [ | ||
50 | 'lua_script.edc', | ||
51 | 'sigtest.edc', | ||
52 | ] | ||
53 | endif | ||
54 | |||
50 | if (get_option('physics')) | 55 | if (get_option('physics')) |
51 | edc_files += [ | 56 | edc_files += [ |
52 | 'physics_3d.edc', | 57 | 'physics_3d.edc', |
diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c index ce61f146fa..c913323406 100644 --- a/src/lib/edje/edje_cache.c +++ b/src/lib/edje/edje_cache.c | |||
@@ -329,6 +329,7 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) | |||
329 | free(data); | 329 | free(data); |
330 | } | 330 | } |
331 | 331 | ||
332 | #ifdef HAVE_LUA | ||
332 | snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", id); | 333 | snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", id); |
333 | data = eet_read(edf->ef, buf, &size); | 334 | data = eet_read(edf->ef, buf, &size); |
334 | 335 | ||
@@ -337,6 +338,7 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) | |||
337 | _edje_lua2_script_load(edc, data, size); | 338 | _edje_lua2_script_load(edc, data, size); |
338 | free(data); | 339 | free(data); |
339 | } | 340 | } |
341 | #endif | ||
340 | 342 | ||
341 | ce->ref = edc; | 343 | ce->ref = edc; |
342 | 344 | ||
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c index 020393246d..a7a9ecab9f 100644 --- a/src/lib/edje/edje_data.c +++ b/src/lib/edje/edje_data.c | |||
@@ -1302,7 +1302,9 @@ _edje_edd_init(void) | |||
1302 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.w", prop.max.w, EET_T_INT); | 1302 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.w", prop.max.w, EET_T_INT); |
1303 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.h", prop.max.h, EET_T_INT); | 1303 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.h", prop.max.h, EET_T_INT); |
1304 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "part", part, EET_T_STRING); | 1304 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "part", part, EET_T_STRING); |
1305 | #ifdef HAVE_LUA | ||
1305 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "lua_script_only", lua_script_only, EET_T_UCHAR); | 1306 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "lua_script_only", lua_script_only, EET_T_UCHAR); |
1307 | #endif | ||
1306 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.orientation", prop.orientation, EET_T_INT); | 1308 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.orientation", prop.orientation, EET_T_INT); |
1307 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "broadcast_signal", broadcast_signal, EET_T_UCHAR); | 1309 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "broadcast_signal", broadcast_signal, EET_T_UCHAR); |
1308 | #ifdef HAVE_EPHYSICS | 1310 | #ifdef HAVE_EPHYSICS |
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 86039e97b0..b5b0b0bf40 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c | |||
@@ -793,7 +793,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch | |||
793 | if (collect) | 793 | if (collect) |
794 | part_match = eina_hash_string_superfast_new(NULL); | 794 | part_match = eina_hash_string_superfast_new(NULL); |
795 | 795 | ||
796 | #ifdef HAVE_LUA | ||
796 | if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed); | 797 | if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed); |
798 | #endif | ||
797 | 799 | ||
798 | #ifdef HAVE_EPHYSICS | 800 | #ifdef HAVE_EPHYSICS |
799 | /* clear physics world / shutdown ephysics */ | 801 | /* clear physics world / shutdown ephysics */ |
@@ -837,12 +839,14 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch | |||
837 | 839 | ||
838 | ed->groups = eina_list_append(ed->groups, ed); | 840 | ed->groups = eina_list_append(ed->groups, ed); |
839 | 841 | ||
842 | #ifdef HAVE_LUA | ||
840 | if (ed->collection->lua_script_only) | 843 | if (ed->collection->lua_script_only) |
841 | { | 844 | { |
842 | ed->load_error = EDJE_LOAD_ERROR_NONE; | 845 | ed->load_error = EDJE_LOAD_ERROR_NONE; |
843 | _edje_lua_script_only_init(ed); | 846 | _edje_lua_script_only_init(ed); |
844 | } | 847 | } |
845 | else | 848 | else |
849 | #endif | ||
846 | { | 850 | { |
847 | unsigned int i; | 851 | unsigned int i; |
848 | 852 | ||
@@ -2071,7 +2075,9 @@ _edje_file_del(Edje *ed) | |||
2071 | ed->seats_count = 0; | 2075 | ed->seats_count = 0; |
2072 | } | 2076 | } |
2073 | 2077 | ||
2078 | #ifdef HAVE_LUA | ||
2074 | if (ed->L) _edje_lua2_script_shutdown(ed); | 2079 | if (ed->L) _edje_lua2_script_shutdown(ed); |
2080 | #endif | ||
2075 | while (ed->subobjs) | 2081 | while (ed->subobjs) |
2076 | _edje_subobj_unregister(ed, ed->subobjs->data); | 2082 | _edje_subobj_unregister(ed, ed->subobjs->data); |
2077 | if (ed->table_parts) free(ed->table_parts); | 2083 | if (ed->table_parts) free(ed->table_parts); |
@@ -2370,7 +2376,9 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collec | |||
2370 | ec->patterns.table_programs_size = 0; | 2376 | ec->patterns.table_programs_size = 0; |
2371 | 2377 | ||
2372 | if (ec->script) embryo_program_free(ec->script); | 2378 | if (ec->script) embryo_program_free(ec->script); |
2379 | #ifdef HAVE_LUA | ||
2373 | _edje_lua2_script_unload(ec); | 2380 | _edje_lua2_script_unload(ec); |
2381 | #endif | ||
2374 | 2382 | ||
2375 | if (ec->limits.parts) free(ec->limits.parts); | 2383 | if (ec->limits.parts) free(ec->limits.parts); |
2376 | 2384 | ||
diff --git a/src/lib/edje/edje_message_queue.c b/src/lib/edje/edje_message_queue.c index a4da7ea52d..a39a312daf 100644 --- a/src/lib/edje/edje_message_queue.c +++ b/src/lib/edje/edje_message_queue.c | |||
@@ -840,11 +840,13 @@ _edje_message_process(Edje_Message *em) | |||
840 | } | 840 | } |
841 | /* now this message is destined for the script message handler fn */ | 841 | /* now this message is destined for the script message handler fn */ |
842 | if (!(em->edje->collection)) return; | 842 | if (!(em->edje->collection)) return; |
843 | #ifdef HAVE_LUA | ||
843 | if (em->edje->L) | 844 | if (em->edje->L) |
844 | { | 845 | { |
845 | _edje_lua_script_only_message(em->edje, em); | 846 | _edje_lua_script_only_message(em->edje, em); |
846 | return; | 847 | return; |
847 | } | 848 | } |
849 | #endif | ||
848 | fn = embryo_program_function_find(em->edje->collection->script, "message"); | 850 | fn = embryo_program_function_find(em->edje->collection->script, "message"); |
849 | if (fn == EMBRYO_FUNCTION_NONE) return; | 851 | if (fn == EMBRYO_FUNCTION_NONE) return; |
850 | /* reset the engine */ | 852 | /* reset the engine */ |
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index ec6a7c407b..3ef6f576c6 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h | |||
@@ -31,9 +31,11 @@ | |||
31 | 31 | ||
32 | #include <fcntl.h> | 32 | #include <fcntl.h> |
33 | 33 | ||
34 | #ifdef HAVE_LUA | ||
34 | #include <lua.h> | 35 | #include <lua.h> |
35 | #include <lualib.h> | 36 | #include <lualib.h> |
36 | #include <lauxlib.h> | 37 | #include <lauxlib.h> |
38 | #endif | ||
37 | #include <setjmp.h> | 39 | #include <setjmp.h> |
38 | 40 | ||
39 | // auto_unref | 41 | // auto_unref |
@@ -1123,7 +1125,9 @@ struct _Edje_Part_Collection | |||
1123 | } patterns; | 1125 | } patterns; |
1124 | /* *** *** */ | 1126 | /* *** *** */ |
1125 | 1127 | ||
1128 | #ifdef HAVE_LUA | ||
1126 | unsigned char lua_script_only; | 1129 | unsigned char lua_script_only; |
1130 | #endif | ||
1127 | unsigned char broadcast_signal; | 1131 | unsigned char broadcast_signal; |
1128 | unsigned char physics_enabled; /* will be 1 if a body is declared */ | 1132 | unsigned char physics_enabled; /* will be 1 if a body is declared */ |
1129 | unsigned char script_recursion; /* permits unsafe Embryo->EDC->Embryo scripting */ | 1133 | unsigned char script_recursion; /* permits unsafe Embryo->EDC->Embryo scripting */ |
@@ -1585,12 +1589,16 @@ struct _Edje | |||
1585 | double duration_scale; | 1589 | double duration_scale; |
1586 | double paused_at; | 1590 | double paused_at; |
1587 | Eina_Hash *user_defined; | 1591 | Eina_Hash *user_defined; |
1592 | #ifdef HAVE_LUA | ||
1588 | lua_State *L; | 1593 | lua_State *L; |
1589 | Eina_Inlist *lua_objs; | 1594 | Eina_Inlist *lua_objs; |
1595 | #endif | ||
1590 | 1596 | ||
1591 | Eina_Inlist *messages; | 1597 | Eina_Inlist *messages; |
1592 | 1598 | ||
1599 | #ifdef HAVE_LUA | ||
1593 | int lua_ref; | 1600 | int lua_ref; |
1601 | #endif | ||
1594 | int processing_messages; | 1602 | int processing_messages; |
1595 | int references; | 1603 | int references; |
1596 | 1604 | ||
@@ -2718,6 +2726,7 @@ void _edje_embryo_globals_init(Edje *ed); | |||
2718 | if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \ | 2726 | if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \ |
2719 | *___cptr = (int)val; } } | 2727 | *___cptr = (int)val; } } |
2720 | 2728 | ||
2729 | #ifdef HAVE_LUA | ||
2721 | extern jmp_buf _edje_lua_panic_jmp; | 2730 | extern jmp_buf _edje_lua_panic_jmp; |
2722 | #define _edje_lua_panic_here() setjmp(_edje_lua_panic_jmp) | 2731 | #define _edje_lua_panic_here() setjmp(_edje_lua_panic_jmp) |
2723 | 2732 | ||
@@ -2744,6 +2753,7 @@ void _edje_lua_script_only_hide(Edje *ed); | |||
2744 | void _edje_lua_script_only_move(Edje *ed); | 2753 | void _edje_lua_script_only_move(Edje *ed); |
2745 | void _edje_lua_script_only_resize(Edje *ed); | 2754 | void _edje_lua_script_only_resize(Edje *ed); |
2746 | void _edje_lua_script_only_message(Edje *ed, Edje_Message *em); | 2755 | void _edje_lua_script_only_message(Edje *ed, Edje_Message *em); |
2756 | #endif | ||
2747 | 2757 | ||
2748 | void _edje_entry_init(Edje *ed); | 2758 | void _edje_entry_init(Edje *ed); |
2749 | void _edje_entry_shutdown(Edje *ed); | 2759 | void _edje_entry_shutdown(Edje *ed); |
@@ -2868,6 +2878,7 @@ void edje_object_propagate_callback_add(Evas_Object *obj, void (*func) (void *da | |||
2868 | EDJE_API void _edje_program_insert(Edje_Part_Collection *ed, Edje_Program *p); | 2878 | EDJE_API void _edje_program_insert(Edje_Part_Collection *ed, Edje_Program *p); |
2869 | EDJE_API void _edje_program_remove(Edje_Part_Collection *ed, Edje_Program *p); | 2879 | EDJE_API void _edje_program_remove(Edje_Part_Collection *ed, Edje_Program *p); |
2870 | 2880 | ||
2881 | #ifdef HAVE_LUA | ||
2871 | void _edje_lua2_error_full(const char *file, const char *fnc, int line, lua_State *L, int err_code); | 2882 | void _edje_lua2_error_full(const char *file, const char *fnc, int line, lua_State *L, int err_code); |
2872 | #define _edje_lua2_error(L, err_code) _edje_lua2_error_full(__FILE__, __func__, __LINE__, L, err_code) | 2883 | #define _edje_lua2_error(L, err_code) _edje_lua2_error_full(__FILE__, __func__, __LINE__, L, err_code) |
2873 | void _edje_lua2_script_init(Edje *ed); | 2884 | void _edje_lua2_script_init(Edje *ed); |
@@ -2882,6 +2893,7 @@ void _edje_lua2_script_func_move(Edje *ed); | |||
2882 | void _edje_lua2_script_func_resize(Edje *ed); | 2893 | void _edje_lua2_script_func_resize(Edje *ed); |
2883 | void _edje_lua2_script_func_message(Edje *ed, Edje_Message *em); | 2894 | void _edje_lua2_script_func_message(Edje *ed, Edje_Message *em); |
2884 | void _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src); | 2895 | void _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src); |
2896 | #endif | ||
2885 | 2897 | ||
2886 | const char *edje_string_get(const Edje_String *es); | 2898 | const char *edje_string_get(const Edje_String *es); |
2887 | const char *edje_string_id_get(const Edje_String *es); | 2899 | const char *edje_string_id_get(const Edje_String *es); |
diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c index 34b4b5c74c..ee3ffe6312 100644 --- a/src/lib/edje/edje_program.c +++ b/src/lib/edje/edje_program.c | |||
@@ -1538,8 +1538,10 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src, | |||
1538 | _edje_ref(ed); | 1538 | _edje_ref(ed); |
1539 | _edje_util_freeze(ed); | 1539 | _edje_util_freeze(ed); |
1540 | 1540 | ||
1541 | #ifdef HAVE_LUA | ||
1541 | if (ed->collection && ed->L) | 1542 | if (ed->collection && ed->L) |
1542 | _edje_lua2_script_func_signal(ed, sig, src); | 1543 | _edje_lua2_script_func_signal(ed, sig, src); |
1544 | #endif | ||
1543 | 1545 | ||
1544 | if (ed->collection) | 1546 | if (ed->collection) |
1545 | { | 1547 | { |
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index f7ad19fe02..c6fe3409ff 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c | |||
@@ -166,7 +166,9 @@ _efl_canvas_layout_efl_canvas_group_group_del(Eo *obj, Edje *ed) | |||
166 | _edje_block_violate(ed); | 166 | _edje_block_violate(ed); |
167 | ed->delete_me = 1; | 167 | ed->delete_me = 1; |
168 | _edje_edjes = eina_inlist_remove(_edje_edjes, EINA_INLIST_GET(ed)); | 168 | _edje_edjes = eina_inlist_remove(_edje_edjes, EINA_INLIST_GET(ed)); |
169 | #ifdef HAVE_LUA | ||
169 | if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed); | 170 | if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed); |
171 | #endif | ||
170 | #ifdef HAVE_EPHYSICS | 172 | #ifdef HAVE_EPHYSICS |
171 | /* clear physics world / shutdown ephysics */ | 173 | /* clear physics world / shutdown ephysics */ |
172 | if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world)) | 174 | if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world)) |
@@ -200,11 +202,13 @@ _efl_canvas_layout_efl_gfx_entity_position_set(Eo *obj, Edje *ed, Eina_Position2 | |||
200 | ed->y = pos.y; | 202 | ed->y = pos.y; |
201 | // evas_object_move(ed->clipper, ed->x, ed->y); | 203 | // evas_object_move(ed->clipper, ed->x, ed->y); |
202 | 204 | ||
205 | #ifdef HAVE_LUA | ||
203 | if (_edje_lua_script_only(ed)) | 206 | if (_edje_lua_script_only(ed)) |
204 | { | 207 | { |
205 | _edje_lua_script_only_move(ed); | 208 | _edje_lua_script_only_move(ed); |
206 | return; | 209 | return; |
207 | } | 210 | } |
211 | #endif | ||
208 | 212 | ||
209 | for (i = 0; i < ed->table_parts_size; i++) | 213 | for (i = 0; i < ed->table_parts_size; i++) |
210 | { | 214 | { |
@@ -314,11 +318,13 @@ _efl_canvas_layout_efl_gfx_entity_size_set(Eo *obj, Edje *ed, Eina_Size2D sz) | |||
314 | #ifdef EDJE_CALC_CACHE | 318 | #ifdef EDJE_CALC_CACHE |
315 | ed->all_part_change = EINA_TRUE; | 319 | ed->all_part_change = EINA_TRUE; |
316 | #endif | 320 | #endif |
321 | #ifdef HAVE_LUA | ||
317 | if (_edje_lua_script_only(ed)) | 322 | if (_edje_lua_script_only(ed)) |
318 | { | 323 | { |
319 | _edje_lua_script_only_resize(ed); | 324 | _edje_lua_script_only_resize(ed); |
320 | goto super; | 325 | goto super; |
321 | } | 326 | } |
327 | #endif | ||
322 | // evas_object_resize(ed->clipper, ed->w, ed->h); | 328 | // evas_object_resize(ed->clipper, ed->w, ed->h); |
323 | ed->dirty = EINA_TRUE; | 329 | ed->dirty = EINA_TRUE; |
324 | _edje_recalc_do(ed); | 330 | _edje_recalc_do(ed); |
@@ -335,11 +341,13 @@ _edje_object_show(Eo *obj, Edje *ed) | |||
335 | Edje *edg; | 341 | Edje *edg; |
336 | 342 | ||
337 | efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), EINA_TRUE); | 343 | efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), EINA_TRUE); |
344 | #ifdef HAVE_LUA | ||
338 | if (_edje_lua_script_only(ed)) | 345 | if (_edje_lua_script_only(ed)) |
339 | { | 346 | { |
340 | _edje_lua_script_only_show(ed); | 347 | _edje_lua_script_only_show(ed); |
341 | return; | 348 | return; |
342 | } | 349 | } |
350 | #endif | ||
343 | if (eina_list_count(ed->groups) > 1) | 351 | if (eina_list_count(ed->groups) > 1) |
344 | { | 352 | { |
345 | EINA_LIST_FOREACH(ed->groups, l, edg) | 353 | EINA_LIST_FOREACH(ed->groups, l, edg) |
@@ -362,11 +370,13 @@ _edje_object_hide(Eo *obj, Edje *ed) | |||
362 | Edje *edg; | 370 | Edje *edg; |
363 | 371 | ||
364 | efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), EINA_FALSE); | 372 | efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), EINA_FALSE); |
373 | #ifdef HAVE_LUA | ||
365 | if (_edje_lua_script_only(ed)) | 374 | if (_edje_lua_script_only(ed)) |
366 | { | 375 | { |
367 | _edje_lua_script_only_hide(ed); | 376 | _edje_lua_script_only_hide(ed); |
368 | return; | 377 | return; |
369 | } | 378 | } |
379 | #endif | ||
370 | EINA_LIST_FOREACH(ed->groups, l, edg) | 380 | EINA_LIST_FOREACH(ed->groups, l, edg) |
371 | if (edg != ed) evas_object_hide(edg->obj); | 381 | if (edg != ed) evas_object_hide(edg->obj); |
372 | _edje_emit(ed, "hide", NULL); | 382 | _edje_emit(ed, "hide", NULL); |
@@ -406,7 +416,9 @@ EOLIAN static void | |||
406 | _efl_canvas_layout_efl_file_unload(Eo *obj, Edje *ed) | 416 | _efl_canvas_layout_efl_file_unload(Eo *obj, Edje *ed) |
407 | { | 417 | { |
408 | efl_file_unload(efl_super(obj, MY_CLASS)); | 418 | efl_file_unload(efl_super(obj, MY_CLASS)); |
419 | #ifdef HAVE_LUA | ||
409 | if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed); | 420 | if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed); |
421 | #endif | ||
410 | #ifdef HAVE_EPHYSICS | 422 | #ifdef HAVE_EPHYSICS |
411 | /* clear physics world / shutdown ephysics */ | 423 | /* clear physics world / shutdown ephysics */ |
412 | if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world)) | 424 | if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world)) |
diff --git a/src/lib/edje/meson.build b/src/lib/edje/meson.build index 4f7ccce899..5614fb86f7 100644 --- a/src/lib/edje/meson.build +++ b/src/lib/edje/meson.build | |||
@@ -124,9 +124,6 @@ edje_src = files([ | |||
124 | 'edje_entry.c', | 124 | 'edje_entry.c', |
125 | 'edje_external.c', | 125 | 'edje_external.c', |
126 | 'edje_load.c', | 126 | 'edje_load.c', |
127 | 'edje_lua.c', | ||
128 | 'edje_lua2.c', | ||
129 | 'edje_lua_script_only.c', | ||
130 | 'edje_main.c', | 127 | 'edje_main.c', |
131 | 'edje_match.c', | 128 | 'edje_match.c', |
132 | 'edje_message_queue.c', | 129 | 'edje_message_queue.c', |
@@ -152,6 +149,14 @@ edje_src = files([ | |||
152 | 'edje_part_invalid.c' | 149 | 'edje_part_invalid.c' |
153 | ]) | 150 | ]) |
154 | 151 | ||
152 | if get_option('lua-interpreter') != 'none' | ||
153 | edje_src += files([ | ||
154 | 'edje_lua.c', | ||
155 | 'edje_lua2.c', | ||
156 | 'edje_lua_script_only.c', | ||
157 | ]) | ||
158 | endif | ||
159 | |||
155 | edje_lib = library('edje', | 160 | edje_lib = library('edje', |
156 | edje_src, pub_eo_file_target, priv_eo_file_target, | 161 | edje_src, pub_eo_file_target, priv_eo_file_target, |
157 | dependencies: edje_pub_deps + edje_deps + edje_ext_deps, | 162 | dependencies: edje_pub_deps + edje_deps + edje_ext_deps, |
diff --git a/src/lib/evas/filters/evas_filter_parser.c b/src/lib/evas/filters/evas_filter_parser.c index 9a8537849a..ff170099fd 100644 --- a/src/lib/evas/filters/evas_filter_parser.c +++ b/src/lib/evas/filters/evas_filter_parser.c | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | #include <stdarg.h> | 3 | #include <stdarg.h> |
4 | 4 | ||
5 | #ifdef HAVE_LUA | ||
5 | // Lua breaks API all the time | 6 | // Lua breaks API all the time |
6 | #ifdef ENABLE_LUA_OLD | 7 | #ifdef ENABLE_LUA_OLD |
7 | // For 5.2 --> 5.1 compatibility | 8 | // For 5.2 --> 5.1 compatibility |
@@ -13,6 +14,7 @@ | |||
13 | #include <lua.h> | 14 | #include <lua.h> |
14 | #include <lualib.h> | 15 | #include <lualib.h> |
15 | #include <lauxlib.h> | 16 | #include <lauxlib.h> |
17 | #endif | ||
16 | 18 | ||
17 | #define FILTERS_LEGACY_COMPAT | 19 | #define FILTERS_LEGACY_COMPAT |
18 | 20 | ||
@@ -242,15 +244,17 @@ static struct | |||
242 | { "stretch_xy", EVAS_FILTER_FILL_MODE_STRETCH_XY } | 244 | { "stretch_xy", EVAS_FILTER_FILL_MODE_STRETCH_XY } |
243 | }; | 245 | }; |
244 | 246 | ||
247 | #ifdef HAVE_LUA | ||
245 | static const char *_lua_buffer_meta = "buffer"; | 248 | static const char *_lua_buffer_meta = "buffer"; |
246 | static const char *_lua_color_meta = "color"; | 249 | static const char *_lua_color_meta = "color"; |
247 | #define _lua_methods_table "__methods" | 250 | #define _lua_methods_table "__methods" |
248 | #define _lua_register_func "__register" | 251 | #define _lua_register_func "__register" |
249 | #define _lua_errfunc_name "__backtrace" | 252 | #define _lua_errfunc_name "__backtrace" |
250 | 253 | ||
251 | static Evas_Filter_Fill_Mode _fill_mode_get(Evas_Filter_Instruction *instr); | ||
252 | static Eina_Bool _lua_instruction_run(lua_State *L, Evas_Filter_Instruction *instr); | 254 | static Eina_Bool _lua_instruction_run(lua_State *L, Evas_Filter_Instruction *instr); |
253 | static int _lua_backtrace(lua_State *L); | 255 | static int _lua_backtrace(lua_State *L); |
256 | #endif | ||
257 | static Evas_Filter_Fill_Mode _fill_mode_get(Evas_Filter_Instruction *instr); | ||
254 | 258 | ||
255 | typedef enum | 259 | typedef enum |
256 | { | 260 | { |
@@ -293,7 +297,9 @@ struct _Instruction_Param | |||
293 | Buffer *buf; | 297 | Buffer *buf; |
294 | struct { | 298 | struct { |
295 | void *data; | 299 | void *data; |
300 | #ifdef HAVE_LUA | ||
296 | Eina_Bool (*func)(lua_State *L, int i, Evas_Filter_Program *, Evas_Filter_Instruction *, Instruction_Param *); | 301 | Eina_Bool (*func)(lua_State *L, int i, Evas_Filter_Program *, Evas_Filter_Instruction *, Instruction_Param *); |
302 | #endif | ||
297 | } special; | 303 | } special; |
298 | } value; | 304 | } value; |
299 | Eina_Bool set : 1; | 305 | Eina_Bool set : 1; |
@@ -308,7 +314,9 @@ struct _Evas_Filter_Instruction | |||
308 | int /*Evas_Filter_Mode*/ type; | 314 | int /*Evas_Filter_Mode*/ type; |
309 | Eina_Inlist /* Instruction_Param */ *params; | 315 | Eina_Inlist /* Instruction_Param */ *params; |
310 | int return_count; | 316 | int return_count; |
317 | #ifdef HAVE_LUA | ||
311 | Eina_Bool (* parse_run) (lua_State *L, Evas_Filter_Program *, Evas_Filter_Instruction *); | 318 | Eina_Bool (* parse_run) (lua_State *L, Evas_Filter_Program *, Evas_Filter_Instruction *); |
319 | #endif | ||
312 | struct | 320 | struct |
313 | { | 321 | { |
314 | int (* update) (Evas_Filter_Program *, Evas_Filter_Instruction *, int *, int *, int *, int *); | 322 | int (* update) (Evas_Filter_Program *, Evas_Filter_Instruction *, int *, int *, int *, int *); |
@@ -328,8 +336,10 @@ struct _Evas_Filter_Program | |||
328 | } pad; | 336 | } pad; |
329 | Efl_Canvas_Filter_State state; | 337 | Efl_Canvas_Filter_State state; |
330 | Eina_Inlist *data; // Evas_Filter_Data_Binding | 338 | Eina_Inlist *data; // Evas_Filter_Data_Binding |
339 | #ifdef HAVE_LUA | ||
331 | lua_State *L; | 340 | lua_State *L; |
332 | int lua_func; | 341 | int lua_func; |
342 | #endif | ||
333 | int last_bufid; | 343 | int last_bufid; |
334 | Eina_Bool valid : 1; | 344 | Eina_Bool valid : 1; |
335 | Eina_Bool padding_calc : 1; // Padding has been calculated | 345 | Eina_Bool padding_calc : 1; // Padding has been calculated |
@@ -382,7 +392,9 @@ _instruction_param_addv(Evas_Filter_Instruction *instr, const char *name, | |||
382 | param->value.c = va_arg(args, DATA32); | 392 | param->value.c = va_arg(args, DATA32); |
383 | break; | 393 | break; |
384 | case VT_SPECIAL: | 394 | case VT_SPECIAL: |
395 | #ifdef HAVE_LUA | ||
385 | param->value.special.func = va_arg(args, typeof(param->value.special.func)); | 396 | param->value.special.func = va_arg(args, typeof(param->value.special.func)); |
397 | #endif | ||
386 | param->value.special.data = va_arg(args, void *); | 398 | param->value.special.data = va_arg(args, void *); |
387 | break; | 399 | break; |
388 | case VT_NONE: | 400 | case VT_NONE: |
@@ -616,6 +628,7 @@ _buffer_get(Evas_Filter_Program *pgm, const char *name) | |||
616 | return NULL; | 628 | return NULL; |
617 | } | 629 | } |
618 | 630 | ||
631 | #ifdef HAVE_LUA | ||
619 | static Eina_Bool | 632 | static Eina_Bool |
620 | _lua_buffer_push(lua_State *L, Buffer *buf) | 633 | _lua_buffer_push(lua_State *L, Buffer *buf) |
621 | { | 634 | { |
@@ -721,6 +734,7 @@ _lua_implicit_metatable_drop(lua_State *L, const char *name) | |||
721 | } | 734 | } |
722 | return ret; | 735 | return ret; |
723 | } | 736 | } |
737 | #endif | ||
724 | 738 | ||
725 | // End of all lua metamethods and stuff | 739 | // End of all lua metamethods and stuff |
726 | 740 | ||
@@ -787,7 +801,9 @@ _buffer_add(Evas_Filter_Program *pgm, const char *name, Eina_Bool alpha, | |||
787 | buf->h = pgm->state.h; | 801 | buf->h = pgm->state.h; |
788 | 802 | ||
789 | pgm->buffers = eina_inlist_append(pgm->buffers, EINA_INLIST_GET(buf)); | 803 | pgm->buffers = eina_inlist_append(pgm->buffers, EINA_INLIST_GET(buf)); |
804 | #ifdef HAVE_LUA | ||
790 | _lua_buffer_push(pgm->L, buf); | 805 | _lua_buffer_push(pgm->L, buf); |
806 | #endif | ||
791 | 807 | ||
792 | return buf; | 808 | return buf; |
793 | } | 809 | } |
@@ -803,6 +819,7 @@ _buffer_del(Buffer *buf) | |||
803 | 819 | ||
804 | static const int this_is_not_a_cat = 42; | 820 | static const int this_is_not_a_cat = 42; |
805 | 821 | ||
822 | #ifdef HAVE_LUA | ||
806 | static Evas_Filter_Program * | 823 | static Evas_Filter_Program * |
807 | _lua_program_get(lua_State *L) | 824 | _lua_program_get(lua_State *L) |
808 | { | 825 | { |
@@ -813,6 +830,7 @@ _lua_program_get(lua_State *L) | |||
813 | lua_pop(L, 1); | 830 | lua_pop(L, 1); |
814 | return pgm; | 831 | return pgm; |
815 | } | 832 | } |
833 | #endif | ||
816 | 834 | ||
817 | /* Instruction definitions */ | 835 | /* Instruction definitions */ |
818 | 836 | ||
@@ -850,6 +868,7 @@ _lua_program_get(lua_State *L) | |||
850 | @since 1.10 | 868 | @since 1.10 |
851 | */ | 869 | */ |
852 | 870 | ||
871 | #ifdef HAVE_LUA | ||
853 | static Eina_Bool | 872 | static Eina_Bool |
854 | _buffer_instruction_parse_run(lua_State *L, | 873 | _buffer_instruction_parse_run(lua_State *L, |
855 | Evas_Filter_Program *pgm, | 874 | Evas_Filter_Program *pgm, |
@@ -915,6 +934,7 @@ _lua_buffer_new(lua_State *L) | |||
915 | 934 | ||
916 | return instr->return_count; | 935 | return instr->return_count; |
917 | } | 936 | } |
937 | #endif | ||
918 | 938 | ||
919 | static int | 939 | static int |
920 | _blend_padding_update(Evas_Filter_Program *pgm EINA_UNUSED, | 940 | _blend_padding_update(Evas_Filter_Program *pgm EINA_UNUSED, |
@@ -1212,6 +1232,7 @@ _bump_instruction_prepare(Evas_Filter_Program *pgm, Evas_Filter_Instruction *ins | |||
1212 | return EINA_TRUE; | 1232 | return EINA_TRUE; |
1213 | } | 1233 | } |
1214 | 1234 | ||
1235 | #ifdef HAVE_LUA | ||
1215 | static Eina_Bool | 1236 | static Eina_Bool |
1216 | _lua_curve_points_func(lua_State *L, int i, Evas_Filter_Program *pgm EINA_UNUSED, | 1237 | _lua_curve_points_func(lua_State *L, int i, Evas_Filter_Program *pgm EINA_UNUSED, |
1217 | Evas_Filter_Instruction *instr, Instruction_Param *param) | 1238 | Evas_Filter_Instruction *instr, Instruction_Param *param) |
@@ -1344,6 +1365,7 @@ _lua_curve_points_func(lua_State *L, int i, Evas_Filter_Program *pgm EINA_UNUSED | |||
1344 | 1365 | ||
1345 | return EINA_TRUE; | 1366 | return EINA_TRUE; |
1346 | } | 1367 | } |
1368 | #endif | ||
1347 | 1369 | ||
1348 | /** | 1370 | /** |
1349 | @page evasfiltersref | 1371 | @page evasfiltersref |
@@ -1404,7 +1426,9 @@ _curve_instruction_prepare(Evas_Filter_Program *pgm, Evas_Filter_Instruction *in | |||
1404 | 1426 | ||
1405 | // TODO: Allow passing an array of 256 values as points. | 1427 | // TODO: Allow passing an array of 256 values as points. |
1406 | // It could be easily computed from another function in the script. | 1428 | // It could be easily computed from another function in the script. |
1429 | #ifdef HAVE_LUA | ||
1407 | _instruction_param_seq_add(instr, "points", VT_SPECIAL, _lua_curve_points_func, NULL); | 1430 | _instruction_param_seq_add(instr, "points", VT_SPECIAL, _lua_curve_points_func, NULL); |
1431 | #endif | ||
1408 | if (instr->params) | 1432 | if (instr->params) |
1409 | { | 1433 | { |
1410 | last = instr->params->last; | 1434 | last = instr->params->last; |
@@ -1934,8 +1958,10 @@ evas_filter_program_del(Evas_Filter_Program *pgm) | |||
1934 | 1958 | ||
1935 | if (!pgm) return; | 1959 | if (!pgm) return; |
1936 | 1960 | ||
1961 | #ifdef HAVE_LUA | ||
1937 | if (pgm->L) | 1962 | if (pgm->L) |
1938 | lua_close(pgm->L); | 1963 | lua_close(pgm->L); |
1964 | #endif | ||
1939 | 1965 | ||
1940 | EINA_INLIST_FREE(pgm->buffers, buf) | 1966 | EINA_INLIST_FREE(pgm->buffers, buf) |
1941 | { | 1967 | { |
@@ -1954,6 +1980,7 @@ evas_filter_program_del(Evas_Filter_Program *pgm) | |||
1954 | } | 1980 | } |
1955 | 1981 | ||
1956 | // [-1, +1, e] -- converts the top of the stack to a valid 'color' object | 1982 | // [-1, +1, e] -- converts the top of the stack to a valid 'color' object |
1983 | #ifdef HAVE_LUA | ||
1957 | static Eina_Bool | 1984 | static Eina_Bool |
1958 | _lua_convert_color(lua_State *L) | 1985 | _lua_convert_color(lua_State *L) |
1959 | { | 1986 | { |
@@ -2102,6 +2129,7 @@ fail: | |||
2102 | ERR("Invalid value for parameter %s", param->name); | 2129 | ERR("Invalid value for parameter %s", param->name); |
2103 | return luaL_error(L, "Invalid value for parameter %s", param->name); | 2130 | return luaL_error(L, "Invalid value for parameter %s", param->name); |
2104 | } | 2131 | } |
2132 | #endif | ||
2105 | 2133 | ||
2106 | static Instruction_Param * | 2134 | static Instruction_Param * |
2107 | _parameter_get_by_id(Evas_Filter_Instruction *instr, int id) | 2135 | _parameter_get_by_id(Evas_Filter_Instruction *instr, int id) |
@@ -2119,6 +2147,7 @@ _parameter_get_by_id(Evas_Filter_Instruction *instr, int id) | |||
2119 | return NULL; | 2147 | return NULL; |
2120 | } | 2148 | } |
2121 | 2149 | ||
2150 | #ifdef HAVE_LUA | ||
2122 | static Eina_Bool | 2151 | static Eina_Bool |
2123 | _lua_instruction_run(lua_State *L, Evas_Filter_Instruction *instr) | 2152 | _lua_instruction_run(lua_State *L, Evas_Filter_Instruction *instr) |
2124 | { | 2153 | { |
@@ -2389,6 +2418,7 @@ _lua_import_class(lua_State *L, const char *name, char **code) | |||
2389 | } | 2418 | } |
2390 | return EINA_TRUE; | 2419 | return EINA_TRUE; |
2391 | } | 2420 | } |
2421 | #endif | ||
2392 | 2422 | ||
2393 | static void | 2423 | static void |
2394 | _filter_program_buffers_set(Evas_Filter_Program *pgm) | 2424 | _filter_program_buffers_set(Evas_Filter_Program *pgm) |
@@ -2426,6 +2456,7 @@ _filter_program_buffers_set(Evas_Filter_Program *pgm) | |||
2426 | } | 2456 | } |
2427 | } | 2457 | } |
2428 | 2458 | ||
2459 | #ifdef HAVE_LUA | ||
2429 | static inline void | 2460 | static inline void |
2430 | _lua_class_create(lua_State *L, const char *name, | 2461 | _lua_class_create(lua_State *L, const char *name, |
2431 | const luaL_Reg *meta, const luaL_Reg *methods) | 2462 | const luaL_Reg *meta, const luaL_Reg *methods) |
@@ -2596,6 +2627,7 @@ _lua_backtrace(lua_State *L) | |||
2596 | lua_call(L, 2, 1); /* call debug.traceback */ | 2627 | lua_call(L, 2, 1); /* call debug.traceback */ |
2597 | return 1; | 2628 | return 1; |
2598 | } | 2629 | } |
2630 | #endif | ||
2599 | 2631 | ||
2600 | #ifdef FILTERS_LEGACY_COMPAT | 2632 | #ifdef FILTERS_LEGACY_COMPAT |
2601 | // This function is here to avoid breaking the ABI too much. | 2633 | // This function is here to avoid breaking the ABI too much. |
@@ -2722,6 +2754,7 @@ _legacy_strdup(const char *str) | |||
2722 | static Eina_Bool | 2754 | static Eina_Bool |
2723 | _filter_program_state_set(Evas_Filter_Program *pgm) | 2755 | _filter_program_state_set(Evas_Filter_Program *pgm) |
2724 | { | 2756 | { |
2757 | #ifdef HAVE_LUA | ||
2725 | lua_State *L = pgm->L; | 2758 | lua_State *L = pgm->L; |
2726 | 2759 | ||
2727 | // TODO: | 2760 | // TODO: |
@@ -2820,13 +2853,18 @@ _filter_program_state_set(Evas_Filter_Program *pgm) | |||
2820 | #undef JOINC | 2853 | #undef JOINC |
2821 | #undef SETFIELD | 2854 | #undef SETFIELD |
2822 | #undef SETCOLOR | 2855 | #undef SETCOLOR |
2856 | #else | ||
2857 | return EINA_FALSE; | ||
2858 | #endif | ||
2823 | } | 2859 | } |
2824 | 2860 | ||
2825 | static Eina_Bool | 2861 | static Eina_Bool |
2826 | _filter_program_reset(Evas_Filter_Program *pgm) | 2862 | _filter_program_reset(Evas_Filter_Program *pgm) |
2827 | { | 2863 | { |
2828 | Evas_Filter_Instruction *instr; | 2864 | Evas_Filter_Instruction *instr; |
2865 | #ifdef HAVE_LUA | ||
2829 | lua_State *L = pgm->L; | 2866 | lua_State *L = pgm->L; |
2867 | #endif | ||
2830 | Eina_Inlist *il; | 2868 | Eina_Inlist *il; |
2831 | Buffer *buf; | 2869 | Buffer *buf; |
2832 | 2870 | ||
@@ -2840,8 +2878,10 @@ _filter_program_reset(Evas_Filter_Program *pgm) | |||
2840 | // Clear out buffers | 2878 | // Clear out buffers |
2841 | EINA_INLIST_FOREACH_SAFE(pgm->buffers, il, buf) | 2879 | EINA_INLIST_FOREACH_SAFE(pgm->buffers, il, buf) |
2842 | { | 2880 | { |
2881 | #ifdef HAVE_LUA | ||
2843 | lua_pushnil(L); | 2882 | lua_pushnil(L); |
2844 | lua_setglobal(L, buf->name); | 2883 | lua_setglobal(L, buf->name); |
2884 | #endif | ||
2845 | pgm->buffers = eina_inlist_remove(pgm->buffers, EINA_INLIST_GET(buf)); | 2885 | pgm->buffers = eina_inlist_remove(pgm->buffers, EINA_INLIST_GET(buf)); |
2846 | _buffer_del(buf); | 2886 | _buffer_del(buf); |
2847 | } | 2887 | } |
@@ -2858,8 +2898,9 @@ _filter_program_reset(Evas_Filter_Program *pgm) | |||
2858 | EVAS_API Eina_Bool | 2898 | EVAS_API Eina_Bool |
2859 | evas_filter_program_parse(Evas_Filter_Program *pgm, const char *str) | 2899 | evas_filter_program_parse(Evas_Filter_Program *pgm, const char *str) |
2860 | { | 2900 | { |
2901 | Eina_Bool ok = EINA_FALSE; | ||
2902 | #ifdef HAVE_LUA | ||
2861 | lua_State *L; | 2903 | lua_State *L; |
2862 | Eina_Bool ok; | ||
2863 | 2904 | ||
2864 | EINA_SAFETY_ON_NULL_RETURN_VAL(pgm, EINA_FALSE); | 2905 | EINA_SAFETY_ON_NULL_RETURN_VAL(pgm, EINA_FALSE); |
2865 | EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE); | 2906 | EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE); |
@@ -2913,6 +2954,7 @@ evas_filter_program_parse(Evas_Filter_Program *pgm, const char *str) | |||
2913 | pgm->valid = ok; | 2954 | pgm->valid = ok; |
2914 | pgm->padding_calc = EINA_FALSE; | 2955 | pgm->padding_calc = EINA_FALSE; |
2915 | pgm->changed = EINA_FALSE; | 2956 | pgm->changed = EINA_FALSE; |
2957 | #endif | ||
2916 | 2958 | ||
2917 | return ok; | 2959 | return ok; |
2918 | } | 2960 | } |
@@ -3628,6 +3670,7 @@ evas_filter_context_program_use(void *engine, void *output, | |||
3628 | { | 3670 | { |
3629 | pgm->changed = EINA_FALSE; | 3671 | pgm->changed = EINA_FALSE; |
3630 | _filter_program_reset(pgm); | 3672 | _filter_program_reset(pgm); |
3673 | #ifdef HAVE_LUA | ||
3631 | lua_getglobal(pgm->L, _lua_errfunc_name); | 3674 | lua_getglobal(pgm->L, _lua_errfunc_name); |
3632 | lua_rawgeti(pgm->L, LUA_REGISTRYINDEX, pgm->lua_func); | 3675 | lua_rawgeti(pgm->L, LUA_REGISTRYINDEX, pgm->lua_func); |
3633 | success = !lua_pcall(pgm->L, 0, LUA_MULTRET, -2); | 3676 | success = !lua_pcall(pgm->L, 0, LUA_MULTRET, -2); |
@@ -3637,6 +3680,10 @@ evas_filter_context_program_use(void *engine, void *output, | |||
3637 | ERR("Lua execution failed: %s", msg); | 3680 | ERR("Lua execution failed: %s", msg); |
3638 | goto end; | 3681 | goto end; |
3639 | } | 3682 | } |
3683 | #else | ||
3684 | ERR("Lua execution failed: Lua was disabled in this build."); | ||
3685 | goto end; | ||
3686 | #endif | ||
3640 | } | 3687 | } |
3641 | 3688 | ||
3642 | // Create or update all buffers | 3689 | // Create or update all buffers |
@@ -3668,6 +3715,8 @@ end: | |||
3668 | void | 3715 | void |
3669 | evas_filter_parser_shutdown(void) | 3716 | evas_filter_parser_shutdown(void) |
3670 | { | 3717 | { |
3718 | #ifdef HAVE_LUA | ||
3671 | free(_lua_color_code); | 3719 | free(_lua_color_code); |
3672 | _lua_color_code = NULL; | 3720 | _lua_color_code = NULL; |
3721 | #endif | ||
3673 | } | 3722 | } |
diff --git a/src/lib/evas/filters/meson.build b/src/lib/evas/filters/meson.build index 58ff2f21d1..315bec45b0 100644 --- a/src/lib/evas/filters/meson.build +++ b/src/lib/evas/filters/meson.build | |||
@@ -1,4 +1,8 @@ | |||
1 | subdir('lua') | 1 | if get_option('lua-interpreter') != 'none' |
2 | subdir('lua') | ||
3 | |||
4 | evas_deps += lua | ||
5 | endif | ||
2 | 6 | ||
3 | evas_src += files([ | 7 | evas_src += files([ |
4 | 'evas_filter.c', | 8 | 'evas_filter.c', |
@@ -6,5 +10,3 @@ evas_src += files([ | |||
6 | 'evas_filter_private.h', | 10 | 'evas_filter_private.h', |
7 | 'evas_filter_utils.c', | 11 | 'evas_filter_utils.c', |
8 | ]) | 12 | ]) |
9 | |||
10 | evas_deps += lua | ||
diff --git a/src/tests/evas/evas_suite.c b/src/tests/evas/evas_suite.c index 523c10dc76..feaaf126af 100644 --- a/src/tests/evas/evas_suite.c +++ b/src/tests/evas/evas_suite.c | |||
@@ -17,7 +17,9 @@ static const Efl_Test_Case etc[] = { | |||
17 | { "Object Text", evas_test_text }, | 17 | { "Object Text", evas_test_text }, |
18 | { "Callbacks", evas_test_callbacks }, | 18 | { "Callbacks", evas_test_callbacks }, |
19 | { "Render Engines", evas_test_render_engines }, | 19 | { "Render Engines", evas_test_render_engines }, |
20 | #if HAVE_LUA | ||
20 | { "Filters", evas_test_filters }, | 21 | { "Filters", evas_test_filters }, |
22 | #endif | ||
21 | { "Images", evas_test_image_object }, | 23 | { "Images", evas_test_image_object }, |
22 | { "Images", evas_test_image_object2 }, | 24 | { "Images", evas_test_image_object2 }, |
23 | { "Masking", evas_test_mask }, | 25 | { "Masking", evas_test_mask }, |