forked from enlightenment/efl
eolian: get rid of the data hash in Eolian_Function
This commit is contained in:
parent
60f0450bac
commit
913e0f09fa
|
@ -79,14 +79,14 @@ _class_func_env_create(const Eolian_Class *class, const char *funcname, Eolian_F
|
|||
if (ftype == EOLIAN_PROP_GET)
|
||||
{
|
||||
suffix = "_get";
|
||||
legacy = eolian_function_data_get(funcid, EOLIAN_LEGACY_GET);
|
||||
legacy = eolian_function_legacy_get(funcid, ftype);
|
||||
}
|
||||
if (ftype == EOLIAN_PROP_SET)
|
||||
{
|
||||
suffix = "_set";
|
||||
legacy = eolian_function_data_get(funcid, EOLIAN_LEGACY_SET);
|
||||
legacy = eolian_function_legacy_get(funcid, ftype);
|
||||
}
|
||||
if (!legacy) legacy = eolian_function_data_get(funcid, EOLIAN_LEGACY);
|
||||
if (!legacy) legacy = eolian_function_legacy_get(funcid, EOLIAN_METHOD);
|
||||
|
||||
_eolian_class_vars tmp_env;
|
||||
_class_env_create(class, NULL, &tmp_env);
|
||||
|
|
|
@ -85,8 +85,6 @@ eo_fundef_generate(const Eolian_Class *class, Eolian_Function *func, Eolian_Func
|
|||
const char *str_dir[] = {"in", "out", "inout"};
|
||||
Eina_Iterator *itr;
|
||||
void *data, *data2;
|
||||
char funcname[0xFF];
|
||||
char descname[0xFF];
|
||||
char *tmpstr = malloc(0x1FF);
|
||||
Eina_Bool var_as_ret = EINA_FALSE;
|
||||
const Eolian_Type *rettypet = NULL;
|
||||
|
@ -95,30 +93,20 @@ eo_fundef_generate(const Eolian_Class *class, Eolian_Function *func, Eolian_Func
|
|||
Eolian_Object_Scope scope = eolian_function_scope_get(func);
|
||||
|
||||
_class_func_env_create(class, eolian_function_name_get(func), ftype, &func_env);
|
||||
char *fsuffix = "";
|
||||
rettypet = eolian_function_return_type_get(func, ftype);
|
||||
if (ftype == EOLIAN_PROP_GET)
|
||||
if (ftype == EOLIAN_PROP_GET && !rettypet)
|
||||
{
|
||||
fsuffix = "_get";
|
||||
if (!rettypet)
|
||||
itr = eolian_function_parameters_get(func);
|
||||
/* We want to check if there is only one parameter */
|
||||
if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2))
|
||||
{
|
||||
itr = eolian_function_parameters_get(func);
|
||||
/* We want to check if there is only one parameter */
|
||||
if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2))
|
||||
{
|
||||
rettypet = eolian_parameter_type_get((Eolian_Function_Parameter*)data);
|
||||
var_as_ret = EINA_TRUE;
|
||||
ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE);
|
||||
}
|
||||
eina_iterator_free(itr);
|
||||
rettypet = eolian_parameter_type_get((Eolian_Function_Parameter*)data);
|
||||
var_as_ret = EINA_TRUE;
|
||||
ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE);
|
||||
}
|
||||
eina_iterator_free(itr);
|
||||
}
|
||||
if (ftype == EOLIAN_PROP_SET) fsuffix = "_set";
|
||||
|
||||
sprintf (funcname, "%s%s", eolian_function_name_get(func), fsuffix);
|
||||
sprintf (descname, "comment%s", fsuffix);
|
||||
const char *funcdesc = eolian_function_description_get(func, descname);
|
||||
|
||||
const char *funcdesc = eolian_function_description_get(func, ftype);
|
||||
Eina_Strbuf *str_func = eina_strbuf_new();
|
||||
if (scope == EOLIAN_SCOPE_PROTECTED)
|
||||
eina_strbuf_append_printf(str_func, "#ifdef %s_PROTECTED\n", class_env.upper_classname);
|
||||
|
@ -727,7 +715,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
|
|||
itr = eolian_class_functions_get(class, EOLIAN_CTOR);
|
||||
EINA_ITERATOR_FOREACH(itr, fn)
|
||||
{
|
||||
char *desc = _source_desc_get(eolian_function_description_get(fn, "comment"));
|
||||
char *desc = _source_desc_get(eolian_function_description_get(fn, EOLIAN_METHOD));
|
||||
eo_op_desc_generate(class, fn, EOLIAN_CTOR, desc, tmpbuf);
|
||||
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
|
||||
free(desc);
|
||||
|
@ -749,7 +737,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
|
|||
|
||||
if (prop_write)
|
||||
{
|
||||
char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set"));
|
||||
char *desc = _source_desc_get(eolian_function_description_get(fn, EOLIAN_PROP_SET));
|
||||
|
||||
sprintf(tmpstr, "%s_set", funcname);
|
||||
eo_op_desc_generate(class, fn, EOLIAN_PROP_SET, desc, tmpbuf);
|
||||
|
@ -758,7 +746,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
|
|||
}
|
||||
if (prop_read)
|
||||
{
|
||||
char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get"));
|
||||
char *desc = _source_desc_get(eolian_function_description_get(fn, EOLIAN_PROP_GET));
|
||||
|
||||
sprintf(tmpstr, "%s_get", funcname);
|
||||
eo_op_desc_generate(class, fn, EOLIAN_PROP_GET, desc, tmpbuf);
|
||||
|
@ -772,7 +760,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
|
|||
itr = eolian_class_functions_get(class, EOLIAN_METHOD);
|
||||
EINA_ITERATOR_FOREACH(itr, fn)
|
||||
{
|
||||
char *desc = _source_desc_get(eolian_function_description_get(fn, "comment"));
|
||||
char *desc = _source_desc_get(eolian_function_description_get(fn, EOLIAN_METHOD));
|
||||
eo_op_desc_generate(class, fn, EOLIAN_METHOD, desc, tmpbuf);
|
||||
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
|
||||
free(desc);
|
||||
|
|
|
@ -44,13 +44,11 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
|
|||
{
|
||||
_eolian_class_func_vars func_env;
|
||||
const char *funcname = eolian_function_name_get(funcid);
|
||||
const char *suffix = "";
|
||||
const Eolian_Type *rettypet = NULL;
|
||||
const char *rettype = NULL;
|
||||
Eina_Bool var_as_ret = EINA_FALSE;
|
||||
Eina_Bool add_star = EINA_FALSE;
|
||||
Eina_Bool ret_const = EINA_FALSE;
|
||||
char tmpstr[0xFF];
|
||||
Eina_Iterator *itr;
|
||||
void *data, *data2;
|
||||
Eina_Strbuf *flags = NULL;
|
||||
|
@ -64,7 +62,6 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
|
|||
rettypet = eolian_function_return_type_get(funcid, ftype);
|
||||
if (ftype == EOLIAN_PROP_GET)
|
||||
{
|
||||
suffix = "_get";
|
||||
add_star = EINA_TRUE;
|
||||
if (!rettypet)
|
||||
{
|
||||
|
@ -80,8 +77,6 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
|
|||
}
|
||||
}
|
||||
|
||||
if (ftype == EOLIAN_PROP_SET) suffix = "_set";
|
||||
|
||||
if (func_env.legacy_func[0] == '\0') goto end;
|
||||
eina_strbuf_append_printf(fbody, tmpl_eapi_funcdef, func_env.legacy_func);
|
||||
|
||||
|
@ -91,8 +86,7 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
|
|||
eina_strbuf_append(fparam, "const ");
|
||||
eina_strbuf_append_printf(fparam, "%s *obj", class_env.full_classname);
|
||||
}
|
||||
sprintf (tmpstr, "comment%s", suffix);
|
||||
const char *desc = eolian_function_description_get(funcid, tmpstr);
|
||||
const char *desc = eolian_function_description_get(funcid, ftype);
|
||||
Eina_Strbuf *linedesc = eina_strbuf_new();
|
||||
eina_strbuf_append(linedesc, desc ? desc : "No description supplied.");
|
||||
if (eina_strbuf_length_get(linedesc))
|
||||
|
|
|
@ -38,11 +38,10 @@ _comment_parameters_list(Eina_Iterator *params)
|
|||
}
|
||||
|
||||
static std::string
|
||||
_comment_brief_and_params(Eolian_Function const& function,
|
||||
const char *key = EOLIAN_COMMENT)
|
||||
_comment_brief_and_params(Eolian_Function const& function, Eolian_Function_Type ftype = EOLIAN_METHOD)
|
||||
{
|
||||
std::string doc = "";
|
||||
std::string func = safe_str(::eolian_function_description_get(&function, key));
|
||||
std::string func = safe_str(::eolian_function_description_get(&function, ftype));
|
||||
if (func != "")
|
||||
{
|
||||
doc += "@brief " + func + "\n\n";
|
||||
|
|
|
@ -86,13 +86,6 @@ typedef struct _Eolian_Expression Eolian_Expression;
|
|||
*/
|
||||
typedef struct _Eolian_Variable Eolian_Variable;
|
||||
|
||||
#define EOLIAN_LEGACY "legacy"
|
||||
#define EOLIAN_LEGACY_GET "legacy_get"
|
||||
#define EOLIAN_LEGACY_SET "legacy_set"
|
||||
#define EOLIAN_COMMENT "comment"
|
||||
#define EOLIAN_COMMENT_SET "comment_set"
|
||||
#define EOLIAN_COMMENT_GET "comment_get"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EOLIAN_UNRESOLVED,
|
||||
|
@ -623,20 +616,32 @@ EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *fu
|
|||
EAPI const Eolian_Function *eolian_class_function_get_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
|
||||
|
||||
/*
|
||||
* @brief Returns a specific data for a function.
|
||||
* @brief Returns a legacy name for a function.
|
||||
*
|
||||
* @param[in] function_id Id of the function
|
||||
* @param[in] key key to access the data
|
||||
* @return the data.
|
||||
* @param[in] f_type The function type, for property get/set distinction.
|
||||
* @return the legacy name or NULL.
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Stringshare *eolian_function_data_get(const Eolian_Function *function_id, const char *key);
|
||||
EAPI Eina_Stringshare *eolian_function_legacy_get(const Eolian_Function *function_id, Eolian_Function_Type f_type);
|
||||
|
||||
/*
|
||||
* @brief Returns a description for a function.
|
||||
*
|
||||
* @param[in] function_id Id of the function
|
||||
* @param[in] f_type The function type, for property get/set distinction.
|
||||
* @return the description or NULL.
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Stringshare *eolian_function_description_get(const Eolian_Function *function_id, Eolian_Function_Type f_type);
|
||||
|
||||
/*
|
||||
* @brief Indicates if a function is virtual pure.
|
||||
*
|
||||
* @param[in] function_id Id of the function
|
||||
* @param[in] f_type The function type, for property get/set distinction.
|
||||
* @return EINA_TRUE if virtual pure, EINA_FALSE othrewise..
|
||||
*
|
||||
* @ingroup Eolian
|
||||
|
@ -653,17 +658,6 @@ EAPI Eina_Bool eolian_function_is_virtual_pure(const Eolian_Function *function_i
|
|||
*/
|
||||
EAPI Eina_Bool eolian_function_is_class(const Eolian_Function *function_id);
|
||||
|
||||
/*
|
||||
* @brief Returns a specific description for a function.
|
||||
*
|
||||
* @param[in] function_id Id of the function
|
||||
* @param[in] key key to access the description
|
||||
* @return the description.
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
#define eolian_function_description_get(function_id, key) eolian_function_data_get((function_id), (key))
|
||||
|
||||
/*
|
||||
* @brief Returns a parameter of a function pointed by its id.
|
||||
*
|
||||
|
|
|
@ -15,8 +15,8 @@ _db_fill_ctor(Eolian_Class *cl, Eo_Method_Def *meth)
|
|||
database_function_return_comment_set(foo_id, EOLIAN_METHOD,
|
||||
meth->ret->comment);
|
||||
}
|
||||
|
||||
database_function_data_set(foo_id, EOLIAN_LEGACY, meth->legacy);
|
||||
|
||||
database_function_legacy_set(foo_id, EOLIAN_METHOD, meth->legacy);
|
||||
|
||||
EINA_LIST_FOREACH(meth->params, l, param)
|
||||
{
|
||||
|
@ -156,17 +156,9 @@ _db_fill_accessor(Eolian_Function *foo_id, Eo_Class_Def *kls,
|
|||
}
|
||||
|
||||
if (accessor->legacy)
|
||||
{
|
||||
database_function_data_set(foo_id, ((accessor->type == SETTER)
|
||||
? EOLIAN_LEGACY_SET
|
||||
: EOLIAN_LEGACY_GET),
|
||||
accessor->legacy);
|
||||
}
|
||||
database_function_legacy_set(foo_id, ftype, accessor->legacy);
|
||||
|
||||
database_function_description_set(foo_id, ((accessor->type == SETTER)
|
||||
? EOLIAN_COMMENT_SET
|
||||
: EOLIAN_COMMENT_GET),
|
||||
accessor->comment);
|
||||
database_function_description_set(foo_id, ftype, accessor->comment);
|
||||
|
||||
EINA_LIST_FOREACH(accessor->params, l, acc_param)
|
||||
{
|
||||
|
@ -280,8 +272,8 @@ _db_fill_method(Eolian_Class *cl, Eo_Class_Def *kls, Eo_Method_Def *meth)
|
|||
meth->ret->default_ret_val = NULL;
|
||||
}
|
||||
|
||||
database_function_description_set(foo_id, EOLIAN_COMMENT, meth->comment);
|
||||
database_function_data_set(foo_id, EOLIAN_LEGACY, meth->legacy);
|
||||
database_function_description_set(foo_id, EOLIAN_METHOD, meth->comment);
|
||||
database_function_legacy_set(foo_id, EOLIAN_METHOD, meth->legacy);
|
||||
database_function_object_set_as_const(foo_id, meth->obj_const);
|
||||
database_function_set_as_class(foo_id, meth->is_class);
|
||||
|
||||
|
|
|
@ -9,13 +9,18 @@ database_function_del(Eolian_Function *fid)
|
|||
|
||||
if (fid->base.file) eina_stringshare_del(fid->base.file);
|
||||
eina_stringshare_del(fid->name);
|
||||
eina_hash_free(fid->data);
|
||||
EINA_LIST_FREE(fid->keys, param) database_parameter_del(param);
|
||||
EINA_LIST_FREE(fid->params, param) database_parameter_del(param);
|
||||
database_type_del(fid->get_ret_type);
|
||||
database_type_del(fid->set_ret_type);
|
||||
database_expr_del(fid->get_ret_val);
|
||||
database_expr_del(fid->set_ret_val);
|
||||
if (fid->get_legacy) eina_stringshare_del(fid->get_legacy);
|
||||
if (fid->set_legacy) eina_stringshare_del(fid->set_legacy);
|
||||
if (fid->get_description) eina_stringshare_del(fid->get_description);
|
||||
if (fid->set_description) eina_stringshare_del(fid->set_description);
|
||||
if (fid->get_return_comment) eina_stringshare_del(fid->get_return_comment);
|
||||
if (fid->set_return_comment) eina_stringshare_del(fid->set_return_comment);
|
||||
free(fid);
|
||||
}
|
||||
|
||||
|
@ -25,7 +30,6 @@ database_function_new(const char *function_name, Eolian_Function_Type foo_type)
|
|||
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 fid;
|
||||
}
|
||||
|
||||
|
@ -74,22 +78,6 @@ database_function_set_as_class(Eolian_Function *fid, Eina_Bool is_class)
|
|||
fid->is_class = is_class;
|
||||
}
|
||||
|
||||
void
|
||||
database_function_data_set(Eolian_Function *fid, const char *key, const char *data)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(key);
|
||||
EINA_SAFETY_ON_NULL_RETURN(fid);
|
||||
if (data)
|
||||
{
|
||||
if (!eina_hash_find(fid->data, key))
|
||||
eina_hash_set(fid->data, key, strdup(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
eina_hash_del(fid->data, key, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Eolian_Function_Parameter *
|
||||
database_property_key_add(Eolian_Function *fid, Eolian_Type *type, const char *name, const char *description)
|
||||
{
|
||||
|
@ -140,15 +128,12 @@ void database_function_return_default_val_set(Eolian_Function *fid, Eolian_Funct
|
|||
|
||||
void database_function_return_comment_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *ret_comment)
|
||||
{
|
||||
const char *key = NULL;
|
||||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_PROP_SET: key = EOLIAN_PROP_SET_RETURN_COMMENT; break;
|
||||
case EOLIAN_PROP_GET: key = EOLIAN_PROP_GET_RETURN_COMMENT; break;
|
||||
case EOLIAN_METHOD: key = EOLIAN_METHOD_RETURN_COMMENT; break;
|
||||
case EOLIAN_PROP_SET: fid->set_return_comment = eina_stringshare_ref(ret_comment); break;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: fid->get_return_comment = eina_stringshare_ref(ret_comment); break;
|
||||
default: return;
|
||||
}
|
||||
database_function_data_set(fid, key, ret_comment);
|
||||
}
|
||||
|
||||
void database_function_return_flag_set_as_warn_unused(Eolian_Function *fid,
|
||||
|
@ -169,3 +154,23 @@ database_function_object_set_as_const(Eolian_Function *fid, Eina_Bool is_const)
|
|||
EINA_SAFETY_ON_NULL_RETURN(fid);
|
||||
fid->obj_is_const = is_const;
|
||||
}
|
||||
|
||||
void database_function_legacy_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *legacy)
|
||||
{
|
||||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_PROP_SET: fid->set_legacy = eina_stringshare_ref(legacy); break;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROP_GET: fid->get_legacy = eina_stringshare_ref(legacy); break;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
void database_function_description_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *desc)
|
||||
{
|
||||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_PROP_SET: fid->set_description = eina_stringshare_ref(desc); break;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROP_GET: fid->get_description = eina_stringshare_ref(desc); break;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,13 +56,37 @@ eolian_function_full_c_name_get(const Eolian_Function *foo_id, const char *prefi
|
|||
return ret;
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_function_legacy_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
||||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_legacy; break;
|
||||
case EOLIAN_PROP_SET: return fid->set_legacy; break;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_function_description_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
||||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_description; break;
|
||||
case EOLIAN_PROP_SET: return fid->set_description; break;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
eolian_function_is_virtual_pure(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
|
||||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_virtual_pure; break;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_virtual_pure; break;
|
||||
case EOLIAN_PROP_SET: return fid->set_virtual_pure; break;
|
||||
default: return EINA_FALSE;
|
||||
}
|
||||
|
@ -75,13 +99,6 @@ eolian_function_is_class(const Eolian_Function *fid)
|
|||
return fid->is_class;
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_function_data_get(const Eolian_Function *fid, const char *key)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
||||
return eina_hash_find(fid->data, key);
|
||||
}
|
||||
|
||||
EAPI const Eolian_Function_Parameter *
|
||||
eolian_function_parameter_get_by_name(const Eolian_Function *fid, const char *param_name)
|
||||
{
|
||||
|
@ -121,7 +138,7 @@ eolian_function_return_type_get(const Eolian_Function *fid, Eolian_Function_Type
|
|||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_PROP_SET: return fid->set_ret_type;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_ret_type;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_ret_type;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +149,7 @@ eolian_function_return_default_value_get(const Eolian_Function *fid, Eolian_Func
|
|||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_PROP_SET: return fid->set_ret_val;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_ret_val;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_ret_val;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -140,15 +157,12 @@ eolian_function_return_default_value_get(const Eolian_Function *fid, Eolian_Func
|
|||
EAPI Eina_Stringshare *
|
||||
eolian_function_return_comment_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
||||
{
|
||||
const char *key = NULL;
|
||||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_PROP_SET: key = EOLIAN_PROP_SET_RETURN_COMMENT; break;
|
||||
case EOLIAN_PROP_GET: key = EOLIAN_PROP_GET_RETURN_COMMENT; break;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: key = EOLIAN_METHOD_RETURN_COMMENT; break;
|
||||
case EOLIAN_PROP_SET: return fid->set_return_comment; break;
|
||||
case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_return_comment; break;
|
||||
default: return NULL;
|
||||
}
|
||||
return eolian_function_data_get(fid, key);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
@ -158,7 +172,7 @@ eolian_function_return_is_warn_unused(const Eolian_Function *fid,
|
|||
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
|
||||
switch (ftype)
|
||||
{
|
||||
case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_return_warn_unused;
|
||||
case EOLIAN_METHOD: case EOLIAN_PROP_GET: case EOLIAN_CTOR: case EOLIAN_PROPERTY: return fid->get_return_warn_unused;
|
||||
case EOLIAN_PROP_SET: return fid->set_return_warn_unused;
|
||||
default: return EINA_FALSE;
|
||||
}
|
||||
|
|
|
@ -44,13 +44,13 @@ static Eina_Bool _function_print(const Eolian_Function *fid, int nb_spaces)
|
|||
case EOLIAN_PROPERTY:
|
||||
{
|
||||
printf("%*s<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
|
||||
const char *str = eolian_function_description_get(fid, EOLIAN_COMMENT_GET);
|
||||
const char *str = eolian_function_description_get(fid, EOLIAN_PROP_GET);
|
||||
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
|
||||
str = eolian_function_description_get(fid, EOLIAN_COMMENT_SET);
|
||||
str = eolian_function_description_get(fid, EOLIAN_PROP_SET);
|
||||
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
|
||||
str = eolian_function_data_get(fid, EOLIAN_LEGACY_GET);
|
||||
str = eolian_function_legacy_get(fid, EOLIAN_PROP_GET);
|
||||
if (str) printf("%*slegacy_get: <%s>\n", nb_spaces + 5, "", str);
|
||||
str = eolian_function_data_get(fid, EOLIAN_LEGACY_SET);
|
||||
str = eolian_function_legacy_get(fid, EOLIAN_PROP_SET);
|
||||
if (str) printf("%*slegacy_set: <%s>\n", nb_spaces + 5, "", str);
|
||||
tp = eolian_function_return_type_get(fid, EOLIAN_PROP_GET);
|
||||
if (tp)
|
||||
|
@ -71,9 +71,9 @@ static Eina_Bool _function_print(const Eolian_Function *fid, int nb_spaces)
|
|||
case EOLIAN_PROP_GET:
|
||||
{
|
||||
printf("%*sGET:<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
|
||||
const char *str = eolian_function_description_get(fid, EOLIAN_COMMENT_GET);
|
||||
const char *str = eolian_function_description_get(fid, EOLIAN_PROP_GET);
|
||||
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
|
||||
str = eolian_function_data_get(fid, EOLIAN_LEGACY_GET);
|
||||
str = eolian_function_legacy_get(fid, EOLIAN_PROP_GET);
|
||||
if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
|
||||
tp = eolian_function_return_type_get(fid, EOLIAN_PROP_GET);
|
||||
if (tp)
|
||||
|
@ -87,9 +87,9 @@ static Eina_Bool _function_print(const Eolian_Function *fid, int nb_spaces)
|
|||
case EOLIAN_PROP_SET:
|
||||
{
|
||||
printf("%*sSET:<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
|
||||
const char *str = eolian_function_description_get(fid, EOLIAN_COMMENT_SET);
|
||||
const char *str = eolian_function_description_get(fid, EOLIAN_PROP_SET);
|
||||
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
|
||||
str = eolian_function_data_get(fid, EOLIAN_LEGACY_SET);
|
||||
str = eolian_function_legacy_get(fid, EOLIAN_PROP_SET);
|
||||
if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
|
||||
tp = eolian_function_return_type_get(fid, EOLIAN_PROP_SET);
|
||||
if (tp)
|
||||
|
@ -103,9 +103,9 @@ static Eina_Bool _function_print(const Eolian_Function *fid, int nb_spaces)
|
|||
case EOLIAN_METHOD:
|
||||
{
|
||||
printf("%*s<%s> %s\n", nb_spaces, "", ret_desc ? ret_desc : "", fid->name);
|
||||
const char *str = eolian_function_description_get(fid, EOLIAN_COMMENT);
|
||||
const char *str = eolian_function_description_get(fid, EOLIAN_METHOD);
|
||||
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
|
||||
str = eolian_function_data_get(fid, EOLIAN_LEGACY);
|
||||
str = eolian_function_legacy_get(fid, EOLIAN_METHOD);
|
||||
if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
|
||||
tp = eolian_function_return_type_get(fid, EOLIAN_METHOD);
|
||||
if (tp)
|
||||
|
@ -120,11 +120,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(fid, EOLIAN_COMMENT);
|
||||
const char *str = eolian_function_description_get(fid, EOLIAN_METHOD);
|
||||
if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
|
||||
str = eolian_function_data_get(fid, EOLIAN_LEGACY);
|
||||
str = eolian_function_legacy_get(fid, EOLIAN_METHOD);
|
||||
if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
|
||||
tp = eolian_function_return_type_get(fid, EOLIAN_CTOR);
|
||||
tp = eolian_function_return_type_get(fid, EOLIAN_METHOD);
|
||||
if (tp)
|
||||
{
|
||||
printf("%*sreturn type: <", nb_spaces + 5, "");
|
||||
|
|
|
@ -31,10 +31,6 @@ extern Eina_Prefix *_eolian_prefix;
|
|||
#endif
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__)
|
||||
|
||||
#define EOLIAN_METHOD_RETURN_COMMENT "method_return_comment"
|
||||
#define EOLIAN_PROP_GET_RETURN_COMMENT "property_get_return_comment"
|
||||
#define EOLIAN_PROP_SET_RETURN_COMMENT "property_set_return_comment"
|
||||
|
||||
extern Eina_Hash *_classes;
|
||||
extern Eina_Hash *_aliases;
|
||||
extern Eina_Hash *_structs;
|
||||
|
@ -91,7 +87,12 @@ struct _Eolian_Function
|
|||
Eolian_Type *set_ret_type;
|
||||
Eolian_Expression *get_ret_val;
|
||||
Eolian_Expression *set_ret_val;
|
||||
Eina_Hash *data;
|
||||
Eina_Stringshare *get_legacy;
|
||||
Eina_Stringshare *set_legacy;
|
||||
Eina_Stringshare *get_description;
|
||||
Eina_Stringshare *set_description;
|
||||
Eina_Stringshare *get_return_comment;
|
||||
Eina_Stringshare *set_return_comment;
|
||||
Eina_Bool obj_is_const :1; /* True if the object has to be const. Useful for a few methods. */
|
||||
Eina_Bool get_virtual_pure :1;
|
||||
Eina_Bool set_virtual_pure :1;
|
||||
|
@ -310,9 +311,8 @@ Eolian_Function *database_function_new(const char *function_name, Eolian_Functio
|
|||
void database_function_del(Eolian_Function *fid);
|
||||
|
||||
void database_function_type_set(Eolian_Function *function_id, Eolian_Function_Type foo_type);
|
||||
void database_function_data_set(Eolian_Function *function_id, const char *key, const char *description);
|
||||
#define database_function_description_set(foo_id, key, desc) database_function_data_set((foo_id), (key), (desc))
|
||||
|
||||
void database_function_legacy_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *legacy);
|
||||
void database_function_description_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *desc);
|
||||
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_default_val_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, Eolian_Expression *ret_default_value);
|
||||
|
|
|
@ -465,10 +465,10 @@ START_TEST(eolian_simple_parsing)
|
|||
/* Property */
|
||||
fail_if(!(fid = eolian_class_function_get_by_name(class, "a", EOLIAN_PROPERTY)));
|
||||
fail_if(strcmp(eolian_function_name_get(fid), "a"));
|
||||
string = eolian_function_description_get(fid, EOLIAN_COMMENT_SET);
|
||||
string = eolian_function_description_get(fid, EOLIAN_PROP_SET);
|
||||
fail_if(!string);
|
||||
fail_if(strcmp(string, "comment a.set"));
|
||||
string = eolian_function_description_get(fid, EOLIAN_COMMENT_GET);
|
||||
string = eolian_function_description_get(fid, EOLIAN_PROP_GET);
|
||||
fail_if(string);
|
||||
/* Set return */
|
||||
tp = eolian_function_return_type_get(fid, EOLIAN_PROP_SET);
|
||||
|
@ -498,7 +498,7 @@ START_TEST(eolian_simple_parsing)
|
|||
|
||||
/* Method */
|
||||
fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD)));
|
||||
string = eolian_function_description_get(fid, EOLIAN_COMMENT);
|
||||
string = eolian_function_description_get(fid, EOLIAN_METHOD);
|
||||
fail_if(!string);
|
||||
fail_if(strcmp(string, "comment foo"));
|
||||
/* Function return */
|
||||
|
|
Loading…
Reference in New Issue