eolian: keep the struct keyword in the regular type name
authorDaniel Kolesa <d.kolesa@samsung.com>
Tue, 1 Jul 2014 17:02:54 +0000 (18:02 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Tue, 1 Jul 2014 17:03:20 +0000 (18:03 +0100)
src/lib/eolian/eo_definitions.h
src/lib/eolian/eo_parser.c
src/lib/eolian/eolian_database.c

index 79415df..d5d3a68 100644 (file)
@@ -23,7 +23,6 @@ struct _eo_type_def
    };
    Eina_Bool is_const  :1;
    Eina_Bool is_own    :1;
-   Eina_Bool is_struct :1;
 };
 
 typedef struct _eo_ret_def
index 2e4c9b0..56be673 100644 (file)
@@ -233,11 +233,21 @@ parse_type_void(Eo_Lexer *ls)
    else
      {
         def->type = EOLIAN_TYPE_REGULAR;
-        def->is_struct = has_struct;
-        def->is_const  = EINA_FALSE;
+        def->is_const = EINA_FALSE;
         check(ls, TOK_VALUE);
         ctype = eo_lexer_get_c_type(ls->t.kw);
-        def->name = eina_stringshare_add(ctype ? ctype : ls->t.value);
+        if (ctype && has_struct)
+          eo_lexer_syntax_error(ls, "struct type expected");
+        if (has_struct)
+          {
+             Eina_Strbuf *buf = eina_strbuf_new();
+             eina_strbuf_append(buf, "struct ");
+             eina_strbuf_append(buf, ls->t.value);
+             def->name = eina_stringshare_add(eina_strbuf_string_get(buf));
+             eina_strbuf_free(buf);
+          }
+        else
+          def->name = eina_stringshare_add(ctype ? ctype : ls->t.value);
      }
    eo_lexer_get(ls);
 parse_ptr:
@@ -972,8 +982,6 @@ _print_type(FILE *f, Eo_Type_Def *tp)
       fputs("@own(", f);
    if (tp->is_const)
       fputs("const(", f);
-   if (tp->is_struct)
-      fputs("struct ", f);
    if (tp->type == EOLIAN_TYPE_REGULAR)
       fputs(tp->name, f);
    else if (tp->type == EOLIAN_TYPE_POINTER)
index 766214a..1c53e53 100644 (file)
@@ -92,7 +92,6 @@ typedef struct
    };
    Eina_Bool is_const  :1;
    Eina_Bool is_own    :1;
-   Eina_Bool is_struct :1;
 } _Parameter_Type;
 
 typedef struct
@@ -1231,8 +1230,6 @@ _type_to_str(Eolian_Type tp, Eina_Strbuf *buf, const char *name)
    if ((tpp->type == EOLIAN_TYPE_REGULAR || tpp->type == EOLIAN_TYPE_VOID)
      && tpp->is_const)
       eina_strbuf_append(buf, "const ");
-   if (tpp->is_struct)
-      eina_strbuf_append(buf, "struct ");
    if (tpp->type == EOLIAN_TYPE_REGULAR)
       eina_strbuf_append(buf, tpp->name);
    else if (tpp->type == EOLIAN_TYPE_VOID)
@@ -1324,8 +1321,6 @@ _type_print(Eolian_Type tp, Eina_Strbuf *buf)
       eina_strbuf_append(buf, "@own(");
    if (tpp->is_const)
       eina_strbuf_append(buf, "const(");
-   if (tpp->is_struct)
-      eina_strbuf_append(buf, "struct ");
    if (tpp->type == EOLIAN_TYPE_REGULAR)
       eina_strbuf_append(buf, tpp->name);
    else if (tpp->type == EOLIAN_TYPE_POINTER)