summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac16
-rw-r--r--meson_options.txt6
-rw-r--r--src/Makefile_Eolian_Mono_Helper.am4
-rw-r--r--src/bin/eolian_mono/eolian/mono/async_function_definition.hh4
-rw-r--r--src/bin/eolian_mono/eolian/mono/blacklist.hh25
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_declaration.hh2
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_definition.hh6
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_registration.hh2
-rw-r--r--src/bin/eolian_mono/eolian/mono/generation_contexts.hh4
-rw-r--r--src/bin/eolian_mono/eolian/mono/klass.hh7
-rw-r--r--src/bin/eolian_mono/eolian_mono.cc13
-rw-r--r--src/bindings/mono/meson.build9
12 files changed, 83 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index 576a1af..34f71f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1349,6 +1349,17 @@ EFL_LIB_END_OPTIONAL([Eo_Js])
1349#### End of Eo JS 1349#### End of Eo JS
1350 1350
1351#### Efl C Sharp Bindings 1351#### Efl C Sharp Bindings
1352want_csharp_beta="no"
1353AC_ARG_ENABLE([csharp-beta],
1354 [AS_HELP_STRING([--enable-csharp-beta],[enable C Sharp bindings. @<:@default=disabled@:>@])],
1355 [
1356 if test "x${enableval}" = "xyes" ; then
1357 want_csharp_beta="yes"
1358 else
1359 want_csharp_beta="no"
1360 fi
1361 ],
1362 [want_csharp_beta="no"])
1352 1363
1353want_csharp="no" 1364want_csharp="no"
1354AC_ARG_ENABLE([csharp-bindings], 1365AC_ARG_ENABLE([csharp-bindings],
@@ -1372,6 +1383,11 @@ AC_DEFINE_IF([HAVE_CSHARP], [test "x${want_csharp}" = "xyes"],
1372 [1], [Compiling bindings for C Sharp]) 1383 [1], [Compiling bindings for C Sharp])
1373AC_SUBST([want_csharp]) 1384AC_SUBST([want_csharp])
1374 1385
1386AM_CONDITIONAL([HAVE_CSHARP_BETA], [test "x${want_csharp_beta}" = "xyes"])
1387AC_DEFINE_IF([HAVE_CSHARP_BETA], [test "x${want_csharp_beta}" = "xyes"],
1388 [1], [Compiling bindings for C Sharp with beta methods, properties and classes])
1389AC_SUBST([want_csharp_beta])
1390
1375if test "x${have_windows}" = "xyes"; then 1391if test "x${have_windows}" = "xyes"; then
1376 eflmonodlldir="$prefix/bin" 1392 eflmonodlldir="$prefix/bin"
1377else 1393else
diff --git a/meson_options.txt b/meson_options.txt
index a8aabda..651fbcc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -317,6 +317,12 @@ option('bindings',
317 description : 'Add values here to enable the bindings', 317 description : 'Add values here to enable the bindings',
318) 318)
319 319
320option('mono-beta',
321 type: 'boolean',
322 value: false,
323 description: 'Flag for enabling @beta Eo methods in the api'
324)
325
320option('native-arch-optimization', 326option('native-arch-optimization',
321 type: 'boolean', 327 type: 'boolean',
322 value: true, 328 value: true,
diff --git a/src/Makefile_Eolian_Mono_Helper.am b/src/Makefile_Eolian_Mono_Helper.am
index 6097c44..3ada3b2 100644
--- a/src/Makefile_Eolian_Mono_Helper.am
+++ b/src/Makefile_Eolian_Mono_Helper.am
@@ -8,7 +8,11 @@ EOLIAN_MONO = EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/eolian_mono/eolian_mono$
8_EOLIAN_MONO_DEP = bin/eolian_mono/eolian_mono${EXEEXT} 8_EOLIAN_MONO_DEP = bin/eolian_mono/eolian_mono${EXEEXT}
9endif 9endif
10 10
11if HAVE_CSHARP_BETA
12EOLIAN_MONO_FLAGS = -b -M @VMAJ@ -m @VMIN@
13else
11EOLIAN_MONO_FLAGS = -M @VMAJ@ -m @VMIN@ 14EOLIAN_MONO_FLAGS = -M @VMAJ@ -m @VMIN@
15endif
12 16
13AM_V_EOLMONO = $(am__v_EOLMONO_@AM_V@) 17AM_V_EOLMONO = $(am__v_EOLMONO_@AM_V@)
14am__v_EOLMONO_ = $(am__v_EOLMONO_@AM_DEFAULT_V@) 18am__v_EOLMONO_ = $(am__v_EOLMONO_@AM_DEFAULT_V@)
diff --git a/src/bin/eolian_mono/eolian/mono/async_function_definition.hh b/src/bin/eolian_mono/eolian/mono/async_function_definition.hh
index 1dc705a..5164311 100644
--- a/src/bin/eolian_mono/eolian/mono/async_function_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/async_function_definition.hh
@@ -48,7 +48,7 @@ struct async_function_declaration_generator
48 { 48 {
49 if (f.is_static) 49 if (f.is_static)
50 return true; 50 return true;
51 if (blacklist::is_function_blacklisted(f.c_name)) 51 if (blacklist::is_function_blacklisted(f, context))
52 return true; 52 return true;
53 if (!f.return_type.original_type.visit(is_future{})) 53 if (!f.return_type.original_type.visit(is_future{}))
54 return true; 54 return true;
@@ -76,7 +76,7 @@ struct async_function_definition_generator
76 76
77 if(do_super && f.is_static) // Static methods goes only on Concrete classes. 77 if(do_super && f.is_static) // Static methods goes only on Concrete classes.
78 return true; 78 return true;
79 if(blacklist::is_function_blacklisted(f.c_name)) 79 if(blacklist::is_function_blacklisted(f, context))
80 return true; 80 return true;
81 if(!f.return_type.original_type.visit(is_future{})) 81 if(!f.return_type.original_type.visit(is_future{}))
82 return true; 82 return true;
diff --git a/src/bin/eolian_mono/eolian/mono/blacklist.hh b/src/bin/eolian_mono/eolian/mono/blacklist.hh
index fff61c7..c11437b 100644
--- a/src/bin/eolian_mono/eolian/mono/blacklist.hh
+++ b/src/bin/eolian_mono/eolian/mono/blacklist.hh
@@ -2,7 +2,9 @@
2#define EOLIAN_MONO_BLACKLIST_HH 2#define EOLIAN_MONO_BLACKLIST_HH
3 3
4#include "grammar/klass_def.hpp" 4#include "grammar/klass_def.hpp"
5#include "grammar/context.hpp"
5#include "name_helpers.hh" 6#include "name_helpers.hh"
7#include "generation_contexts.hh"
6 8
7namespace eolian_mono { 9namespace eolian_mono {
8 10
@@ -49,6 +51,19 @@ inline bool is_function_blacklisted(std::string const& c_name)
49 ; 51 ;
50} 52}
51 53
54template<typename Context>
55inline bool is_function_blacklisted(attributes::function_def const& func, Context context)
56{
57 auto options = efl::eolian::grammar::context_find_tag<options_context>(context);
58 auto c_name = func.c_name;
59
60 if (func.is_beta && !options.want_beta)
61 return true;
62
63 return is_function_blacklisted(c_name);
64}
65
66
52// Blacklist structs that require some kind of manual binding. 67// Blacklist structs that require some kind of manual binding.
53inline bool is_struct_blacklisted(std::string const& full_name) 68inline bool is_struct_blacklisted(std::string const& full_name)
54{ 69{
@@ -85,9 +100,17 @@ inline bool is_property_blacklisted(std::string const& name)
85 || name == "Efl.Text.Text"; 100 || name == "Efl.Text.Text";
86} 101}
87 102
88inline bool is_property_blacklisted(attributes::property_def const& property) 103template<typename Context>
104inline bool is_property_blacklisted(attributes::property_def const& property, Context context)
89{ 105{
90 auto name = name_helpers::klass_full_concrete_or_interface_name(property.klass) + "." + name_helpers::property_managed_name(property); 106 auto name = name_helpers::klass_full_concrete_or_interface_name(property.klass) + "." + name_helpers::property_managed_name(property);
107
108 if (property.getter.is_engaged())
109 if (is_function_blacklisted(*property.getter, context))
110 return true;
111 if (property.setter.is_engaged())
112 if (is_function_blacklisted(*property.setter, context))
113 return true;
91 return is_property_blacklisted(name); 114 return is_property_blacklisted(name);
92} 115}
93 116
diff --git a/src/bin/eolian_mono/eolian/mono/function_declaration.hh b/src/bin/eolian_mono/eolian/mono/function_declaration.hh
index 8fdb826..baad0bb 100644
--- a/src/bin/eolian_mono/eolian/mono/function_declaration.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_declaration.hh
@@ -20,7 +20,7 @@ struct function_declaration_generator
20 template <typename OutputIterator, typename Context> 20 template <typename OutputIterator, typename Context>
21 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const 21 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
22 { 22 {
23 if(blacklist::is_function_blacklisted(f.c_name) || f.is_static) 23 if(blacklist::is_function_blacklisted(f, context) || f.is_static)
24 return true; 24 return true;
25 25
26 if(!as_generator(documentation).generate(sink, f, context)) 26 if(!as_generator(documentation).generate(sink, f, context))
diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh
index 2d9e1b5..6917870 100644
--- a/src/bin/eolian_mono/eolian/mono/function_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh
@@ -32,7 +32,7 @@ struct native_function_definition_generator
32 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const 32 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
33 { 33 {
34 EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "native_function_definition_generator: " << f.c_name << std::endl; 34 EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "native_function_definition_generator: " << f.c_name << std::endl;
35 if(blacklist::is_function_blacklisted(f.c_name) || f.is_static) // Only Concrete classes implement static methods. 35 if(blacklist::is_function_blacklisted(f, context) || f.is_static) // Only Concrete classes implement static methods.
36 return true; 36 return true;
37 else 37 else
38 { 38 {
@@ -138,7 +138,7 @@ struct function_definition_generator
138 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const 138 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
139 { 139 {
140 EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "function_definition_generator: " << f.c_name << std::endl; 140 EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "function_definition_generator: " << f.c_name << std::endl;
141 if(blacklist::is_function_blacklisted(f.c_name)) 141 if(blacklist::is_function_blacklisted(f, context))
142 return true; 142 return true;
143 143
144 if(!as_generator 144 if(!as_generator
@@ -213,7 +213,7 @@ struct property_wrapper_definition_generator
213 template<typename OutputIterator, typename Context> 213 template<typename OutputIterator, typename Context>
214 bool generate(OutputIterator sink, attributes::property_def const& property, Context context) const 214 bool generate(OutputIterator sink, attributes::property_def const& property, Context context) const
215 { 215 {
216 if (blacklist::is_property_blacklisted(property)) 216 if (blacklist::is_property_blacklisted(property, context))
217 return true; 217 return true;
218 218
219 bool interface = context_find_tag<class_context>(context).current_wrapper_kind == class_context::interface; 219 bool interface = context_find_tag<class_context>(context).current_wrapper_kind == class_context::interface;
diff --git a/src/bin/eolian_mono/eolian/mono/function_registration.hh b/src/bin/eolian_mono/eolian/mono/function_registration.hh
index 78f2d71..90cbbc4 100644
--- a/src/bin/eolian_mono/eolian/mono/function_registration.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_registration.hh
@@ -30,7 +30,7 @@ struct function_registration_generator
30 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const 30 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
31 { 31 {
32 EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "function_registration_generator: " << f.name << std::endl; 32 EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "function_registration_generator: " << f.name << std::endl;
33 if(blacklist::is_function_blacklisted(f.c_name) || f.is_static) // Static methods aren't overrideable 33 if(blacklist::is_function_blacklisted(f, context) || f.is_static) // Static methods aren't overrideable
34 return true; 34 return true;
35 else 35 else
36 { 36 {
diff --git a/src/bin/eolian_mono/eolian/mono/generation_contexts.hh b/src/bin/eolian_mono/eolian/mono/generation_contexts.hh
index ca1ca9e..9a1493a 100644
--- a/src/bin/eolian_mono/eolian/mono/generation_contexts.hh
+++ b/src/bin/eolian_mono/eolian/mono/generation_contexts.hh
@@ -45,6 +45,10 @@ struct eolian_state_context {
45 const Eolian_State *state; 45 const Eolian_State *state;
46}; 46};
47 47
48struct options_context {
49 bool want_beta;
50};
51
48} 52}
49 53
50#endif 54#endif
diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh
index c3d430e..6a2c818 100644
--- a/src/bin/eolian_mono/eolian/mono/klass.hh
+++ b/src/bin/eolian_mono/eolian/mono/klass.hh
@@ -71,13 +71,14 @@ static bool generate_equals_method(OutputIterator sink, Context const &context)
71} 71}
72 72
73/* Get the actual number of functions of a class, checking for blacklisted ones */ 73/* Get the actual number of functions of a class, checking for blacklisted ones */
74template<typename Context>
74static std::size_t 75static std::size_t
75get_implementable_function_count(grammar::attributes::klass_def const& cls) 76get_implementable_function_count(grammar::attributes::klass_def const& cls, Context context)
76{ 77{
77 auto methods = helpers::get_all_implementable_methods(cls); 78 auto methods = helpers::get_all_implementable_methods(cls);
78 return std::count_if(methods.cbegin(), methods.cend(), [](grammar::attributes::function_def const& func) 79 return std::count_if(methods.cbegin(), methods.cend(), [&context](grammar::attributes::function_def const& func)
79 { 80 {
80 return !blacklist::is_function_blacklisted(func.c_name) && !func.is_static; 81 return !blacklist::is_function_blacklisted(func, context) && !func.is_static;
81 }); 82 });
82} 83}
83 84
diff --git a/src/bin/eolian_mono/eolian_mono.cc b/src/bin/eolian_mono/eolian_mono.cc
index db88881..235f250 100644
--- a/src/bin/eolian_mono/eolian_mono.cc
+++ b/src/bin/eolian_mono/eolian_mono.cc
@@ -47,6 +47,7 @@ struct options_type
47 mutable Eolian_Unit const* unit; 47 mutable Eolian_Unit const* unit;
48 int v_major; 48 int v_major;
49 int v_minor; 49 int v_minor;
50 bool want_beta;
50 std::map<const std::string, std::string> references_map; 51 std::map<const std::string, std::string> references_map;
51}; 52};
52 53
@@ -144,7 +145,9 @@ run(options_type const& opts)
144 opts.references_map}, 145 opts.references_map},
145 efl::eolian::grammar::context_null()); 146 efl::eolian::grammar::context_null());
146 147
147 auto context = efl::eolian::grammar::context_add_tag(eolian_mono::eolian_state_context{opts.state}, lib_context); 148 auto options_context = efl::eolian::grammar::context_add_tag(eolian_mono::options_context{opts.want_beta}, lib_context);
149
150 auto context = efl::eolian::grammar::context_add_tag(eolian_mono::eolian_state_context{opts.state}, options_context);
148 151
149 EINA_ITERATOR_FOREACH(aliases, tp) 152 EINA_ITERATOR_FOREACH(aliases, tp)
150 { 153 {
@@ -273,6 +276,7 @@ _usage(const char *progname)
273 << " -n, --namespace <ns> Wrap generated code in a namespace. [Eg: efl::ecore::file]" << std::endl 276 << " -n, --namespace <ns> Wrap generated code in a namespace. [Eg: efl::ecore::file]" << std::endl
274 << " -r, --recurse Recurse input directories loading .eo files." << std::endl 277 << " -r, --recurse Recurse input directories loading .eo files." << std::endl
275 << " -v, --version Print the version." << std::endl 278 << " -v, --version Print the version." << std::endl
279 << " -b, --beta Enable @beta methods." << std::endl
276 << " -h, --help Print this help." << std::endl; 280 << " -h, --help Print this help." << std::endl;
277 exit(EXIT_FAILURE); 281 exit(EXIT_FAILURE);
278} 282}
@@ -302,9 +306,10 @@ opts_get(int argc, char **argv)
302 { "vmaj", required_argument, 0, 'M' }, 306 { "vmaj", required_argument, 0, 'M' },
303 { "vmin", required_argument, 0, 'm' }, 307 { "vmin", required_argument, 0, 'm' },
304 { "references", required_argument, 0, 'r'}, 308 { "references", required_argument, 0, 'r'},
309 { "beta", no_argument, 0, 'b'},
305 { 0, 0, 0, 0 } 310 { 0, 0, 0, 0 }
306 }; 311 };
307 const char* options = "I:D:o:c:M:m:ar:vh"; 312 const char* options = "I:D:o:c:M:m:ar:vhb";
308 313
309 int c, idx; 314 int c, idx;
310 while ( (c = getopt_long(argc, argv, options, long_options, &idx)) != -1) 315 while ( (c = getopt_long(argc, argv, options, long_options, &idx)) != -1)
@@ -356,6 +361,10 @@ opts_get(int argc, char **argv)
356 _print_version(); 361 _print_version();
357 if (argc == 2) exit(EXIT_SUCCESS); 362 if (argc == 2) exit(EXIT_SUCCESS);
358 } 363 }
364 else if (c == 'b')
365 {
366 opts.want_beta = true;
367 }
359 } 368 }
360 if (optind == argc-1) 369 if (optind == argc-1)
361 { 370 {
diff --git a/src/bindings/mono/meson.build b/src/bindings/mono/meson.build
index 411c29f..e5f2cf5 100644
--- a/src/bindings/mono/meson.build
+++ b/src/bindings/mono/meson.build
@@ -67,6 +67,11 @@ efl_mono_lib = library('eflcustomexportsmono',
67 dependencies : [eo, eina] 67 dependencies : [eo, eina]
68) 68)
69 69
70beta_option = []
71if (get_option('mono-beta'))
72 beta_option = '-b'
73endif
74
70mono_generator_target = [] 75mono_generator_target = []
71mono_files = [] 76mono_files = []
72foreach lib : mono_sublibs 77foreach lib : mono_sublibs
@@ -88,7 +93,7 @@ foreach lib : mono_sublibs
88 mono_generator_target += custom_target('eolian_mono_gen_'+mono_gen_file.underscorify()+'', 93 mono_generator_target += custom_target('eolian_mono_gen_'+mono_gen_file.underscorify()+'',
89 input : join_paths(subdir_file_location, mono_gen_file), 94 input : join_paths(subdir_file_location, mono_gen_file),
90 output : [mono_gen_file + '.cs'], 95 output : [mono_gen_file + '.cs'],
91 command : [eolian_mono_gen, '-I', meson.current_source_dir(), eolian_include_directories, 96 command : [eolian_mono_gen, beta_option, '-I', meson.current_source_dir(), eolian_include_directories,
92 '--dllimport', package_name, 97 '--dllimport', package_name,
93 '-o', join_paths(meson.current_build_dir(), mono_gen_file + '.cs'), 98 '-o', join_paths(meson.current_build_dir(), mono_gen_file + '.cs'),
94 '@INPUT@']) 99 '@INPUT@'])
@@ -107,7 +112,7 @@ foreach mono_gen_file : legacy_evas_required_by_mono
107 mono_generator_target += custom_target('eolian_mono_gen_'+mono_gen_file.underscorify()+'', 112 mono_generator_target += custom_target('eolian_mono_gen_'+mono_gen_file.underscorify()+'',
108 input : join_paths(subdir_file_location, mono_gen_file), 113 input : join_paths(subdir_file_location, mono_gen_file),
109 output : [mono_gen_file + '.cs'], 114 output : [mono_gen_file + '.cs'],
110 command : [eolian_mono_gen, '-I', meson.current_source_dir(), eolian_include_directories, 115 command : [eolian_mono_gen, beta_option, '-I', meson.current_source_dir(), eolian_include_directories,
111 '--dllimport', 'evas', 116 '--dllimport', 'evas',
112 '-o', join_paths(meson.current_build_dir(), mono_gen_file + '.cs'), 117 '-o', join_paths(meson.current_build_dir(), mono_gen_file + '.cs'),
113 '@INPUT@']) 118 '@INPUT@'])