From d4c835545b59259a0a4fd0c9ed86b46b616b264e Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Fri, 26 May 2017 15:04:49 +0200 Subject: [PATCH] eolian: pass unit in internal type serialization --- src/lib/eolian/database_type.c | 11 ++++++----- src/lib/eolian/database_type_api.c | 3 ++- src/lib/eolian/eolian_database.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c index 761f723..0b22023 100644 --- a/src/lib/eolian/database_type.c +++ b/src/lib/eolian/database_type.c @@ -147,7 +147,8 @@ _stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) } static void -_etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) +_etype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, + Eina_Strbuf *buf) { Eolian_Enum_Type_Field *ef; Eina_List *l; @@ -165,8 +166,7 @@ _etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) eina_strbuf_append(buf, ef->name); if (ef->value) { - /* FIXME: pass unit properly */ - Eolian_Value val = eolian_expression_eval(NULL, ef->value, + Eolian_Value val = eolian_expression_eval(src, ef->value, EOLIAN_MASK_INT); const char *ret; eina_strbuf_append(buf, " = "); @@ -217,7 +217,8 @@ _atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) } void -database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) +database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, + Eina_Strbuf *buf) { switch (tp->type) { @@ -225,7 +226,7 @@ database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) _atype_to_str(tp, buf); break; case EOLIAN_TYPEDECL_ENUM: - _etype_to_str(tp, buf); + _etype_to_str(src, tp, buf); break; case EOLIAN_TYPEDECL_STRUCT: case EOLIAN_TYPEDECL_STRUCT_OPAQUE: diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c index 2c8fd9a..d1dcc4f 100644 --- a/src/lib/eolian/database_type_api.c +++ b/src/lib/eolian/database_type_api.c @@ -374,7 +374,8 @@ eolian_typedecl_c_type_get(const Eolian_Typedecl *tp) Eina_Strbuf *buf; EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); buf = eina_strbuf_new(); - database_typedecl_to_str(tp, buf); + /* FIXME: pass unit properly */ + database_typedecl_to_str(NULL, tp, buf); ret = eina_stringshare_add(eina_strbuf_string_get(buf)); eina_strbuf_free(buf); return ret; diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index 263e207..85ac333 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -312,7 +312,7 @@ void database_type_del(Eolian_Type *tp); void database_typedecl_del(Eolian_Typedecl *tp); void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name); -void database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf); +void database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, Eina_Strbuf *buf); /* expressions */ -- 2.7.4