clouseau: lets use eo to evalulate if a function is implemented

So, there is one problem, there is the case that you just have the
notation in eolian that a special object implements a interface, to
bring the actual logic to it, you are going to composite_attach a other
object to it. The problem then in clouseau was that clouseau doesnt know
a implementation does exist, so it didnt display the implementation.

The new solution uses eo to fetch the function pointer to the actual
implementation to know if the function is really implemented or not.
This commit is contained in:
Marcel Hollerbach 2017-07-09 22:28:19 +02:00
parent e2dbf08cb2
commit 9640ad7c6a
1 changed files with 21 additions and 2 deletions

View File

@ -446,6 +446,23 @@ _complex_buffer_fill(const Eolian_Unit *unit, char *buf, const Eolian_Type *eo_t
return size;
}
static Eina_Bool
_api_resolvable(Eo *obj, const Eolian_Function *function)
{
Efl_Object_Op_Call_Data call_data = {};
Efl_Object_Call_Cache call_cache = {};
const char *func_c_name;
void *func_api;
func_c_name = eolian_function_full_c_name_get(function, EOLIAN_PROP_GET, EINA_FALSE);
func_api = dlsym(RTLD_DEFAULT, func_c_name);
call_cache.op = _efl_object_op_api_id_get(func_api, obj, func_c_name, __FILE__, __LINE__);
call_cache.generation = _efl_object_init_generation;
_efl_object_call_resolve(obj, func_c_name, &call_data, &call_cache, __FILE__, __LINE__);
return !!call_data.func;
}
static unsigned int
_class_buffer_fill(Eo *obj, const Eolian_Unit *unit, const Eolian_Class *okl, const Eolian_Class *ekl, char *buf)
{
@ -454,8 +471,10 @@ _class_buffer_fill(Eo *obj, const Eolian_Unit *unit, const Eolian_Class *okl, co
const Eolian_Function *func;
EINA_ITERATOR_FOREACH(funcs, func)
{
if (eolian_function_type_get(func) == EOLIAN_PROP_SET ||
!_eolian_function_is_implemented(func, EOLIAN_PROP_GET, unit, okl)) continue;
if (eolian_function_type_get(func) == EOLIAN_PROP_SET) continue;
if (!_api_resolvable(obj, func)) continue;
Eina_Iterator *keys_itr = eolian_property_keys_get(func, EOLIAN_PROP_GET);
eina_iterator_free(keys_itr);
/* We dont support functions with key parameters */