From 4844034a1aec58d7a26965e0ae9baf722b85f93a Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Thu, 26 May 2016 14:36:41 +0100 Subject: [PATCH] eolian: add core infra to support builtin strings and void pointers --- src/lib/eolian/database_type.c | 4 +--- src/lib/eolian/eo_lexer.c | 4 +++- src/lib/eolian/eo_lexer.h | 3 ++- src/lib/eolian/eo_parser.c | 8 ++++++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c index 0011e28..63bfd8f 100644 --- a/src/lib/eolian/database_type.c +++ b/src/lib/eolian/database_type.c @@ -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); } diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index c38eb49..878926f 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -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", }; diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 34b8bea..51a7fd3 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -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), \ \ diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index d1c8c97..929febd 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -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); -- 2.7.4