summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-22 20:38:17 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-22 21:01:12 +0200
commitc146d6f877de68d789631c635290e83cfde20747 (patch)
treee87c390674ae2025640cc8f5e05e44133cee6039
parent9009d3dae40bb702de940a995f2830d5a72a2ab2 (diff)
eolian: add a way to query the builtin type of a type
-rw-r--r--src/lib/eolian/Eolian.h74
-rw-r--r--src/lib/eolian/database_type_api.c7
-rw-r--r--src/lib/eolian/eo_parser.c1
-rw-r--r--src/lib/eolian/eolian_database.h1
4 files changed, 83 insertions, 0 deletions
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 458a7343e6..966d303ee8 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -233,6 +233,67 @@ typedef enum
233 233
234typedef enum 234typedef enum
235{ 235{
236 EOLIAN_TYPE_BUILTIN_INVALID = 0,
237
238 EOLIAN_TYPE_BUILTIN_BYTE,
239 EOLIAN_TYPE_BUILTIN_UBYTE,
240 EOLIAN_TYPE_BUILTIN_CHAR,
241 EOLIAN_TYPE_BUILTIN_SHORT,
242 EOLIAN_TYPE_BUILTIN_USHORT,
243 EOLIAN_TYPE_BUILTIN_INT,
244 EOLIAN_TYPE_BUILTIN_UINT,
245 EOLIAN_TYPE_BUILTIN_LONG,
246 EOLIAN_TYPE_BUILTIN_ULONG,
247 EOLIAN_TYPE_BUILTIN_LLONG,
248 EOLIAN_TYPE_BUILTIN_ULLONG,
249
250 EOLIAN_TYPE_BUILTIN_INT8,
251 EOLIAN_TYPE_BUILTIN_UINT8,
252 EOLIAN_TYPE_BUILTIN_INT16,
253 EOLIAN_TYPE_BUILTIN_UINT16,
254 EOLIAN_TYPE_BUILTIN_INT32,
255 EOLIAN_TYPE_BUILTIN_UINT32,
256 EOLIAN_TYPE_BUILTIN_INT64,
257 EOLIAN_TYPE_BUILTIN_UINT64,
258 EOLIAN_TYPE_BUILTIN_INT128,
259 EOLIAN_TYPE_BUILTIN_UINT128,
260
261 EOLIAN_TYPE_BUILTIN_SIZE,
262 EOLIAN_TYPE_BUILTIN_SSIZE,
263 EOLIAN_TYPE_BUILTIN_INTPTR,
264 EOLIAN_TYPE_BUILTIN_UINTPTR,
265 EOLIAN_TYPE_BUILTIN_PTRDIFF,
266
267 EOLIAN_TYPE_BUILTIN_TIME,
268
269 EOLIAN_TYPE_BUILTIN_FLOAT,
270 EOLIAN_TYPE_BUILTIN_DOUBLE,
271
272 EOLIAN_TYPE_BUILTIN_BOOL,
273
274 EOLIAN_TYPE_BUILTIN_VOID,
275
276 EOLIAN_TYPE_BUILTIN_ACCESSOR,
277 EOLIAN_TYPE_BUILTIN_ARRAY,
278 EOLIAN_TYPE_BUILTIN_ITERATOR,
279 EOLIAN_TYPE_BUILTIN_HASH,
280 EOLIAN_TYPE_BUILTIN_LIST,
281
282 EOLIAN_TYPE_BUILTIN_FUTURE,
283
284 EOLIAN_TYPE_BUILTIN_ANY_VALUE,
285 EOLIAN_TYPE_BUILTIN_ANY_VALUE_PTR,
286
287 EOLIAN_TYPE_BUILTIN_MSTRING,
288 EOLIAN_TYPE_BUILTIN_STRING,
289 EOLIAN_TYPE_BUILTIN_STRINGSHARE,
290
291 EOLIAN_TYPE_BUILTIN_VOID_PTR,
292 EOLIAN_TYPE_BUILTIN_FREE_CB
293} Eolian_Type_Builtin_Type;
294
295typedef enum
296{
236 EOLIAN_C_TYPE_DEFAULT = 0, 297 EOLIAN_C_TYPE_DEFAULT = 0,
237 EOLIAN_C_TYPE_PARAM, 298 EOLIAN_C_TYPE_PARAM,
238 EOLIAN_C_TYPE_RETURN 299 EOLIAN_C_TYPE_RETURN
@@ -1746,6 +1807,19 @@ EAPI const Eolian_Function *eolian_typedecl_function_pointer_get(const Eolian_Ty
1746EAPI Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp); 1807EAPI Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
1747 1808
1748/* 1809/*
1810 * @brief Get the builtin type of a type.
1811 *
1812 * @param[in] tp the type.
1813 * @return an Eolian_Type_Builtin_Type.
1814 *
1815 * If the input type is NULL or it's not a builtin, EOLIAN_TYPE_BUILTIN_INVALID
1816 * is returned.
1817 *
1818 * @ingroup Eolian
1819 */
1820EAPI Eolian_Type_Builtin_Type eolian_type_builtin_type_get(const Eolian_Type *tp);
1821
1822/*
1749 * @brief Get the filename of a type. 1823 * @brief Get the filename of a type.
1750 * 1824 *
1751 * @param[in] tp the type. 1825 * @param[in] tp the type.
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index f1db367ec4..94f8354889 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -103,6 +103,13 @@ eolian_type_type_get(const Eolian_Type *tp)
103 return tp->type; 103 return tp->type;
104} 104}
105 105
106EAPI Eolian_Type_Builtin_Type
107eolian_type_builtin_type_get(const Eolian_Type *tp)
108{
109 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EOLIAN_TYPE_BUILTIN_INVALID);
110 return tp->btype;
111}
112
106EAPI Eolian_Typedecl_Type 113EAPI Eolian_Typedecl_Type
107eolian_typedecl_type_get(const Eolian_Typedecl *tp) 114eolian_typedecl_type_get(const Eolian_Typedecl *tp)
108{ 115{
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index a1e27134bf..e21a034084 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -757,6 +757,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref)
757 check(ls, TOK_VALUE); 757 check(ls, TOK_VALUE);
758 if (eo_lexer_is_type_keyword(ls->t.kw)) 758 if (eo_lexer_is_type_keyword(ls->t.kw))
759 { 759 {
760 def->btype = ls->t.kw - KW_byte + 1;
760 _fill_name(eina_stringshare_ref(ls->t.value.s), &def->full_name, 761 _fill_name(eina_stringshare_ref(ls->t.value.s), &def->full_name,
761 &def->name, &def->namespaces); 762 &def->name, &def->namespaces);
762 eo_lexer_get(ls); 763 eo_lexer_get(ls);
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 9858db4c31..1970034bd5 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -156,6 +156,7 @@ struct _Eolian_Type
156{ 156{
157 Eolian_Object base; 157 Eolian_Object base;
158 Eolian_Type_Type type; 158 Eolian_Type_Type type;
159 Eolian_Type_Builtin_Type btype;
159 Eolian_Type *base_type; 160 Eolian_Type *base_type;
160 Eolian_Type *next_type; 161 Eolian_Type *next_type;
161 Eina_Stringshare *name; 162 Eina_Stringshare *name;