eolian: add core infra to support builtin strings and void pointers

This commit is contained in:
Daniel Kolesa 2016-05-26 14:36:41 +01:00
parent 2781680b51
commit 4844034a1a
4 changed files with 14 additions and 5 deletions

View 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);
}

View 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",
};

View 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), \
\

View 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);