eolian: pass unit in internal type serialization
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Fri, 26 May 2017 13:04:49 +0000 (15:04 +0200)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Tue, 30 May 2017 15:15:54 +0000 (17:15 +0200)
src/lib/eolian/database_type.c
src/lib/eolian/database_type_api.c
src/lib/eolian/eolian_database.h

index 761f723..0b22023 100644 (file)
@@ -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:
index 2c8fd9a..d1dcc4f 100644 (file)
@@ -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;
index 263e207..85ac333 100644 (file)
@@ -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 */