summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-08-30 17:04:44 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-08-30 17:09:31 +0200
commit7dc7cbf076e3c9f7046c682705162e36b01ebaa4 (patch)
treee20fcf428773f030bf80f8998824a3957304493a
parentfbcad90fece71a55391056fdc41d59edd32a1dfd (diff)
downloadefl-7dc7cbf076e3c9f7046c682705162e36b01ebaa4.tar.gz
eolian: add API to expose the new @move and @by_ref tags
-rw-r--r--src/lib/eolian/Eolian.h72
-rw-r--r--src/lib/eolian/database_function_api.c52
-rw-r--r--src/lib/eolian/database_function_parameter_api.c14
-rw-r--r--src/lib/eolian/database_type_api.c14
4 files changed, 152 insertions, 0 deletions
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 970cc4c728..f92830e64f 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -1884,6 +1884,26 @@ EAPI const Eolian_Documentation *eolian_parameter_documentation_get(const Eolian
EAPI Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc);
/*
+ * @brief Get whether a parameter is by reference.
+ *
+ * @param[in] param_desc parameter handle
+ * @return EINA_TRUE and EINA_FALSE respectively
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_parameter_is_by_ref(const Eolian_Function_Parameter *param_desc);
+
+/*
+ * @brief Get whether a parameter is moved into the callee.
+ *
+ * @param[in] param_desc parameter handle
+ * @return EINA_TRUE and EINA_FALSE respectively
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_parameter_is_move(const Eolian_Function_Parameter *param_desc);
+
+/*
* @brief Get the return type of a function.
*
* @param[in] function_id id of the function
@@ -1950,6 +1970,38 @@ EAPI const Eolian_Documentation *eolian_function_return_documentation_get(const
EAPI Eina_Bool eolian_function_return_allow_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
/*
+ * @brief Get whether a parameter is by reference.
+ *
+ * @param[in] function_id id of the function
+ * @param[in] ftype type of the function
+ * @return EINA_TRUE and EINA_FALSE respectively
+ *
+ * The type of the function is needed because a given function can represent a
+ * property, that can be set and get functions.
+ *
+ * Acceptable input types are METHOD, PROP_GET and PROP_SET.
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_function_return_is_by_ref(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
+
+/*
+ * @brief Get whether a parameter is moved into the callee.
+ *
+ * @param[in] function_id id of the function
+ * @param[in] ftype type of the function
+ * @return EINA_TRUE and EINA_FALSE respectively
+ *
+ * The type of the function is needed because a given function can represent a
+ * property, that can be set and get functions.
+ *
+ * Acceptable input types are METHOD, PROP_GET and PROP_SET.
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_function_return_is_move(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
+
+/*
* @brief Indicates if a function object is const.
*
* @param[in] function_id id of the function
@@ -2503,6 +2555,26 @@ EAPI const Eolian_Documentation *eolian_typedecl_struct_field_documentation_get(
EAPI const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
/*
+ * @brief Get whether a struct field is by reference.
+ *
+ * @param[in] fl the field.
+ * @return EINA_TRUE and EINA_FALSE respectively
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_typedecl_struct_field_is_by_ref(const Eolian_Struct_Type_Field *fl);
+
+/*
+ * @brief Get whether a struct field is moved with the struct.
+ *
+ * @param[in] fl the field.
+ * @return EINA_TRUE and EINA_FALSE respectively
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_typedecl_struct_field_is_move(const Eolian_Struct_Type_Field *fl);
+
+/*
* @brief Get an iterator to all fields of an enum type.
*
* @param[in] tp the type declaration.
diff --git a/src/lib/eolian/database_function_api.c b/src/lib/eolian/database_function_api.c
index 104ac6e829..dfe66a9490 100644
--- a/src/lib/eolian/database_function_api.c
+++ b/src/lib/eolian/database_function_api.c
@@ -287,6 +287,58 @@ eolian_function_return_allow_unused(const Eolian_Function *fid,
}
EAPI Eina_Bool
+eolian_function_return_is_by_ref(const Eolian_Function *fid,
+ Eolian_Function_Type ftype)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EINA_FALSE);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EINA_FALSE);
+ switch (ftype)
+ {
+ case EOLIAN_METHOD:
+ if (fid->type != EOLIAN_METHOD)
+ return EINA_FALSE;
+ return fid->get_return_by_ref;
+ case EOLIAN_PROP_GET:
+ if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
+ return EINA_FALSE;
+ return !fid->get_return_by_ref;
+ case EOLIAN_PROP_SET:
+ if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
+ return EINA_FALSE;
+ return !fid->set_return_by_ref;
+ default:
+ return EINA_FALSE;
+ }
+}
+
+EAPI Eina_Bool
+eolian_function_return_is_move(const Eolian_Function *fid,
+ Eolian_Function_Type ftype)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EINA_FALSE);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EINA_FALSE);
+ switch (ftype)
+ {
+ case EOLIAN_METHOD:
+ if (fid->type != EOLIAN_METHOD)
+ return EINA_FALSE;
+ return fid->get_return_move;
+ case EOLIAN_PROP_GET:
+ if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
+ return EINA_FALSE;
+ return !fid->get_return_move;
+ case EOLIAN_PROP_SET:
+ if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
+ return EINA_FALSE;
+ return !fid->set_return_move;
+ default:
+ return EINA_FALSE;
+ }
+}
+
+EAPI Eina_Bool
eolian_function_object_is_const(const Eolian_Function *fid)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
diff --git a/src/lib/eolian/database_function_parameter_api.c b/src/lib/eolian/database_function_parameter_api.c
index 6b1f6a7201..60673a55ff 100644
--- a/src/lib/eolian/database_function_parameter_api.c
+++ b/src/lib/eolian/database_function_parameter_api.c
@@ -39,3 +39,17 @@ eolian_parameter_is_optional(const Eolian_Function_Parameter *param)
EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
return param->optional;
}
+
+EAPI Eina_Bool
+eolian_parameter_is_move(const Eolian_Function_Parameter *param)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
+ return param->move;
+}
+
+EAPI Eina_Bool
+eolian_parameter_is_by_ref(const Eolian_Function_Parameter *param)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
+ return param->by_ref;
+}
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index 527afc5171..39ba042a2b 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -63,6 +63,20 @@ eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl)
return fl->type;
}
+EAPI Eina_Bool
+eolian_typedecl_struct_field_is_by_ref(const Eolian_Struct_Type_Field *fl)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(fl, EINA_FALSE);
+ return fl->by_ref;
+}
+
+EAPI Eina_Bool
+eolian_typedecl_struct_field_is_move(const Eolian_Struct_Type_Field *fl)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(fl, EINA_FALSE);
+ return fl->move;
+}
+
EAPI Eina_Iterator *
eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp)
{