#### End of Eo JS
#### Efl C Sharp Bindings
+want_csharp_beta="no"
+AC_ARG_ENABLE([csharp-beta],
+ [AS_HELP_STRING([--enable-csharp-beta],[enable C Sharp bindings. @<:@default=disabled@:>@])],
+ [
+ if test "x${enableval}" = "xyes" ; then
+ want_csharp_beta="yes"
+ else
+ want_csharp_beta="no"
+ fi
+ ],
+ [want_csharp_beta="no"])
want_csharp="no"
AC_ARG_ENABLE([csharp-bindings],
[1], [Compiling bindings for C Sharp])
AC_SUBST([want_csharp])
+AM_CONDITIONAL([HAVE_CSHARP_BETA], [test "x${want_csharp_beta}" = "xyes"])
+AC_DEFINE_IF([HAVE_CSHARP_BETA], [test "x${want_csharp_beta}" = "xyes"],
+ [1], [Compiling bindings for C Sharp with beta methods, properties and classes])
+AC_SUBST([want_csharp_beta])
+
if test "x${have_windows}" = "xyes"; then
eflmonodlldir="$prefix/bin"
else
description : 'Add values here to enable the bindings',
)
+option('mono-beta',
+ type: 'boolean',
+ value: false,
+ description: 'Flag for enabling @beta Eo methods in the api'
+)
+
option('native-arch-optimization',
type: 'boolean',
value: true,
_EOLIAN_MONO_DEP = bin/eolian_mono/eolian_mono${EXEEXT}
endif
+if HAVE_CSHARP_BETA
+EOLIAN_MONO_FLAGS = -b -M @VMAJ@ -m @VMIN@
+else
EOLIAN_MONO_FLAGS = -M @VMAJ@ -m @VMIN@
+endif
AM_V_EOLMONO = $(am__v_EOLMONO_@AM_V@)
am__v_EOLMONO_ = $(am__v_EOLMONO_@AM_DEFAULT_V@)
{
if (f.is_static)
return true;
- if (blacklist::is_function_blacklisted(f.c_name))
+ if (blacklist::is_function_blacklisted(f, context))
return true;
if (!f.return_type.original_type.visit(is_future{}))
return true;
if(do_super && f.is_static) // Static methods goes only on Concrete classes.
return true;
- if(blacklist::is_function_blacklisted(f.c_name))
+ if(blacklist::is_function_blacklisted(f, context))
return true;
if(!f.return_type.original_type.visit(is_future{}))
return true;
#define EOLIAN_MONO_BLACKLIST_HH
#include "grammar/klass_def.hpp"
+#include "grammar/context.hpp"
#include "name_helpers.hh"
+#include "generation_contexts.hh"
namespace eolian_mono {
;
}
+template<typename Context>
+inline bool is_function_blacklisted(attributes::function_def const& func, Context context)
+{
+ auto options = efl::eolian::grammar::context_find_tag<options_context>(context);
+ auto c_name = func.c_name;
+
+ if (func.is_beta && !options.want_beta)
+ return true;
+
+ return is_function_blacklisted(c_name);
+}
+
+
// Blacklist structs that require some kind of manual binding.
inline bool is_struct_blacklisted(std::string const& full_name)
{
|| name == "Efl.Text.Text";
}
-inline bool is_property_blacklisted(attributes::property_def const& property)
+template<typename Context>
+inline bool is_property_blacklisted(attributes::property_def const& property, Context context)
{
auto name = name_helpers::klass_full_concrete_or_interface_name(property.klass) + "." + name_helpers::property_managed_name(property);
+
+ if (property.getter.is_engaged())
+ if (is_function_blacklisted(*property.getter, context))
+ return true;
+ if (property.setter.is_engaged())
+ if (is_function_blacklisted(*property.setter, context))
+ return true;
return is_property_blacklisted(name);
}
template <typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
{
- if(blacklist::is_function_blacklisted(f.c_name) || f.is_static)
+ if(blacklist::is_function_blacklisted(f, context) || f.is_static)
return true;
if(!as_generator(documentation).generate(sink, f, context))
bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
{
EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "native_function_definition_generator: " << f.c_name << std::endl;
- if(blacklist::is_function_blacklisted(f.c_name) || f.is_static) // Only Concrete classes implement static methods.
+ if(blacklist::is_function_blacklisted(f, context) || f.is_static) // Only Concrete classes implement static methods.
return true;
else
{
bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
{
EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "function_definition_generator: " << f.c_name << std::endl;
- if(blacklist::is_function_blacklisted(f.c_name))
+ if(blacklist::is_function_blacklisted(f, context))
return true;
if(!as_generator
template<typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::property_def const& property, Context context) const
{
- if (blacklist::is_property_blacklisted(property))
+ if (blacklist::is_property_blacklisted(property, context))
return true;
bool interface = context_find_tag<class_context>(context).current_wrapper_kind == class_context::interface;
bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
{
EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "function_registration_generator: " << f.name << std::endl;
- if(blacklist::is_function_blacklisted(f.c_name) || f.is_static) // Static methods aren't overrideable
+ if(blacklist::is_function_blacklisted(f, context) || f.is_static) // Static methods aren't overrideable
return true;
else
{
const Eolian_State *state;
};
+struct options_context {
+ bool want_beta;
+};
+
}
#endif
}
/* Get the actual number of functions of a class, checking for blacklisted ones */
+template<typename Context>
static std::size_t
-get_implementable_function_count(grammar::attributes::klass_def const& cls)
+get_implementable_function_count(grammar::attributes::klass_def const& cls, Context context)
{
auto methods = helpers::get_all_implementable_methods(cls);
- return std::count_if(methods.cbegin(), methods.cend(), [](grammar::attributes::function_def const& func)
+ return std::count_if(methods.cbegin(), methods.cend(), [&context](grammar::attributes::function_def const& func)
{
- return !blacklist::is_function_blacklisted(func.c_name) && !func.is_static;
+ return !blacklist::is_function_blacklisted(func, context) && !func.is_static;
});
}
mutable Eolian_Unit const* unit;
int v_major;
int v_minor;
+ bool want_beta;
std::map<const std::string, std::string> references_map;
};
opts.references_map},
efl::eolian::grammar::context_null());
- auto context = efl::eolian::grammar::context_add_tag(eolian_mono::eolian_state_context{opts.state}, lib_context);
+ auto options_context = efl::eolian::grammar::context_add_tag(eolian_mono::options_context{opts.want_beta}, lib_context);
+
+ auto context = efl::eolian::grammar::context_add_tag(eolian_mono::eolian_state_context{opts.state}, options_context);
EINA_ITERATOR_FOREACH(aliases, tp)
{
<< " -n, --namespace <ns> Wrap generated code in a namespace. [Eg: efl::ecore::file]" << std::endl
<< " -r, --recurse Recurse input directories loading .eo files." << std::endl
<< " -v, --version Print the version." << std::endl
+ << " -b, --beta Enable @beta methods." << std::endl
<< " -h, --help Print this help." << std::endl;
exit(EXIT_FAILURE);
}
{ "vmaj", required_argument, 0, 'M' },
{ "vmin", required_argument, 0, 'm' },
{ "references", required_argument, 0, 'r'},
+ { "beta", no_argument, 0, 'b'},
{ 0, 0, 0, 0 }
};
- const char* options = "I:D:o:c:M:m:ar:vh";
+ const char* options = "I:D:o:c:M:m:ar:vhb";
int c, idx;
while ( (c = getopt_long(argc, argv, options, long_options, &idx)) != -1)
_print_version();
if (argc == 2) exit(EXIT_SUCCESS);
}
+ else if (c == 'b')
+ {
+ opts.want_beta = true;
+ }
}
if (optind == argc-1)
{
dependencies : [eo, eina]
)
+beta_option = []
+if (get_option('mono-beta'))
+ beta_option = '-b'
+endif
+
mono_generator_target = []
mono_files = []
foreach lib : mono_sublibs
mono_generator_target += custom_target('eolian_mono_gen_'+mono_gen_file.underscorify()+'',
input : join_paths(subdir_file_location, mono_gen_file),
output : [mono_gen_file + '.cs'],
- command : [eolian_mono_gen, '-I', meson.current_source_dir(), eolian_include_directories,
+ command : [eolian_mono_gen, beta_option, '-I', meson.current_source_dir(), eolian_include_directories,
'--dllimport', package_name,
'-o', join_paths(meson.current_build_dir(), mono_gen_file + '.cs'),
'@INPUT@'])
mono_generator_target += custom_target('eolian_mono_gen_'+mono_gen_file.underscorify()+'',
input : join_paths(subdir_file_location, mono_gen_file),
output : [mono_gen_file + '.cs'],
- command : [eolian_mono_gen, '-I', meson.current_source_dir(), eolian_include_directories,
+ command : [eolian_mono_gen, beta_option, '-I', meson.current_source_dir(), eolian_include_directories,
'--dllimport', 'evas',
'-o', join_paths(meson.current_build_dir(), mono_gen_file + '.cs'),
'@INPUT@'])