eolian: refactoring step six

Move Eolian_Function as well, plus fix const correctness of several API funcs.
This commit is contained in:
Daniel Kolesa 2014-07-09 20:59:31 +01:00
parent 012b586c8b
commit 580aea04cd
12 changed files with 190 additions and 216 deletions

View File

@ -74,7 +74,7 @@ _class_func_env_create(const Eolian_Class *class, const char *funcname, Eolian_F
const char *ret;
const char *suffix = "";
const char *legacy = NULL;
Eolian_Function funcid = eolian_class_function_find_by_name(class, funcname, ftype);
Eolian_Function *funcid = eolian_class_function_find_by_name(class, funcname, ftype);
if (ftype == EOLIAN_PROP_GET)
{
suffix = "_get";

View File

@ -79,7 +79,7 @@ tmpl_eo_retdesc[] =" * @return %s\n";
#endif
static Eina_Bool
eo_fundef_generate(const Eolian_Class *class, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *functext)
eo_fundef_generate(const Eolian_Class *class, Eolian_Function *func, Eolian_Function_Type ftype, Eina_Strbuf *functext)
{
_eolian_class_func_vars func_env;
const char *str_dir[] = {"in", "out", "inout"};
@ -238,7 +238,7 @@ eo_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{
const Eolian_Function_Type ftype_order[] = {EOLIAN_CTOR, EOLIAN_PROPERTY, EOLIAN_METHOD};
const Eina_List *itr;
Eolian_Function fid;
Eolian_Function *fid;
char *tmpstr = malloc(0x1FF);
Eina_Strbuf * str_hdr = eina_strbuf_new();
@ -326,7 +326,7 @@ eo_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
}
static Eina_Bool
eo_bind_func_generate(const Eolian_Class *class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, _eolian_class_vars *impl_env)
eo_bind_func_generate(const Eolian_Class *class, Eolian_Function *funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, _eolian_class_vars *impl_env)
{
_eolian_class_func_vars func_env;
const char *suffix = "";
@ -488,7 +488,7 @@ eo_bind_func_generate(const Eolian_Class *class, Eolian_Function funcid, Eolian_
}
static Eina_Bool
eo_op_desc_generate(const Eolian_Class *class, Eolian_Function fid, Eolian_Function_Type ftype,
eo_op_desc_generate(const Eolian_Class *class, Eolian_Function *fid, Eolian_Function_Type ftype,
const char *desc, Eina_Strbuf *buf)
{
_eolian_class_func_vars func_env;
@ -551,7 +551,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{
Eina_Bool ret = EINA_FALSE;
const Eina_List *itr;
Eolian_Function fn;
Eolian_Function *fn;
const char *str_classtype = NULL;
switch(eolian_class_type_get(class))
@ -624,7 +624,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
char implname[0xFF];
Eolian_Class *impl_class = NULL;
Eolian_Function_Type ftype;
Eolian_Function fnid = NULL;
Eolian_Function *fnid = NULL;
const char *funcname = NULL;
const char *rets;
char *tp = implname;
@ -819,7 +819,7 @@ eo_source_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{
Eina_Bool ret = EINA_FALSE;
const Eina_List *itr;
Eolian_Function fn;
Eolian_Function *fn;
Eina_Strbuf *str_bodyf = eina_strbuf_new();

View File

@ -8,7 +8,7 @@
static _eolian_class_vars class_env;
static Eina_Bool
_params_generate(Eolian_Function foo, Eolian_Function_Type ftype, Eina_Bool var_as_ret, Eina_Strbuf *params, Eina_Strbuf *short_params)
_params_generate(Eolian_Function *foo, Eolian_Function_Type ftype, Eina_Bool var_as_ret, Eina_Strbuf *params, Eina_Strbuf *short_params)
{
const Eina_List *itr;
Eolian_Function_Parameter *param;
@ -112,7 +112,7 @@ _type_exists(const char* type_name, Eina_Strbuf *buffer)
}
static Eina_Bool
_prototype_generate(Eolian_Function foo, Eolian_Function_Type ftype, Eina_Strbuf *data_type_buf, Eolian_Implement *impl_desc, Eina_Strbuf *buffer)
_prototype_generate(Eolian_Function *foo, Eolian_Function_Type ftype, Eina_Strbuf *data_type_buf, Eolian_Implement *impl_desc, Eina_Strbuf *buffer)
{
Eina_Bool var_as_ret = EINA_FALSE, ret_const = EINA_FALSE;
Eina_Strbuf *params = NULL, *short_params = NULL, *super_invok = NULL;
@ -199,7 +199,7 @@ impl_source_generate(const Eolian_Class *class, Eina_Strbuf *buffer)
Eina_Bool ret = EINA_FALSE;
Eina_Strbuf *data_type_buf = eina_strbuf_new();
const Eina_List *itr_funcs;
Eolian_Function foo;
Eolian_Function *foo;
Eina_Strbuf *begin = eina_strbuf_new();
const char *class_name = eolian_class_name_get(class);

View File

@ -42,7 +42,7 @@ EAPI void\n\
";
static void
_eapi_decl_func_generate(const Eolian_Class *class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf)
_eapi_decl_func_generate(const Eolian_Class *class, Eolian_Function *funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf)
{
_eolian_class_func_vars func_env;
const char *funcname = eolian_function_name_get(funcid);
@ -198,7 +198,7 @@ end:
}
static void
_eapi_func_generate(const Eolian_Class *class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf)
_eapi_func_generate(const Eolian_Class *class, Eolian_Function *funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf)
{
_eolian_class_func_vars func_env;
char tmpstr[0xFF];
@ -347,21 +347,21 @@ legacy_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
for (i = 0; i < 2; i++)
EINA_LIST_FOREACH(eolian_class_functions_list_get(class, ftype_order[i]), l, data)
{
const Eolian_Function_Type ftype = eolian_function_type_get((Eolian_Function)data);
const Eolian_Function_Type ftype = eolian_function_type_get((Eolian_Function*)data);
Eina_Bool prop_read = (ftype == EOLIAN_PROPERTY || ftype == EOLIAN_PROP_GET ) ? EINA_TRUE : EINA_FALSE ;
Eina_Bool prop_write = (ftype == EOLIAN_PROPERTY || ftype == EOLIAN_PROP_SET ) ? EINA_TRUE : EINA_FALSE ;
if (!prop_read && !prop_write)
{
_eapi_decl_func_generate(class, (Eolian_Function)data, EOLIAN_METHOD, buf);
_eapi_decl_func_generate(class, (Eolian_Function*)data, EOLIAN_METHOD, buf);
}
if (prop_write)
{
_eapi_decl_func_generate(class, (Eolian_Function)data, EOLIAN_PROP_SET, buf);
_eapi_decl_func_generate(class, (Eolian_Function*)data, EOLIAN_PROP_SET, buf);
}
if (prop_read)
{
_eapi_decl_func_generate(class, (Eolian_Function)data, EOLIAN_PROP_GET, buf);
_eapi_decl_func_generate(class, (Eolian_Function*)data, EOLIAN_PROP_GET, buf);
}
}
return EINA_TRUE;
@ -372,7 +372,7 @@ legacy_source_generate(const Eolian_Class *class, Eina_Strbuf *buf)
{
Eina_Bool ret = EINA_FALSE;
const Eina_List *itr;
Eolian_Function fn;
Eolian_Function *fn;
_class_env_create(class, NULL, &class_env);

View File

@ -49,7 +49,7 @@ static efl::eolian::parameters_container_type
convert_eolian_parameters(Eolian_Function const& func, getter_t func_type)
{
return convert_eolian_parameters
(::eolian_parameters_list_get(func), func_type.value);
(::eolian_parameters_list_get(&func), func_type.value);
}
static efl::eolian::parameters_container_type
@ -69,7 +69,7 @@ convert_eolian_parameters(Eolian_Function const& func)
{
assert(function_type(func) != EOLIAN_PROPERTY);
return convert_eolian_parameters
(::eolian_parameters_list_get(func), function_type(func));
(::eolian_parameters_list_get(&func), function_type(func));
}
static efl::eolian::functions_container_type
@ -84,19 +84,19 @@ convert_eolian_property_to_functions(Eolian_Class const& klass)
std::string prefix(class_prefix(klass));
EINA_LIST_FOREACH (properties, it, curr)
{
Eolian_Function prop_ = static_cast<Eolian_Function>(curr);
if (property_is_getter(prop_))
Eolian_Function *prop_ = static_cast<Eolian_Function*>(curr);
if (property_is_getter(*prop_))
{
efl::eolian::parameters_container_type params
= convert_eolian_parameters(prop_, eolian_cxx::getter);
= convert_eolian_parameters(*prop_, eolian_cxx::getter);
efl::eolian::eo_function get_;
get_.type = efl::eolian::eo_function::regular_;
get_.name = function_name(prop_) + "_get";
get_.impl = function_impl(prop_, prefix) + "_get";
get_.name = function_name(*prop_) + "_get";
get_.impl = function_impl(*prop_, prefix) + "_get";
efl::eolian::eolian_type_instance ret =
function_return_type(prop_, eolian_cxx::getter);
function_return_type(*prop_, eolian_cxx::getter);
// if the getter has a single parameter and a void return
// it is transformed into a getter with no parameters
@ -131,10 +131,10 @@ convert_eolian_property_to_functions(Eolian_Class const& klass)
get_.params.end());
get_.params = keys;
}
get_.comment = convert_comments_function(prop_, eolian_cxx::getter);
get_.comment = convert_comments_function(*prop_, eolian_cxx::getter);
container.push_back(get_);
}
if (property_is_setter(prop_))
if (property_is_setter(*prop_))
{
const Eina_List *keys_ = eolian_property_keys_list_get(prop_);
const Eina_List *args_ = eolian_parameters_list_get(prop_);
@ -144,11 +144,11 @@ convert_eolian_property_to_functions(Eolian_Class const& klass)
eina_list_free(params_);
efl::eolian::eo_function set_;
set_.type = efl::eolian::eo_function::regular_;
set_.name = function_name(prop_) + "_set";
set_.impl = function_impl(prop_, prefix) + "_set";
set_.name = function_name(*prop_) + "_set";
set_.impl = function_impl(*prop_, prefix) + "_set";
set_.params = params;
set_.ret = function_return_type(prop_, eolian_cxx::setter);
set_.comment = convert_comments_function(prop_, eolian_cxx::setter);
set_.ret = function_return_type(*prop_, eolian_cxx::setter);
set_.comment = convert_comments_function(*prop_, eolian_cxx::setter);
container.push_back(set_);
}
}
@ -200,7 +200,7 @@ convert_eolian_implements(efl::eolian::eo_class& cls, Eolian_Class const& klass)
{
Eolian_Implement *impl_desc = static_cast<Eolian_Implement*>(impl_desc_);
Eolian_Class *impl_class;
Eolian_Function impl_func;
Eolian_Function *impl_func;
Eolian_Function_Type impl_type;
eolian_implement_information_get
(impl_desc, &impl_class, &impl_func, &impl_type);
@ -209,9 +209,9 @@ convert_eolian_implements(efl::eolian::eo_class& cls, Eolian_Class const& klass)
efl::eolian::eo_constructor constructor;
std::string parent = safe_lower(eolian_class_full_name_get(impl_class));
if (parent == "eo_base" || parent == "eo.base") parent = "eo";
constructor.name = parent + "_" + function_name(impl_func);
constructor.params = convert_eolian_parameters(impl_func);
constructor.comment = convert_comments_function(impl_func, eolian_cxx::ctor);
constructor.name = parent + "_" + function_name(*impl_func);
constructor.params = convert_eolian_parameters(*impl_func);
constructor.comment = convert_comments_function(*impl_func, eolian_cxx::ctor);
cls.constructors.push_back(constructor);
}
}
@ -227,11 +227,11 @@ convert_eolian_constructors(efl::eolian::eo_class& cls, Eolian_Class const& klas
::eolian_class_functions_list_get(&klass, EOLIAN_CTOR);
EINA_LIST_FOREACH (constructors, it, curr)
{
Eolian_Function eo_constructor = static_cast<Eolian_Function>(curr);
Eolian_Function *eo_constructor = static_cast<Eolian_Function*>(curr);
efl::eolian::eo_constructor constructor;
constructor.name = function_impl(eo_constructor, prefix);
constructor.params = convert_eolian_parameters(eo_constructor);
constructor.comment = convert_comments_function(eo_constructor, eolian_cxx::ctor);
constructor.name = function_impl(*eo_constructor, prefix);
constructor.params = convert_eolian_parameters(*eo_constructor);
constructor.comment = convert_comments_function(*eo_constructor, eolian_cxx::ctor);
cls.constructors.push_back(constructor);
}
}
@ -247,14 +247,14 @@ convert_eolian_functions(efl::eolian::eo_class& cls, Eolian_Class const& klass)
EINA_LIST_FOREACH (eolian_functions, it, curr)
{
efl::eolian::eo_function func_;
Eolian_Function eol_func = static_cast<Eolian_Function>(curr);
Eolian_Function *eol_func = static_cast<Eolian_Function*>(curr);
// XXX Eolian only provides regular methods so far
func_.type = efl::eolian::eo_function::regular_;
func_.name = function_name(eol_func);
func_.impl = function_impl(eol_func, class_prefix(klass));
func_.ret = function_return_type(eol_func);
func_.params = convert_eolian_parameters(eol_func);
func_.comment = convert_comments_function(eol_func, eolian_cxx::method);
func_.name = function_name(*eol_func);
func_.impl = function_impl(*eol_func, class_prefix(klass));
func_.ret = function_return_type(*eol_func);
func_.params = convert_eolian_parameters(*eol_func);
func_.comment = convert_comments_function(*eol_func, eolian_cxx::method);
cls.functions.push_back(func_);
}
}

View File

@ -41,16 +41,16 @@ _comment_parameters_list(const Eina_List *params)
}
static std::string
_comment_brief_and_params(Eolian_Function function,
_comment_brief_and_params(Eolian_Function const& function,
const char *key = EOLIAN_COMMENT)
{
std::string doc = "";
std::string func = safe_str(::eolian_function_description_get(function, key));
std::string func = safe_str(::eolian_function_description_get(&function, key));
if (func != "")
{
doc += "@brief " + func + "\n\n";
}
std::string params = _comment_parameters_list(::eolian_parameters_list_get(function));
std::string params = _comment_parameters_list(::eolian_parameters_list_get(&function));
if (params != "")
{
doc += params + "\n";
@ -59,16 +59,16 @@ _comment_brief_and_params(Eolian_Function function,
}
static std::string
_comment_return(Eolian_Function function,
_comment_return(Eolian_Function const& function,
Eolian_Function_Type rettype)
{
Eolian_Type *rettypet = ::eolian_function_return_type_get(function, rettype);
Eolian_Type *rettypet = ::eolian_function_return_type_get(&function, rettype);
const char *rettypes = NULL;
if (rettypet) rettypes = ::eolian_type_c_type_get(rettypet);
std::string doc = "";
std::string ret = safe_str(rettypes);
if (rettypes) eina_stringshare_del(rettypes);
std::string comment = safe_str(::eolian_function_return_comment_get(function, rettype));
std::string comment = safe_str(::eolian_function_return_comment_get(&function, rettype));
if (ret != "void" && ret != "" && comment != "")
{
doc = "@return " + comment;

View File

@ -159,13 +159,13 @@ class_list_all()
inline std::string
function_name(Eolian_Function const& func)
{
return safe_str(::eolian_function_name_get(func));
return safe_str(::eolian_function_name_get(&func));
}
inline std::string
function_impl(Eolian_Function const& func, std::string const& prefix)
{
const char *s = ::eolian_function_full_c_name_get(func, prefix.c_str());
const char *s = ::eolian_function_full_c_name_get(&func, prefix.c_str());
std::string ret(s);
::eina_stringshare_del(s);
return ret;
@ -174,14 +174,14 @@ function_impl(Eolian_Function const& func, std::string const& prefix)
inline Eolian_Function_Type
function_type(Eolian_Function const& func)
{
return ::eolian_function_type_get(func);
return ::eolian_function_type_get(&func);
}
inline efl::eolian::eolian_type_instance
function_return_type(Eolian_Function const& func, Eolian_Function_Type func_type = method_t::value)
{
return type_lookup
(::eolian_function_return_type_get(func, func_type));
(::eolian_function_return_type_get(&func, func_type));
}
inline efl::eolian::eolian_type_instance

View File

@ -48,7 +48,7 @@ typedef struct _Eolian_Class Eolian_Class;
*
* @ingroup Eolian
*/
typedef struct _Eolian_Function* Eolian_Function;
typedef struct _Eolian_Function Eolian_Function;
/* Parameter/return type.
*
@ -384,7 +384,7 @@ EAPI const Eina_List *eolian_class_functions_list_get(const Eolian_Class *klass,
*
* @ingroup Eolian
*/
EAPI Eolian_Function_Type eolian_function_type_get(Eolian_Function function_id);
EAPI Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id);
/*
* @brief Returns the scope of a function
@ -394,7 +394,7 @@ EAPI Eolian_Function_Type eolian_function_type_get(Eolian_Function function_id);
*
* @ingroup Eolian
*/
EAPI Eolian_Function_Scope eolian_function_scope_get(Eolian_Function function_id);
EAPI Eolian_Function_Scope eolian_function_scope_get(const Eolian_Function *function_id);
/*
* @brief Returns the name of a function
@ -404,7 +404,7 @@ EAPI Eolian_Function_Scope eolian_function_scope_get(Eolian_Function function_id
*
* @ingroup Eolian
*/
EAPI const char *eolian_function_name_get(Eolian_Function function_id);
EAPI const char *eolian_function_name_get(const Eolian_Function *function_id);
/*
* @brief Returns the full C name of a function (with prefix). It's here
@ -417,7 +417,7 @@ EAPI const char *eolian_function_name_get(Eolian_Function function_id);
*
* @ingroup Eolian
*/
EAPI const char *eolian_function_full_c_name_get(Eolian_Function function_id, const char *prefix);
EAPI const char *eolian_function_full_c_name_get(const Eolian_Function *function_id, const char *prefix);
/*
* @brief Find a function in a class by its name and type
@ -429,7 +429,7 @@ EAPI const char *eolian_function_full_c_name_get(Eolian_Function function_id, co
*
* @ingroup Eolian
*/
EAPI Eolian_Function eolian_class_function_find_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
EAPI Eolian_Function *eolian_class_function_find_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
/*
* @brief Returns a specific data for a function.
@ -440,7 +440,7 @@ EAPI Eolian_Function eolian_class_function_find_by_name(const Eolian_Class *klas
*
* @ingroup Eolian
*/
EAPI const char *eolian_function_data_get(Eolian_Function function_id, const char *key);
EAPI const char *eolian_function_data_get(const Eolian_Function *function_id, const char *key);
/*
* @brief Indicates if a function is virtual pure.
@ -450,7 +450,7 @@ EAPI const char *eolian_function_data_get(Eolian_Function function_id, const cha
*
* @ingroup Eolian
*/
EAPI Eina_Bool eolian_function_is_virtual_pure(Eolian_Function function_id, Eolian_Function_Type f_type);
EAPI Eina_Bool eolian_function_is_virtual_pure(const Eolian_Function *function_id, Eolian_Function_Type f_type);
/*
* @brief Returns a specific description for a function.
@ -472,7 +472,7 @@ EAPI Eina_Bool eolian_function_is_virtual_pure(Eolian_Function function_id, Eoli
*
* @ingroup Eolian
*/
EAPI Eolian_Function_Parameter *eolian_function_parameter_get(const Eolian_Function function_id, const char *param_name);
EAPI Eolian_Function_Parameter *eolian_function_parameter_get(const Eolian_Function *function_id, const char *param_name);
/*
* @brief Returns a list of keys params of a given function.
@ -482,7 +482,7 @@ EAPI Eolian_Function_Parameter *eolian_function_parameter_get(const Eolian_Funct
*
* @ingroup Eolian
*/
EAPI const Eina_List *eolian_property_keys_list_get(Eolian_Function foo_id);
EAPI const Eina_List *eolian_property_keys_list_get(const Eolian_Function *foo_id);
/*
* @brief Returns a list of values params of a given function.
@ -492,7 +492,7 @@ EAPI const Eina_List *eolian_property_keys_list_get(Eolian_Function foo_id);
*
* @ingroup Eolian
*/
EAPI const Eina_List *eolian_property_values_list_get(Eolian_Function foo_id);
EAPI const Eina_List *eolian_property_values_list_get(const Eolian_Function *foo_id);
/*
* @brief Returns a list of parameter handles for a method/ctor/dtor.
@ -502,7 +502,7 @@ EAPI const Eina_List *eolian_property_values_list_get(Eolian_Function foo_id);
*
* @ingroup Eolian
*/
EAPI const Eina_List *eolian_parameters_list_get(Eolian_Function function_id);
EAPI const Eina_List *eolian_parameters_list_get(const Eolian_Function *function_id);
/*
* @brief Get information about a function parameter
@ -573,7 +573,7 @@ EAPI Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param
*
* @ingroup Eolian
*/
EAPI Eolian_Type *eolian_function_return_type_get(Eolian_Function function_id, Eolian_Function_Type ftype);
EAPI Eolian_Type *eolian_function_return_type_get(const Eolian_Function *function_id, Eolian_Function_Type ftype);
/*
* @brief Get the return default value of a function.
@ -589,7 +589,7 @@ EAPI Eolian_Type *eolian_function_return_type_get(Eolian_Function function_id, E
* @ingroup Eolian
*/
EAPI const char *
eolian_function_return_dflt_value_get(Eolian_Function foo_id, Eolian_Function_Type ftype);
eolian_function_return_dflt_value_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
/*
* @brief Get the return comment of a function.
@ -604,7 +604,7 @@ eolian_function_return_dflt_value_get(Eolian_Function foo_id, Eolian_Function_Ty
* @ingroup Eolian
*/
EAPI const char *
eolian_function_return_comment_get(Eolian_Function foo_id, Eolian_Function_Type ftype);
eolian_function_return_comment_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
/*
* @brief Indicates if a function return is warn-unused.
@ -618,7 +618,7 @@ eolian_function_return_comment_get(Eolian_Function foo_id, Eolian_Function_Type
*
* @ingroup Eolian
*/
EAPI Eina_Bool eolian_function_return_is_warn_unused(Eolian_Function foo_id, Eolian_Function_Type ftype);
EAPI Eina_Bool eolian_function_return_is_warn_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
/*
* @brief Indicates if a function object is const.
@ -628,7 +628,7 @@ EAPI Eina_Bool eolian_function_return_is_warn_unused(Eolian_Function foo_id, Eol
*
* @ingroup Eolian
*/
EAPI Eina_Bool eolian_function_object_is_const(Eolian_Function function_id);
EAPI Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_id);
/*
* @brief Get full string of an overriding function (implement).
@ -652,7 +652,7 @@ EAPI Eina_Stringshare * eolian_implement_full_name_get(const Eolian_Implement *i
* @ingroup Eolian
*/
EAPI Eina_Bool eolian_implement_information_get(const Eolian_Implement *impl,
Eolian_Class **klass, Eolian_Function *function, Eolian_Function_Type *type);
Eolian_Class **klass, Eolian_Function **function, Eolian_Function_Type *type);
/*
* @brief Get the list of overriding functions defined in a class.

View File

@ -1227,7 +1227,7 @@ _db_fill_class(Eo_Class_Def *kls, const char *filename)
}
EINA_LIST_FOREACH(kls->constructors, l, meth)
{
Eolian_Function foo_id = database_function_new(meth->name, EOLIAN_CTOR);
Eolian_Function *foo_id = database_function_new(meth->name, EOLIAN_CTOR);
database_class_function_add(class, foo_id);
if (meth->ret) database_function_return_comment_set(foo_id, EOLIAN_METHOD, meth->ret->comment);
database_function_data_set(foo_id, EOLIAN_LEGACY, meth->legacy);
@ -1240,7 +1240,7 @@ _db_fill_class(Eo_Class_Def *kls, const char *filename)
EINA_LIST_FOREACH(kls->properties, l, prop)
{
Eolian_Function foo_id = database_function_new(prop->name, EOLIAN_UNRESOLVED);
Eolian_Function *foo_id = database_function_new(prop->name, EOLIAN_UNRESOLVED);
database_function_scope_set(foo_id, prop->scope);
EINA_LIST_FOREACH(prop->keys, m, param)
{
@ -1310,7 +1310,7 @@ _db_fill_class(Eo_Class_Def *kls, const char *filename)
EINA_LIST_FOREACH(kls->methods, l, meth)
{
Eolian_Function foo_id = database_function_new(meth->name, EOLIAN_METHOD);
Eolian_Function *foo_id = database_function_new(meth->name, EOLIAN_METHOD);
database_function_scope_set(foo_id, meth->scope);
database_class_function_add(class, foo_id);
if (meth->ret)
@ -1365,7 +1365,7 @@ _db_fill_class(Eo_Class_Def *kls, const char *filename)
else if (!strcmp(type_as_str+1, "get")) ftype = EOLIAN_PROP_GET;
}
/* Search the function into the existing functions of the current class */
Eolian_Function foo_id = eolian_class_function_find_by_name(
Eolian_Function *foo_id = eolian_class_function_find_by_name(
class, func, ftype);
free(virtual_name);
if (!foo_id)

View File

@ -21,7 +21,7 @@ static Eina_Hash *_filenames = NULL; /* Hash: filename without extension -> full
static Eina_Hash *_tfilenames = NULL;
static int _database_init_count = 0;
typedef struct _Eolian_Class
struct _Eolian_Class
{
Eina_Stringshare *full_name;
Eina_List *namespaces; /* List Eina_Stringshare * */
@ -33,14 +33,14 @@ typedef struct _Eolian_Class
Eina_Stringshare *eo_prefix;
Eina_Stringshare *data_type;
Eina_List *inherits; /* List Eina_Stringshare * */
Eina_List *properties; /* List prop_name -> _Eolian_Function */
Eina_List *methods; /* List meth_name -> _Eolian_Function */
Eina_List *constructors; /* List constructor_name -> _Eolian_Function */
Eina_List *properties; /* List prop_name -> Eolian_Function */
Eina_List *methods; /* List meth_name -> Eolian_Function */
Eina_List *constructors; /* List constructor_name -> Eolian_Function */
Eina_List *implements; /* List implements name -> Eolian_Implement */
Eina_List *events; /* List event_name -> Eolian_Event */
Eina_Bool class_ctor_enable:1;
Eina_Bool class_dtor_enable:1;
} Eolian_Class;
};
typedef struct
{
@ -48,7 +48,7 @@ typedef struct
Eolian_Type *type;
} Type_Desc;
typedef struct
struct _Eolian_Function
{
Eina_Stringshare *name;
Eina_List *keys; /* list of Eolian_Function_Parameter */
@ -63,9 +63,9 @@ typedef struct
Eina_Bool set_virtual_pure :1;
Eina_Bool get_return_warn_unused :1; /* also used for methods */
Eina_Bool set_return_warn_unused :1;
} _Eolian_Function;
};
typedef struct _Eolian_Function_Parameter
struct _Eolian_Function_Parameter
{
Eina_Stringshare *name;
Eolian_Type *type;
@ -74,7 +74,7 @@ typedef struct _Eolian_Function_Parameter
Eina_Bool is_const_on_get :1; /* True if const in this the get property */
Eina_Bool is_const_on_set :1; /* True if const in this the set property */
Eina_Bool nonull :1; /* True if this argument cannot be NULL */
} Eolian_Function_Parameter;
};
/* maps directly to Eo_Type_Def */
@ -84,7 +84,7 @@ typedef struct
const char *comment;
} _Struct_Field_Type;
typedef struct _Eolian_Type
struct _Eolian_Type
{
const char *name;
Eolian_Type_Type type;
@ -104,19 +104,19 @@ typedef struct _Eolian_Type
};
Eina_Bool is_const :1;
Eina_Bool is_own :1;
} Eolian_Type;
};
typedef struct _Eolian_Implement
struct _Eolian_Implement
{
Eina_Stringshare *full_name;
} Eolian_Implement;
};
typedef struct _Eolian_Event
struct _Eolian_Event
{
Eina_Stringshare *name;
Eina_Stringshare *type;
Eina_Stringshare *comment;
} Eolian_Event;
};
static void
_param_del(Eolian_Function_Parameter *pdesc)
@ -136,7 +136,7 @@ database_type_del(Eolian_Type *type)
}
static void
_fid_del(_Eolian_Function *fid)
_fid_del(Eolian_Function *fid)
{
Eolian_Function_Parameter *param;
if (!fid) return;
@ -165,7 +165,7 @@ _class_del(Eolian_Class *class)
free(impl);
}
_Eolian_Function *fid;
Eolian_Function *fid;
Eolian_Event *ev;
EINA_LIST_FREE(class->constructors, fid) _fid_del(fid);
EINA_LIST_FREE(class->methods, fid) _fid_del(fid);
@ -495,36 +495,33 @@ eolian_class_implements_list_get(const Eolian_Class *cl)
return cl->implements;
}
Eolian_Function
Eolian_Function *
database_function_new(const char *function_name, Eolian_Function_Type foo_type)
{
_Eolian_Function *fid = calloc(1, sizeof(*fid));
Eolian_Function *fid = calloc(1, sizeof(*fid));
fid->name = eina_stringshare_add(function_name);
fid->type = foo_type;
fid->data = eina_hash_string_superfast_new(free);
return (Eolian_Function) fid;
return fid;
}
EAPI Eolian_Function_Scope
eolian_function_scope_get(Eolian_Function function_id)
eolian_function_scope_get(const Eolian_Function *fid)
{
_Eolian_Function *fid = (_Eolian_Function *)function_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_SCOPE_PUBLIC);
return fid->scope;
}
void
database_function_scope_set(Eolian_Function function_id, Eolian_Function_Scope scope)
database_function_scope_set(Eolian_Function *fid, Eolian_Function_Scope scope)
{
_Eolian_Function *fid = (_Eolian_Function *)function_id;
EINA_SAFETY_ON_NULL_RETURN(fid);
fid->scope = scope;
}
void
database_function_type_set(Eolian_Function function_id, Eolian_Function_Type foo_type)
database_function_type_set(Eolian_Function *fid, Eolian_Function_Type foo_type)
{
_Eolian_Function *fid = (_Eolian_Function *)function_id;
EINA_SAFETY_ON_NULL_RETURN(fid);
switch (foo_type)
{
@ -540,23 +537,22 @@ database_function_type_set(Eolian_Function function_id, Eolian_Function_Type foo
fid->type = foo_type;
}
Eina_Bool database_class_function_add(Eolian_Class *cl, Eolian_Function foo_id)
Eina_Bool database_class_function_add(Eolian_Class *cl, Eolian_Function *fid)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
EINA_SAFETY_ON_FALSE_RETURN_VAL(foo_id && cl, EINA_FALSE);
_Eolian_Function *fid = (_Eolian_Function *) foo_id;
EINA_SAFETY_ON_FALSE_RETURN_VAL(fid && cl, EINA_FALSE);
switch (fid->type)
{
case EOLIAN_PROPERTY:
case EOLIAN_PROP_SET:
case EOLIAN_PROP_GET:
cl->properties = eina_list_append(cl->properties, foo_id);
cl->properties = eina_list_append(cl->properties, fid);
break;
case EOLIAN_METHOD:
cl->methods = eina_list_append(cl->methods, foo_id);
cl->methods = eina_list_append(cl->methods, fid);
break;
case EOLIAN_CTOR:
cl->constructors = eina_list_append(cl->constructors, foo_id);
cl->constructors = eina_list_append(cl->constructors, fid);
break;
default:
ERR("Bad function type %d.", fid->type);
@ -591,7 +587,7 @@ eolian_implement_full_name_get(const Eolian_Implement *impl)
}
EAPI Eina_Bool
eolian_implement_information_get(const Eolian_Implement *impl, Eolian_Class **class_out, Eolian_Function *func_out, Eolian_Function_Type *type_out)
eolian_implement_information_get(const Eolian_Implement *impl, Eolian_Class **class_out, Eolian_Function **func_out, Eolian_Function_Type *type_out)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
Eolian_Class *class;
@ -609,7 +605,7 @@ eolian_implement_information_get(const Eolian_Implement *impl, Eolian_Class **cl
else if (!strcmp(colon+1, "get")) type = EOLIAN_PROP_GET;
}
Eolian_Function fid = eolian_class_function_find_by_name(class, func_name, type);
Eolian_Function *fid = eolian_class_function_find_by_name(class, func_name, type);
if (func_out) *func_out = fid;
if (type == EOLIAN_UNRESOLVED) type = eolian_function_type_get(fid);
if (type_out) *type_out = type;
@ -617,39 +613,36 @@ eolian_implement_information_get(const Eolian_Implement *impl, Eolian_Class **cl
return EINA_TRUE;
}
EAPI Eolian_Function
EAPI Eolian_Function *
eolian_class_function_find_by_name(const Eolian_Class *cl, const char *func_name, Eolian_Function_Type f_type)
{
Eina_List *itr;
Eolian_Function foo_id;
Eolian_Function *fid;
if (!cl) return NULL;
if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_METHOD)
EINA_LIST_FOREACH(cl->methods, itr, foo_id)
EINA_LIST_FOREACH(cl->methods, itr, fid)
{
_Eolian_Function *fid = (_Eolian_Function *) foo_id;
if (!strcmp(fid->name, func_name))
return foo_id;
return fid;
}
if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_PROPERTY ||
f_type == EOLIAN_PROP_SET || f_type == EOLIAN_PROP_GET)
{
EINA_LIST_FOREACH(cl->properties, itr, foo_id)
EINA_LIST_FOREACH(cl->properties, itr, fid)
{
_Eolian_Function *fid = (_Eolian_Function *) foo_id;
if (!strcmp(fid->name, func_name))
return foo_id;
return fid;
}
}
if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_CTOR)
{
EINA_LIST_FOREACH(cl->constructors, itr, foo_id)
EINA_LIST_FOREACH(cl->constructors, itr, fid)
{
_Eolian_Function *fid = (_Eolian_Function *) foo_id;
if (!strcmp(fid->name, func_name))
return foo_id;
return fid;
}
}
@ -674,23 +667,21 @@ eolian_class_functions_list_get(const Eolian_Class *cl, Eolian_Function_Type foo
}
EAPI Eolian_Function_Type
eolian_function_type_get(Eolian_Function function_id)
eolian_function_type_get(const Eolian_Function *fid)
{
_Eolian_Function *fid = (_Eolian_Function *)function_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_UNRESOLVED);
return fid->type;
}
EAPI const char *
eolian_function_name_get(Eolian_Function function_id)
eolian_function_name_get(const Eolian_Function *fid)
{
_Eolian_Function *fid = (_Eolian_Function *)function_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
return fid->name;
}
EAPI const char *
eolian_function_full_c_name_get(Eolian_Function foo_id, const char *prefix)
eolian_function_full_c_name_get(const Eolian_Function *foo_id, const char *prefix)
{
const char *funcn = eolian_function_name_get(foo_id);
const char *last_p = strrchr(prefix, '_');
@ -724,9 +715,8 @@ eolian_function_full_c_name_get(Eolian_Function foo_id, const char *prefix)
}
Eina_Bool
database_function_set_as_virtual_pure(Eolian_Function function_id, Eolian_Function_Type ftype)
database_function_set_as_virtual_pure(Eolian_Function *fid, Eolian_Function_Type ftype)
{
_Eolian_Function *fid = (_Eolian_Function *)function_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
switch (ftype)
{
@ -738,9 +728,8 @@ database_function_set_as_virtual_pure(Eolian_Function function_id, Eolian_Functi
}
EAPI Eina_Bool
eolian_function_is_virtual_pure(Eolian_Function function_id, Eolian_Function_Type ftype)
eolian_function_is_virtual_pure(const Eolian_Function *fid, Eolian_Function_Type ftype)
{
_Eolian_Function *fid = (_Eolian_Function *)function_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
switch (ftype)
{
@ -751,10 +740,9 @@ eolian_function_is_virtual_pure(Eolian_Function function_id, Eolian_Function_Typ
}
void
database_function_data_set(Eolian_Function function_id, const char *key, const char *data)
database_function_data_set(Eolian_Function *fid, const char *key, const char *data)
{
EINA_SAFETY_ON_NULL_RETURN(key);
_Eolian_Function *fid = (_Eolian_Function *)function_id;
EINA_SAFETY_ON_NULL_RETURN(fid);
if (data)
{
@ -768,9 +756,8 @@ database_function_data_set(Eolian_Function function_id, const char *key, const c
}
EAPI const char *
eolian_function_data_get(Eolian_Function function_id, const char *key)
eolian_function_data_get(const Eolian_Function *fid, const char *key)
{
_Eolian_Function *fid = (_Eolian_Function *)function_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
return eina_hash_find(fid->data, key);
}
@ -787,9 +774,8 @@ _parameter_new(Eolian_Type *type, const char *name, const char *description)
}
Eolian_Function_Parameter *
database_property_key_add(Eolian_Function foo_id, Eolian_Type *type, const char *name, const char *description)
database_property_key_add(Eolian_Function *fid, Eolian_Type *type, const char *name, const char *description)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
Eolian_Function_Parameter *param = _parameter_new(type, name, description);
fid->keys = eina_list_append(fid->keys, param);
@ -797,9 +783,8 @@ database_property_key_add(Eolian_Function foo_id, Eolian_Type *type, const char
}
Eolian_Function_Parameter *
database_property_value_add(Eolian_Function foo_id, Eolian_Type *type, const char *name, const char *description)
database_property_value_add(Eolian_Function *fid, Eolian_Type *type, const char *name, const char *description)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
Eolian_Function_Parameter *param = _parameter_new(type, name, description);
fid->params = eina_list_append(fid->params, param);
@ -807,9 +792,8 @@ database_property_value_add(Eolian_Function foo_id, Eolian_Type *type, const cha
}
Eolian_Function_Parameter *
database_method_parameter_add(Eolian_Function foo_id, Eolian_Parameter_Dir param_dir, Eolian_Type *type, const char *name, const char *description)
database_method_parameter_add(Eolian_Function *fid, Eolian_Parameter_Dir param_dir, Eolian_Type *type, const char *name, const char *description)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
Eolian_Function_Parameter *param = _parameter_new(type, name, description);
param->param_dir = param_dir;
@ -818,9 +802,8 @@ database_method_parameter_add(Eolian_Function foo_id, Eolian_Parameter_Dir param
}
EAPI Eolian_Function_Parameter *
eolian_function_parameter_get(const Eolian_Function foo_id, const char *param_name)
eolian_function_parameter_get(const Eolian_Function *fid, const char *param_name)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
Eina_List *itr;
Eolian_Function_Parameter *param;
@ -847,23 +830,21 @@ eolian_parameter_name_get(const Eolian_Function_Parameter *param)
}
EAPI const Eina_List *
eolian_property_keys_list_get(Eolian_Function foo_id)
eolian_property_keys_list_get(const Eolian_Function *fid)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
return fid->keys;
}
EAPI const Eina_List *
eolian_property_values_list_get(Eolian_Function foo_id)
eolian_property_values_list_get(const Eolian_Function *fid)
{
return eolian_parameters_list_get(foo_id);
return eolian_parameters_list_get(fid);
}
EAPI const Eina_List *
eolian_parameters_list_get(Eolian_Function foo_id)
eolian_parameters_list_get(const Eolian_Function *fid)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
return fid->params;
}
@ -920,9 +901,8 @@ eolian_parameter_is_nonull(const Eolian_Function_Parameter *param)
return param->nonull;
}
void database_function_return_type_set(Eolian_Function foo_id, Eolian_Function_Type ftype, Eolian_Type *ret_type)
void database_function_return_type_set(Eolian_Function *fid, Eolian_Function_Type ftype, Eolian_Type *ret_type)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
switch (ftype)
{
case EOLIAN_PROP_SET: fid->set_ret_type = ret_type; break;
@ -932,9 +912,8 @@ void database_function_return_type_set(Eolian_Function foo_id, Eolian_Function_T
}
EAPI Eolian_Type *
eolian_function_return_type_get(Eolian_Function foo_id, Eolian_Function_Type ftype)
eolian_function_return_type_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
switch (ftype)
{
case EOLIAN_PROP_SET: return fid->set_ret_type;
@ -943,7 +922,7 @@ eolian_function_return_type_get(Eolian_Function foo_id, Eolian_Function_Type fty
}
}
void database_function_return_dflt_val_set(Eolian_Function foo_id, Eolian_Function_Type ftype, const char *ret_dflt_value)
void database_function_return_dflt_val_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *ret_dflt_value)
{
const char *key = NULL;
switch (ftype)
@ -953,11 +932,11 @@ void database_function_return_dflt_val_set(Eolian_Function foo_id, Eolian_Functi
case EOLIAN_METHOD: key = METHOD_RETURN_DFLT_VAL; break;
default: return;
}
database_function_data_set(foo_id, key, ret_dflt_value);
database_function_data_set(fid, key, ret_dflt_value);
}
EAPI const char *
eolian_function_return_dflt_value_get(Eolian_Function foo_id, Eolian_Function_Type ftype)
eolian_function_return_dflt_value_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
{
const char *key = NULL;
switch (ftype)
@ -967,11 +946,11 @@ eolian_function_return_dflt_value_get(Eolian_Function foo_id, Eolian_Function_Ty
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: key = METHOD_RETURN_DFLT_VAL; break;
default: return NULL;
}
return eolian_function_data_get(foo_id, key);
return eolian_function_data_get(fid, key);
}
EAPI const char *
eolian_function_return_comment_get(Eolian_Function foo_id, Eolian_Function_Type ftype)
eolian_function_return_comment_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
{
const char *key = NULL;
switch (ftype)
@ -981,10 +960,10 @@ eolian_function_return_comment_get(Eolian_Function foo_id, Eolian_Function_Type
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: key = EOLIAN_METHOD_RETURN_COMMENT; break;
default: return NULL;
}
return eolian_function_data_get(foo_id, key);
return eolian_function_data_get(fid, key);
}
void database_function_return_comment_set(Eolian_Function foo_id, Eolian_Function_Type ftype, const char *ret_comment)
void database_function_return_comment_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *ret_comment)
{
const char *key = NULL;
switch (ftype)
@ -994,13 +973,12 @@ void database_function_return_comment_set(Eolian_Function foo_id, Eolian_Functio
case EOLIAN_METHOD: key = EOLIAN_METHOD_RETURN_COMMENT; break;
default: return;
}
database_function_data_set(foo_id, key, ret_comment);
database_function_data_set(fid, key, ret_comment);
}
void database_function_return_flag_set_as_warn_unused(Eolian_Function foo_id,
void database_function_return_flag_set_as_warn_unused(Eolian_Function *fid,
Eolian_Function_Type ftype, Eina_Bool warn_unused)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN(fid);
switch (ftype)
{
@ -1011,10 +989,9 @@ void database_function_return_flag_set_as_warn_unused(Eolian_Function foo_id,
}
EAPI Eina_Bool
eolian_function_return_is_warn_unused(Eolian_Function foo_id,
eolian_function_return_is_warn_unused(const Eolian_Function *fid,
Eolian_Function_Type ftype)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
switch (ftype)
{
@ -1025,17 +1002,15 @@ eolian_function_return_is_warn_unused(Eolian_Function foo_id,
}
void
database_function_object_set_as_const(Eolian_Function foo_id, Eina_Bool is_const)
database_function_object_set_as_const(Eolian_Function *fid, Eina_Bool is_const)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN(fid);
fid->obj_is_const = is_const;
}
EAPI Eina_Bool
eolian_function_object_is_const(Eolian_Function foo_id)
eolian_function_object_is_const(const Eolian_Function *fid)
{
_Eolian_Function *fid = (_Eolian_Function *)foo_id;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
return fid->obj_is_const;
}
@ -1406,7 +1381,7 @@ static void
_implements_print(Eolian_Implement *impl, int nb_spaces)
{
Eolian_Class *class;
Eolian_Function func;
Eolian_Function *func;
const char *t;
Eolian_Function_Type ft;
@ -1436,60 +1411,59 @@ _event_print(Eolian_Event *ev, int nb_spaces)
printf("%*s <%s> <%s> <%s>\n", nb_spaces + 5, "", name, type, comment);
}
static Eina_Bool _function_print(const _Eolian_Function *fid, int nb_spaces)
static Eina_Bool _function_print(const Eolian_Function *fid, int nb_spaces)
{
Eolian_Function foo_id = (Eolian_Function) fid;
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
const char *ret_desc = eolian_function_return_comment_get(foo_id, fid->type);
const char *ret_desc = eolian_function_return_comment_get(fid, fid->type);
switch (fid->type)
{
case EOLIAN_PROPERTY:
{
printf("%*s<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
const char *str = eolian_function_description_get(foo_id, EOLIAN_COMMENT_GET);
const char *str = eolian_function_description_get(fid, EOLIAN_COMMENT_GET);
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
str = eolian_function_description_get(foo_id, EOLIAN_COMMENT_SET);
str = eolian_function_description_get(fid, EOLIAN_COMMENT_SET);
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_LEGACY_GET);
str = eolian_function_data_get(fid, EOLIAN_LEGACY_GET);
if (str) printf("%*slegacy_get: <%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_LEGACY_SET);
str = eolian_function_data_get(fid, EOLIAN_LEGACY_SET);
if (str) printf("%*slegacy_set: <%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_PROP_GET_RETURN_TYPE);
str = eolian_function_data_get(fid, EOLIAN_PROP_GET_RETURN_TYPE);
if (str) printf("%*sreturn type for get: <%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_PROP_SET_RETURN_TYPE);
str = eolian_function_data_get(fid, EOLIAN_PROP_SET_RETURN_TYPE);
if (str) printf("%*sreturn type for set: <%s>\n", nb_spaces + 5, "", str);
break;
}
case EOLIAN_PROP_GET:
{
printf("%*sGET:<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
const char *str = eolian_function_description_get(foo_id, EOLIAN_COMMENT_GET);
const char *str = eolian_function_description_get(fid, EOLIAN_COMMENT_GET);
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_LEGACY_GET);
str = eolian_function_data_get(fid, EOLIAN_LEGACY_GET);
if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_PROP_GET_RETURN_TYPE);
str = eolian_function_data_get(fid, EOLIAN_PROP_GET_RETURN_TYPE);
if (str) printf("%*sreturn type: <%s>\n", nb_spaces + 5, "", str);
break;
}
case EOLIAN_PROP_SET:
{
printf("%*sSET:<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
const char *str = eolian_function_description_get(foo_id, EOLIAN_COMMENT_SET);
const char *str = eolian_function_description_get(fid, EOLIAN_COMMENT_SET);
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_LEGACY_SET);
str = eolian_function_data_get(fid, EOLIAN_LEGACY_SET);
if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_PROP_SET_RETURN_TYPE);
str = eolian_function_data_get(fid, EOLIAN_PROP_SET_RETURN_TYPE);
if (str) printf("%*sreturn type: <%s>\n", nb_spaces + 5, "", str);
break;
}
case EOLIAN_METHOD:
{
printf("%*s<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
const char *str = eolian_function_description_get(foo_id, EOLIAN_COMMENT);
const char *str = eolian_function_description_get(fid, EOLIAN_COMMENT);
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_LEGACY);
str = eolian_function_data_get(fid, EOLIAN_LEGACY);
if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_METHOD_RETURN_TYPE);
str = eolian_function_data_get(fid, EOLIAN_METHOD_RETURN_TYPE);
if (str) printf("%*sreturn type: <%s>\n", nb_spaces + 5, "", str);
if (fid->obj_is_const) printf("%*sobj const: <true>\n", nb_spaces + 5, "");
break;
@ -1497,11 +1471,11 @@ static Eina_Bool _function_print(const _Eolian_Function *fid, int nb_spaces)
case EOLIAN_CTOR:
{
//char *str = eina_hash_find(fid->data, "comment");
const char *str = eolian_function_description_get(foo_id, EOLIAN_COMMENT);
const char *str = eolian_function_description_get(fid, EOLIAN_COMMENT);
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_LEGACY);
str = eolian_function_data_get(fid, EOLIAN_LEGACY);
if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
str = eolian_function_data_get(foo_id, EOLIAN_METHOD_RETURN_TYPE);
str = eolian_function_data_get(fid, EOLIAN_METHOD_RETURN_TYPE);
if (str) printf("%*sreturn type: <%s>\n", nb_spaces + 5, "", str);
break;
}
@ -1536,7 +1510,7 @@ static Eina_Bool
_class_print(const Eolian_Class *cl)
{
Eina_List *itr;
_Eolian_Function *function;
Eolian_Function *function;
const char *types[5] = {"", "Regular", "Regular Non Instantiable", "Mixin", "Interface"};
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
@ -1743,7 +1717,7 @@ eolian_eo_file_parse(const char *filepath)
EINA_LIST_FOREACH(eolian_class_implements_list_get(class), itr, impl)
{
Eolian_Class *impl_class;
Eolian_Function impl_func;
Eolian_Function *impl_func;
Eolian_Function_Type impl_type = EOLIAN_UNRESOLVED;
eolian_implement_information_get(impl, &impl_class, &impl_func, &impl_type);
if (!impl_func)

View File

@ -71,27 +71,27 @@ Eina_Bool
database_class_file_set(Eolian_Class *class, const char *file_name);
/* Create a function */
Eolian_Function database_function_new(const char *function_name, Eolian_Function_Type foo_type);
Eolian_Function *database_function_new(const char *function_name, Eolian_Function_Type foo_type);
/* Set a type to a function */
void database_function_type_set(Eolian_Function function_id, Eolian_Function_Type foo_type);
void database_function_type_set(Eolian_Function *function_id, Eolian_Function_Type foo_type);
/* Add a function to a class */
Eina_Bool database_class_function_add(Eolian_Class *class, Eolian_Function foo_id);
Eina_Bool database_class_function_add(Eolian_Class *class, Eolian_Function *foo_id);
void database_function_data_set(Eolian_Function function_id, const char *key, const char *description);
void database_function_data_set(Eolian_Function *function_id, const char *key, const char *description);
/* Add a description to a function */
#define database_function_description_set(foo_id, key, desc) database_function_data_set((foo_id), (key), (desc))
/* Add a key to a property */
Eolian_Function_Parameter *database_property_key_add(Eolian_Function foo_id, Eolian_Type *type, const char *name, const char *description);
Eolian_Function_Parameter *database_property_key_add(Eolian_Function *foo_id, Eolian_Type *type, const char *name, const char *description);
/* Add a value to a property */
Eolian_Function_Parameter *database_property_value_add(Eolian_Function foo_id, Eolian_Type *type, const char *name, const char *description);
Eolian_Function_Parameter *database_property_value_add(Eolian_Function *foo_id, Eolian_Type *type, const char *name, const char *description);
/* Add a parameter to a method */
Eolian_Function_Parameter *database_method_parameter_add(Eolian_Function foo_id, Eolian_Parameter_Dir param_dir, Eolian_Type *type, const char *name, const char *description);
Eolian_Function_Parameter *database_method_parameter_add(Eolian_Function *foo_id, Eolian_Parameter_Dir param_dir, Eolian_Type *type, const char *name, const char *description);
void database_type_del(Eolian_Type *type);
@ -99,22 +99,22 @@ void database_parameter_const_attribute_set(Eolian_Function_Parameter *param, Ei
void database_parameter_nonull_set(Eolian_Function_Parameter *param, Eina_Bool nonull);
void database_function_return_type_set(Eolian_Function foo_id, Eolian_Function_Type ftype, Eolian_Type *ret_type);
void database_function_return_type_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, Eolian_Type *ret_type);
void database_function_return_comment_set(Eolian_Function foo_id, Eolian_Function_Type ftype, const char *ret_comment);
void database_function_return_comment_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, const char *ret_comment);
void database_function_return_dflt_val_set(Eolian_Function foo_id, Eolian_Function_Type ftype, const char *ret_dflt_value);
void database_function_return_dflt_val_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, const char *ret_dflt_value);
void database_function_return_flag_set_as_warn_unused(Eolian_Function foo_id,
void database_function_return_flag_set_as_warn_unused(Eolian_Function *foo_id,
Eolian_Function_Type ftype, Eina_Bool warn_unused);
void database_function_object_set_as_const(Eolian_Function foo_id, Eina_Bool is_const);
void database_function_object_set_as_const(Eolian_Function *foo_id, Eina_Bool is_const);
Eina_Bool
database_function_set_as_virtual_pure(Eolian_Function function_id, Eolian_Function_Type type);
database_function_set_as_virtual_pure(Eolian_Function *function_id, Eolian_Function_Type type);
void
database_function_scope_set(Eolian_Function function_id, Eolian_Function_Scope scope);
database_function_scope_set(Eolian_Function *function_id, Eolian_Function_Scope scope);
/* Need to add API for callbacks and implements */

View File

@ -12,7 +12,7 @@
START_TEST(eolian_namespaces)
{
Eolian_Class *class11, *class112, *class21, *class_no, *impl_class;
Eolian_Function fid;
Eolian_Function *fid;
const Eina_List *list = NULL;
Eolian_Function_Type func_type;
const char *class_name;
@ -116,10 +116,10 @@ END_TEST
START_TEST(eolian_override)
{
Eolian_Function fid = NULL;
Eolian_Function *fid = NULL;
const Eina_List *impls = NULL;
Eolian_Class *impl_class = NULL;
Eolian_Function impl_func = NULL;
Eolian_Function *impl_func = NULL;
Eolian_Class *class, *base;
eolian_init();
@ -154,7 +154,7 @@ END_TEST
START_TEST(eolian_consts)
{
Eolian_Function fid = NULL;
Eolian_Function *fid = NULL;
Eolian_Function_Parameter *param = NULL;
Eolian_Class *class;
@ -181,7 +181,7 @@ START_TEST(eolian_ctor_dtor)
{
const Eina_List *impls = NULL;
Eolian_Class *impl_class = NULL;
Eolian_Function impl_func = NULL;
Eolian_Function *impl_func = NULL;
Eolian_Class *class, *base;
eolian_init();
@ -259,7 +259,7 @@ END_TEST
START_TEST(eolian_complex_type)
{
Eolian_Function fid = NULL;
Eolian_Function *fid = NULL;
Eolian_Function_Parameter *param = NULL;
const Eina_List *params_list = NULL;
Eolian_Type *type = NULL;
@ -342,7 +342,7 @@ END_TEST
START_TEST(eolian_scope)
{
Eolian_Function fid = NULL;
Eolian_Function *fid = NULL;
Eolian_Class *class;
eolian_init();
@ -372,7 +372,7 @@ END_TEST
START_TEST(eolian_simple_parsing)
{
Eolian_Function fid = NULL;
Eolian_Function *fid = NULL;
Eolian_Type *ptypep = NULL;
const char *string = NULL, *ptype = NULL, *pname = NULL;
Eolian_Parameter_Dir dir = EOLIAN_IN_PARAM;