eolian: add core infra to support builtin strings and void pointers
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Thu, 26 May 2016 13:36:41 +0000 (14:36 +0100)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Thu, 26 May 2016 13:36:41 +0000 (14:36 +0100)
src/lib/eolian/database_type.c
src/lib/eolian/eo_lexer.c
src/lib/eolian/eo_lexer.h
src/lib/eolian/eo_parser.c

index 0011e28..63bfd8f 100644 (file)
@@ -114,9 +114,7 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
      eina_strbuf_append(buf, " *");
    if (name)
      {
-        if (tp->type != EOLIAN_TYPE_POINTER &&
-            tp->type != EOLIAN_TYPE_CLASS &&
-            tp->type != EOLIAN_TYPE_COMPLEX)
+        if (eina_strbuf_string_get(buf)[eina_strbuf_length_get(buf) - 1] != '*')
           eina_strbuf_append_char(buf, ' ');
         eina_strbuf_append(buf, name);
      }
index c38eb49..878926f 100644 (file)
@@ -74,7 +74,9 @@ static const char * const ctypes[] =
 
    "Eina_Accessor", "Eina_Array", "Eina_Iterator", "Eina_Hash", "Eina_List",
    "Eina_Promise",
-   "Eina_Value",
+   "Eina_Value", "const char *",
+
+   "void *",
 
    "Eo_Event_Cb",
 };
index 34b8bea..51a7fd3 100644 (file)
@@ -52,8 +52,9 @@ enum Tokens
     \
     KW(accessor), KW(array), KW(iterator), KW(hash), KW(list), \
     KW(promise), \
-    KW(generic_value), \
+    KW(generic_value), KW(string), \
     \
+    KW(void_ptr), \
     KW(__builtin_event_cb), \
     KW(__undefined_type), \
     \
index d1c8c97..929febd 100644 (file)
@@ -694,6 +694,14 @@ _parse_dep(Eo_Lexer *ls, const char *fname, const char *name)
 static Eina_Bool
 _type_is_ownable(Eolian_Type *tp)
 {
+   if (tp->type == EOLIAN_TYPE_REGULAR)
+     {
+        int kwid = eo_lexer_keyword_str_to_id(tp->name);
+        const char *ct = eo_lexer_get_c_type(kwid);
+        if (!ct)
+          return EINA_FALSE;
+        return (ct[strlen(ct) - 1] == '*');
+     }
    return (tp->type == EOLIAN_TYPE_POINTER ||
            tp->type == EOLIAN_TYPE_COMPLEX ||
            tp->type == EOLIAN_TYPE_CLASS);