From 8c448105250015dc9279ea7e862cb641712054fd Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 1 Jul 2014 18:02:54 +0100 Subject: [PATCH] eolian: keep the struct keyword in the regular type name --- src/lib/eolian/eo_definitions.h | 1 - src/lib/eolian/eo_parser.c | 18 +++++++++++++----- src/lib/eolian/eolian_database.c | 5 ----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/lib/eolian/eo_definitions.h b/src/lib/eolian/eo_definitions.h index 79415df..d5d3a68 100644 --- a/src/lib/eolian/eo_definitions.h +++ b/src/lib/eolian/eo_definitions.h @@ -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 diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 2e4c9b0..56be673 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -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) diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index 766214a..1c53e53 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -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) -- 2.7.4