summaryrefslogtreecommitdiff
path: root/src/lib/eolian
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 /src/lib/eolian
parentfbcad90fece71a55391056fdc41d59edd32a1dfd (diff)
eolian: add API to expose the new @move and @by_ref tags
Diffstat (limited to 'src/lib/eolian')
-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
1884EAPI Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc); 1884EAPI Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc);
1885 1885
1886/* 1886/*
1887 * @brief Get whether a parameter is by reference.
1888 *
1889 * @param[in] param_desc parameter handle
1890 * @return EINA_TRUE and EINA_FALSE respectively
1891 *
1892 * @ingroup Eolian
1893 */
1894EAPI Eina_Bool eolian_parameter_is_by_ref(const Eolian_Function_Parameter *param_desc);
1895
1896/*
1897 * @brief Get whether a parameter is moved into the callee.
1898 *
1899 * @param[in] param_desc parameter handle
1900 * @return EINA_TRUE and EINA_FALSE respectively
1901 *
1902 * @ingroup Eolian
1903 */
1904EAPI Eina_Bool eolian_parameter_is_move(const Eolian_Function_Parameter *param_desc);
1905
1906/*
1887 * @brief Get the return type of a function. 1907 * @brief Get the return type of a function.
1888 * 1908 *
1889 * @param[in] function_id id of the function 1909 * @param[in] function_id id of the function
@@ -1950,6 +1970,38 @@ EAPI const Eolian_Documentation *eolian_function_return_documentation_get(const
1950EAPI Eina_Bool eolian_function_return_allow_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype); 1970EAPI Eina_Bool eolian_function_return_allow_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1951 1971
1952/* 1972/*
1973 * @brief Get whether a parameter is by reference.
1974 *
1975 * @param[in] function_id id of the function
1976 * @param[in] ftype type of the function
1977 * @return EINA_TRUE and EINA_FALSE respectively
1978 *
1979 * The type of the function is needed because a given function can represent a
1980 * property, that can be set and get functions.
1981 *
1982 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
1983 *
1984 * @ingroup Eolian
1985 */
1986EAPI Eina_Bool eolian_function_return_is_by_ref(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1987
1988/*
1989 * @brief Get whether a parameter is moved into the callee.
1990 *
1991 * @param[in] function_id id of the function
1992 * @param[in] ftype type of the function
1993 * @return EINA_TRUE and EINA_FALSE respectively
1994 *
1995 * The type of the function is needed because a given function can represent a
1996 * property, that can be set and get functions.
1997 *
1998 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
1999 *
2000 * @ingroup Eolian
2001 */
2002EAPI Eina_Bool eolian_function_return_is_move(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
2003
2004/*
1953 * @brief Indicates if a function object is const. 2005 * @brief Indicates if a function object is const.
1954 * 2006 *
1955 * @param[in] function_id id of the function 2007 * @param[in] function_id id of the function
@@ -2503,6 +2555,26 @@ EAPI const Eolian_Documentation *eolian_typedecl_struct_field_documentation_get(
2503EAPI const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl); 2555EAPI const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
2504 2556
2505/* 2557/*
2558 * @brief Get whether a struct field is by reference.
2559 *
2560 * @param[in] fl the field.
2561 * @return EINA_TRUE and EINA_FALSE respectively
2562 *
2563 * @ingroup Eolian
2564 */
2565EAPI Eina_Bool eolian_typedecl_struct_field_is_by_ref(const Eolian_Struct_Type_Field *fl);
2566
2567/*
2568 * @brief Get whether a struct field is moved with the struct.
2569 *
2570 * @param[in] fl the field.
2571 * @return EINA_TRUE and EINA_FALSE respectively
2572 *
2573 * @ingroup Eolian
2574 */
2575EAPI Eina_Bool eolian_typedecl_struct_field_is_move(const Eolian_Struct_Type_Field *fl);
2576
2577/*
2506 * @brief Get an iterator to all fields of an enum type. 2578 * @brief Get an iterator to all fields of an enum type.
2507 * 2579 *
2508 * @param[in] tp the type declaration. 2580 * @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,
287} 287}
288 288
289EAPI Eina_Bool 289EAPI Eina_Bool
290eolian_function_return_is_by_ref(const Eolian_Function *fid,
291 Eolian_Function_Type ftype)
292{
293 EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
294 EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EINA_FALSE);
295 EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EINA_FALSE);
296 switch (ftype)
297 {
298 case EOLIAN_METHOD:
299 if (fid->type != EOLIAN_METHOD)
300 return EINA_FALSE;
301 return fid->get_return_by_ref;
302 case EOLIAN_PROP_GET:
303 if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
304 return EINA_FALSE;
305 return !fid->get_return_by_ref;
306 case EOLIAN_PROP_SET:
307 if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
308 return EINA_FALSE;
309 return !fid->set_return_by_ref;
310 default:
311 return EINA_FALSE;
312 }
313}
314
315EAPI Eina_Bool
316eolian_function_return_is_move(const Eolian_Function *fid,
317 Eolian_Function_Type ftype)
318{
319 EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
320 EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EINA_FALSE);
321 EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EINA_FALSE);
322 switch (ftype)
323 {
324 case EOLIAN_METHOD:
325 if (fid->type != EOLIAN_METHOD)
326 return EINA_FALSE;
327 return fid->get_return_move;
328 case EOLIAN_PROP_GET:
329 if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
330 return EINA_FALSE;
331 return !fid->get_return_move;
332 case EOLIAN_PROP_SET:
333 if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
334 return EINA_FALSE;
335 return !fid->set_return_move;
336 default:
337 return EINA_FALSE;
338 }
339}
340
341EAPI Eina_Bool
290eolian_function_object_is_const(const Eolian_Function *fid) 342eolian_function_object_is_const(const Eolian_Function *fid)
291{ 343{
292 EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE); 344 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)
39 EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE); 39 EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
40 return param->optional; 40 return param->optional;
41} 41}
42
43EAPI Eina_Bool
44eolian_parameter_is_move(const Eolian_Function_Parameter *param)
45{
46 EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
47 return param->move;
48}
49
50EAPI Eina_Bool
51eolian_parameter_is_by_ref(const Eolian_Function_Parameter *param)
52{
53 EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
54 return param->by_ref;
55}
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)
63 return fl->type; 63 return fl->type;
64} 64}
65 65
66EAPI Eina_Bool
67eolian_typedecl_struct_field_is_by_ref(const Eolian_Struct_Type_Field *fl)
68{
69 EINA_SAFETY_ON_NULL_RETURN_VAL(fl, EINA_FALSE);
70 return fl->by_ref;
71}
72
73EAPI Eina_Bool
74eolian_typedecl_struct_field_is_move(const Eolian_Struct_Type_Field *fl)
75{
76 EINA_SAFETY_ON_NULL_RETURN_VAL(fl, EINA_FALSE);
77 return fl->move;
78}
79
66EAPI Eina_Iterator * 80EAPI Eina_Iterator *
67eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp) 81eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp)
68{ 82{