forked from enlightenment/efl
eolian: new type system API
The Eolian type system API has been overhauled to properly separate declarations (i.e. struct/enum/alias declarations) and usage. This should simplify writing generators (as it makes it clear what is what) as well as make it easier to maintain. @feature
This commit is contained in:
commit
0c545b88ba
|
@ -42,10 +42,10 @@ _generate_ref(const char *refn, Eina_Strbuf *wbuf, Eina_Bool use_legacy)
|
||||||
|
|
||||||
Eina_Stringshare *bname = eina_stringshare_add_length(refn, sfx - refn);
|
Eina_Stringshare *bname = eina_stringshare_add_length(refn, sfx - refn);
|
||||||
|
|
||||||
const Eolian_Type *tp = eolian_type_struct_get_by_name(bname);
|
const Eolian_Typedecl *tp = eolian_typedecl_struct_get_by_name(bname);
|
||||||
if (tp)
|
if (tp)
|
||||||
{
|
{
|
||||||
if (!eolian_type_struct_field_get(tp, sfx + 1))
|
if (!eolian_typedecl_struct_field_get(tp, sfx + 1))
|
||||||
{
|
{
|
||||||
eina_stringshare_del(bname);
|
eina_stringshare_del(bname);
|
||||||
goto noref;
|
goto noref;
|
||||||
|
@ -56,17 +56,17 @@ _generate_ref(const char *refn, Eina_Strbuf *wbuf, Eina_Bool use_legacy)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tp = eolian_type_enum_get_by_name(bname);
|
tp = eolian_typedecl_enum_get_by_name(bname);
|
||||||
if (tp)
|
if (tp)
|
||||||
{
|
{
|
||||||
const Eolian_Enum_Type_Field *efl = eolian_type_enum_field_get(tp, sfx + 1);
|
const Eolian_Enum_Type_Field *efl = eolian_typedecl_enum_field_get(tp, sfx + 1);
|
||||||
if (!efl)
|
if (!efl)
|
||||||
{
|
{
|
||||||
eina_stringshare_del(bname);
|
eina_stringshare_del(bname);
|
||||||
goto noref;
|
goto noref;
|
||||||
}
|
}
|
||||||
_generate_ref(bname, wbuf, use_legacy);
|
_generate_ref(bname, wbuf, use_legacy);
|
||||||
Eina_Stringshare *str = eolian_type_enum_field_c_name_get(efl);
|
Eina_Stringshare *str = eolian_typedecl_enum_field_c_name_get(efl);
|
||||||
eina_strbuf_append_char(wbuf, '.');
|
eina_strbuf_append_char(wbuf, '.');
|
||||||
eina_strbuf_append(wbuf, str);
|
eina_strbuf_append(wbuf, str);
|
||||||
eina_stringshare_del(str);
|
eina_stringshare_del(str);
|
||||||
|
|
|
@ -12,16 +12,16 @@
|
||||||
#include "common_funcs.h"
|
#include "common_funcs.h"
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_concat_name(const Eolian_Type *tp)
|
_concat_name(const Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
Eina_Strbuf *buf = eina_strbuf_new();
|
Eina_Strbuf *buf = eina_strbuf_new();
|
||||||
Eina_Iterator *itr = eolian_type_namespaces_get(tp);
|
Eina_Iterator *itr = eolian_typedecl_namespaces_get(tp);
|
||||||
EINA_ITERATOR_FOREACH(itr, name)
|
EINA_ITERATOR_FOREACH(itr, name)
|
||||||
if (name) eina_strbuf_append_printf(buf, "%s_", name);
|
if (name) eina_strbuf_append_printf(buf, "%s_", name);
|
||||||
eina_iterator_free(itr);
|
eina_iterator_free(itr);
|
||||||
name = eolian_type_name_get(tp);
|
name = eolian_typedecl_name_get(tp);
|
||||||
if (name) eina_strbuf_append_printf(buf, "%s", name);
|
if (name) eina_strbuf_append_printf(buf, "%s", name);
|
||||||
if (eina_strbuf_length_get(buf))
|
if (eina_strbuf_length_get(buf))
|
||||||
{
|
{
|
||||||
|
@ -34,51 +34,51 @@ _concat_name(const Eolian_Type *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Strbuf *
|
static Eina_Strbuf *
|
||||||
_type_generate(const Eolian_Type *tp, Eina_Bool full, Eina_Bool use_legacy)
|
_type_generate(const Eolian_Typedecl *tp, Eina_Bool full, Eina_Bool use_legacy)
|
||||||
{
|
{
|
||||||
char *grp = strdup(eolian_type_full_name_get(tp));
|
char *grp = strdup(eolian_typedecl_full_name_get(tp));
|
||||||
char *p = strrchr(grp, '.');
|
char *p = strrchr(grp, '.');
|
||||||
if (p) *p = '\0';
|
if (p) *p = '\0';
|
||||||
Eina_Strbuf *buf = docs_generate_full(eolian_type_documentation_get(tp),
|
Eina_Strbuf *buf = docs_generate_full(eolian_typedecl_documentation_get(tp),
|
||||||
grp, 0, use_legacy);
|
grp, 0, use_legacy);
|
||||||
free(grp);
|
free(grp);
|
||||||
if (!buf) buf = eina_strbuf_new();
|
if (!buf) buf = eina_strbuf_new();
|
||||||
else eina_strbuf_append_char(buf, '\n');
|
else eina_strbuf_append_char(buf, '\n');
|
||||||
Eolian_Type_Type tp_type = eolian_type_type_get(tp);
|
Eolian_Typedecl_Type tp_type = eolian_typedecl_type_get(tp);
|
||||||
switch(tp_type)
|
switch(tp_type)
|
||||||
{
|
{
|
||||||
case EOLIAN_TYPE_ALIAS:
|
case EOLIAN_TYPEDECL_ALIAS:
|
||||||
{
|
{
|
||||||
char *name = _concat_name(tp);
|
char *name = _concat_name(tp);
|
||||||
Eina_Stringshare *c_type = eolian_type_c_type_named_get(
|
Eina_Stringshare *c_type = eolian_type_c_type_named_get(
|
||||||
eolian_type_base_type_get(tp), name);
|
eolian_typedecl_base_type_get(tp), name);
|
||||||
eina_strbuf_append_printf(buf, "typedef %s", c_type);
|
eina_strbuf_append_printf(buf, "typedef %s", c_type);
|
||||||
eina_stringshare_del(c_type);
|
eina_stringshare_del(c_type);
|
||||||
free(name);
|
free(name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EOLIAN_TYPE_STRUCT:
|
case EOLIAN_TYPEDECL_STRUCT:
|
||||||
case EOLIAN_TYPE_STRUCT_OPAQUE:
|
case EOLIAN_TYPEDECL_STRUCT_OPAQUE:
|
||||||
{
|
{
|
||||||
const Eolian_Struct_Type_Field *member;
|
const Eolian_Struct_Type_Field *member;
|
||||||
char *name = _concat_name(tp);
|
char *name = _concat_name(tp);
|
||||||
if (tp_type == EOLIAN_TYPE_STRUCT_OPAQUE || !full)
|
if (tp_type == EOLIAN_TYPEDECL_STRUCT_OPAQUE || !full)
|
||||||
{
|
{
|
||||||
eina_strbuf_append_printf(buf, "typedef struct _%s %s", name, name);
|
eina_strbuf_append_printf(buf, "typedef struct _%s %s", name, name);
|
||||||
free(name);
|
free(name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
eina_strbuf_append_printf(buf, "typedef struct _%s\n{\n", name);
|
eina_strbuf_append_printf(buf, "typedef struct _%s\n{\n", name);
|
||||||
Eina_Iterator *members = eolian_type_struct_fields_get(tp);
|
Eina_Iterator *members = eolian_typedecl_struct_fields_get(tp);
|
||||||
EINA_ITERATOR_FOREACH(members, member)
|
EINA_ITERATOR_FOREACH(members, member)
|
||||||
{
|
{
|
||||||
const Eolian_Type *type = eolian_type_struct_field_type_get(member);
|
const Eolian_Type *type = eolian_typedecl_struct_field_type_get(member);
|
||||||
Eina_Stringshare *c_type = eolian_type_c_type_get(type);
|
Eina_Stringshare *c_type = eolian_type_c_type_get(type);
|
||||||
eina_strbuf_append_printf(buf, " %s%s%s;",
|
eina_strbuf_append_printf(buf, " %s%s%s;",
|
||||||
c_type, strchr(c_type, '*')?"":" ",
|
c_type, strchr(c_type, '*')?"":" ",
|
||||||
eolian_type_struct_field_name_get(member));
|
eolian_typedecl_struct_field_name_get(member));
|
||||||
const Eolian_Documentation *fdoc
|
const Eolian_Documentation *fdoc
|
||||||
= eolian_type_struct_field_documentation_get(member);
|
= eolian_typedecl_struct_field_documentation_get(member);
|
||||||
if (fdoc)
|
if (fdoc)
|
||||||
{
|
{
|
||||||
const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
|
const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
|
||||||
|
@ -98,7 +98,7 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full, Eina_Bool use_legacy)
|
||||||
free(name);
|
free(name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EOLIAN_TYPE_ENUM:
|
case EOLIAN_TYPEDECL_ENUM:
|
||||||
{
|
{
|
||||||
const Eolian_Enum_Type_Field *member;
|
const Eolian_Enum_Type_Field *member;
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -107,18 +107,18 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full, Eina_Bool use_legacy)
|
||||||
name = _concat_name(tp);
|
name = _concat_name(tp);
|
||||||
char *pre = NULL;
|
char *pre = NULL;
|
||||||
eina_strbuf_append_printf(buf, "typedef enum\n{\n");
|
eina_strbuf_append_printf(buf, "typedef enum\n{\n");
|
||||||
if (eolian_type_enum_legacy_prefix_get(tp))
|
if (eolian_typedecl_enum_legacy_prefix_get(tp))
|
||||||
pre = strdup(eolian_type_enum_legacy_prefix_get(tp));
|
pre = strdup(eolian_typedecl_enum_legacy_prefix_get(tp));
|
||||||
else
|
else
|
||||||
pre = strdup(name);
|
pre = strdup(name);
|
||||||
eina_str_toupper(&pre);
|
eina_str_toupper(&pre);
|
||||||
Eina_Iterator *members = eolian_type_enum_fields_get(tp);
|
Eina_Iterator *members = eolian_typedecl_enum_fields_get(tp);
|
||||||
Eina_Bool next = eina_iterator_next(members, (void**)&member);
|
Eina_Bool next = eina_iterator_next(members, (void**)&member);
|
||||||
Eina_Strbuf *membuf = eina_strbuf_new();
|
Eina_Strbuf *membuf = eina_strbuf_new();
|
||||||
while (next)
|
while (next)
|
||||||
{
|
{
|
||||||
const Eolian_Expression *value = eolian_type_enum_field_value_get(member, EINA_FALSE);
|
const Eolian_Expression *value = eolian_typedecl_enum_field_value_get(member, EINA_FALSE);
|
||||||
char *memb_u = strdup(eolian_type_enum_field_name_get(member));
|
char *memb_u = strdup(eolian_typedecl_enum_field_name_get(member));
|
||||||
eina_str_toupper(&memb_u);
|
eina_str_toupper(&memb_u);
|
||||||
eina_strbuf_reset(membuf);
|
eina_strbuf_reset(membuf);
|
||||||
eina_strbuf_append(membuf, pre);
|
eina_strbuf_append(membuf, pre);
|
||||||
|
@ -141,7 +141,7 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full, Eina_Bool use_legacy)
|
||||||
eina_stringshare_del(lit);
|
eina_stringshare_del(lit);
|
||||||
}
|
}
|
||||||
const Eolian_Documentation *fdoc
|
const Eolian_Documentation *fdoc
|
||||||
= eolian_type_enum_field_documentation_get(member);
|
= eolian_typedecl_enum_field_documentation_get(member);
|
||||||
next = eina_iterator_next(members, (void**)&member);
|
next = eina_iterator_next(members, (void**)&member);
|
||||||
if (next)
|
if (next)
|
||||||
eina_strbuf_append(buf, ",");
|
eina_strbuf_append(buf, ",");
|
||||||
|
@ -191,13 +191,13 @@ types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full,
|
||||||
if (dt == EOLIAN_DECL_ENUM && !full)
|
if (dt == EOLIAN_DECL_ENUM && !full)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const Eolian_Type *tp = eolian_declaration_data_type_get(decl);
|
const Eolian_Typedecl *tp = eolian_declaration_data_type_get(decl);
|
||||||
if (!tp || eolian_type_is_extern(tp))
|
if (!tp || eolian_typedecl_is_extern(tp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (eolian_type_type_get(tp) == EOLIAN_TYPE_ALIAS)
|
if (eolian_typedecl_type_get(tp) == EOLIAN_TYPEDECL_ALIAS)
|
||||||
{
|
{
|
||||||
const Eolian_Type *btp = eolian_type_base_type_get(tp);
|
const Eolian_Type *btp = eolian_typedecl_base_type_get(tp);
|
||||||
if (eolian_type_type_get(btp) == EOLIAN_TYPE_UNDEFINED)
|
if (eolian_type_type_get(btp) == EOLIAN_TYPE_UNDEFINED)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ type_from_eolian(Eolian_Type const& type)
|
||||||
efl::eolian::eolian_type x;
|
efl::eolian::eolian_type x;
|
||||||
|
|
||||||
Eolian_Type_Type tpt = ::eolian_type_type_get(&type);
|
Eolian_Type_Type tpt = ::eolian_type_type_get(&type);
|
||||||
if (tpt == EOLIAN_TYPE_POINTER || tpt == EOLIAN_TYPE_ALIAS || tpt == EOLIAN_TYPE_REGULAR)
|
if (tpt == EOLIAN_TYPE_POINTER || tpt == EOLIAN_TYPE_REGULAR)
|
||||||
{
|
{
|
||||||
Eolian_Type const* base_type = ::eolian_type_base_type_get(&type);
|
Eolian_Type const* base_type = ::eolian_type_base_type_get(&type);
|
||||||
if (base_type && ::eolian_type_type_get(base_type) == EOLIAN_TYPE_CLASS)
|
if (base_type && ::eolian_type_type_get(base_type) == EOLIAN_TYPE_CLASS)
|
||||||
|
|
|
@ -15,6 +15,7 @@ ffi.cdef [[
|
||||||
typedef struct _Eolian_Class Eolian_Class;
|
typedef struct _Eolian_Class Eolian_Class;
|
||||||
typedef struct _Eolian_Function Eolian_Function;
|
typedef struct _Eolian_Function Eolian_Function;
|
||||||
typedef struct _Eolian_Type Eolian_Type;
|
typedef struct _Eolian_Type Eolian_Type;
|
||||||
|
typedef struct _Eolian_Typedecl Eolian_Typedecl;
|
||||||
typedef struct _Eolian_Function_Parameter Eolian_Function_Parameter;
|
typedef struct _Eolian_Function_Parameter Eolian_Function_Parameter;
|
||||||
typedef struct _Eolian_Implement Eolian_Implement;
|
typedef struct _Eolian_Implement Eolian_Implement;
|
||||||
typedef struct _Eolian_Constructor Eolian_Constructor;
|
typedef struct _Eolian_Constructor Eolian_Constructor;
|
||||||
|
@ -29,7 +30,7 @@ ffi.cdef [[
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_UNRESOLVED,
|
EOLIAN_UNRESOLVED = 0,
|
||||||
EOLIAN_PROPERTY,
|
EOLIAN_PROPERTY,
|
||||||
EOLIAN_PROP_SET,
|
EOLIAN_PROP_SET,
|
||||||
EOLIAN_PROP_GET,
|
EOLIAN_PROP_GET,
|
||||||
|
@ -38,14 +39,14 @@ ffi.cdef [[
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_IN_PARAM,
|
EOLIAN_IN_PARAM = 0,
|
||||||
EOLIAN_OUT_PARAM,
|
EOLIAN_OUT_PARAM,
|
||||||
EOLIAN_INOUT_PARAM
|
EOLIAN_INOUT_PARAM
|
||||||
} Eolian_Parameter_Dir;
|
} Eolian_Parameter_Dir;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_CLASS_UNKNOWN_TYPE,
|
EOLIAN_CLASS_UNKNOWN_TYPE = 0,
|
||||||
EOLIAN_CLASS_REGULAR,
|
EOLIAN_CLASS_REGULAR,
|
||||||
EOLIAN_CLASS_ABSTRACT,
|
EOLIAN_CLASS_ABSTRACT,
|
||||||
EOLIAN_CLASS_MIXIN,
|
EOLIAN_CLASS_MIXIN,
|
||||||
|
@ -54,10 +55,18 @@ ffi.cdef [[
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_SCOPE_PUBLIC,
|
EOLIAN_SCOPE_PUBLIC = 0,
|
||||||
EOLIAN_SCOPE_PROTECTED
|
EOLIAN_SCOPE_PROTECTED
|
||||||
} Eolian_Object_Scope;
|
} Eolian_Object_Scope;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
EOLIAN_TYPEDECL_UNKNOWN = 0,
|
||||||
|
EOLIAN_TYPEDECL_STRUCT,
|
||||||
|
EOLIAN_TYPEDECL_STRUCT_OPAQUE,
|
||||||
|
EOLIAN_TYPEDECL_ENUM,
|
||||||
|
EOLIAN_TYPEDECL_ALIAS
|
||||||
|
} Eolian_Typedecl_Type;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_TYPE_UNKNOWN_TYPE,
|
EOLIAN_TYPE_UNKNOWN_TYPE,
|
||||||
|
@ -232,7 +241,6 @@ ffi.cdef [[
|
||||||
const Eolian_Documentation *eolian_function_return_documentation_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
|
const Eolian_Documentation *eolian_function_return_documentation_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
|
||||||
Eina_Bool eolian_function_return_is_warn_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
|
Eina_Bool eolian_function_return_is_warn_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
|
||||||
Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_id);
|
Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_id);
|
||||||
Eina_Bool eolian_type_is_extern(const Eolian_Type *tp);
|
|
||||||
const char *eolian_implement_full_name_get(const Eolian_Implement *impl);
|
const char *eolian_implement_full_name_get(const Eolian_Implement *impl);
|
||||||
const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl);
|
const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl);
|
||||||
const Eolian_Function *eolian_implement_function_get(const Eolian_Implement *impl, Eolian_Function_Type *func_type);
|
const Eolian_Function *eolian_implement_function_get(const Eolian_Implement *impl, Eolian_Function_Type *func_type);
|
||||||
|
@ -258,40 +266,63 @@ ffi.cdef [[
|
||||||
Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass);
|
Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass);
|
||||||
Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass);
|
Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass);
|
||||||
const char *eolian_class_c_get_function_name_get(const Eolian_Class *klass);
|
const char *eolian_class_c_get_function_name_get(const Eolian_Class *klass);
|
||||||
const Eolian_Type *eolian_type_alias_get_by_name(const char *name);
|
const Eolian_Typedecl *eolian_typedecl_alias_get_by_name(const char *name);
|
||||||
const Eolian_Type *eolian_type_struct_get_by_name(const char *name);
|
const Eolian_Typedecl *eolian_typedecl_struct_get_by_name(const char *name);
|
||||||
const Eolian_Type *eolian_type_enum_get_by_name(const char *name);
|
const Eolian_Typedecl *eolian_typedecl_enum_get_by_name(const char *name);
|
||||||
Eina_Iterator *eolian_type_aliases_get_by_file(const char *fname);
|
Eina_Iterator *eolian_typedecl_aliases_get_by_file(const char *fname);
|
||||||
Eina_Iterator *eolian_type_structs_get_by_file(const char *fname);
|
Eina_Iterator *eolian_typedecl_structs_get_by_file(const char *fname);
|
||||||
Eina_Iterator *eolian_type_enums_get_by_file(const char *fname);
|
Eina_Iterator *eolian_typedecl_enums_get_by_file(const char *fname);
|
||||||
Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
|
Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
|
||||||
Eina_Iterator *eolian_type_arguments_get(const Eolian_Type *tp);
|
Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp);
|
||||||
Eina_Iterator *eolian_type_subtypes_get(const Eolian_Type *tp);
|
Eina_Iterator *eolian_type_subtypes_get(const Eolian_Type *tp);
|
||||||
Eina_Iterator *eolian_type_struct_fields_get(const Eolian_Type *tp);
|
Eina_Iterator *eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp);
|
||||||
const Eolian_Struct_Type_Field *eolian_type_struct_field_get(const Eolian_Type *tp, const char *field);
|
const Eolian_Struct_Type_Field *eolian_typedecl_struct_field_get(const Eolian_Typedecl *tp, const char *field);
|
||||||
const char *eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl);
|
const char *eolian_typedecl_struct_field_name_get(const Eolian_Struct_Type_Field *fl);
|
||||||
const Eolian_Documentation *eolian_type_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl);
|
const Eolian_Documentation *eolian_typedecl_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl);
|
||||||
const Eolian_Type *eolian_type_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
|
const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
|
||||||
Eina_Iterator *eolian_type_enum_fields_get(const Eolian_Type *tp);
|
Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp);
|
||||||
const Eolian_Enum_Type_Field *eolian_type_enum_field_get(const Eolian_Type *tp, const char *field);
|
const Eolian_Enum_Type_Field *eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field);
|
||||||
const char *eolian_type_enum_field_name_get(const Eolian_Enum_Type_Field *fl);
|
const char *eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *fl);
|
||||||
const Eolian_Documentation *eolian_type_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl);
|
const char *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl);
|
||||||
const Eolian_Expression *eolian_type_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force);
|
const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl);
|
||||||
const char *eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp);
|
const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force);
|
||||||
const Eolian_Documentation *eolian_type_documentation_get(const Eolian_Type *tp);
|
|
||||||
|
const char *eolian_typedecl_enum_legacy_prefix_get(const Eolian_Typedecl *tp);
|
||||||
|
const Eolian_Documentation *eolian_typedecl_documentation_get(const Eolian_Typedecl *tp);
|
||||||
const char *eolian_type_file_get(const Eolian_Type *tp);
|
const char *eolian_type_file_get(const Eolian_Type *tp);
|
||||||
const Eolian_Type *eolian_type_return_type_get(const Eolian_Type *tp);
|
const char *eolian_typedecl_file_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp);
|
const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp);
|
||||||
|
const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp);
|
||||||
|
const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
|
const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
|
||||||
|
const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
||||||
Eina_Bool eolian_type_is_own(const Eolian_Type *tp);
|
Eina_Bool eolian_type_is_own(const Eolian_Type *tp);
|
||||||
Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
|
Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
|
||||||
|
|
||||||
|
Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
const char *eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name);
|
const char *eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name);
|
||||||
|
const char *eolian_typedecl_c_type_named_get(const Eolian_Typedecl *tp, const char *name);
|
||||||
|
|
||||||
const char *eolian_type_c_type_get(const Eolian_Type *tp);
|
const char *eolian_type_c_type_get(const Eolian_Type *tp);
|
||||||
|
const char *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
const char *eolian_type_name_get(const Eolian_Type *tp);
|
const char *eolian_type_name_get(const Eolian_Type *tp);
|
||||||
|
const char *eolian_typedecl_name_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
const char *eolian_type_full_name_get(const Eolian_Type *tp);
|
const char *eolian_type_full_name_get(const Eolian_Type *tp);
|
||||||
|
const char *eolian_typedecl_full_name_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
Eina_Iterator *eolian_type_namespaces_get(const Eolian_Type *tp);
|
Eina_Iterator *eolian_type_namespaces_get(const Eolian_Type *tp);
|
||||||
|
Eina_Iterator *eolian_typedecl_namespaces_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
const char *eolian_type_free_func_get(const Eolian_Type *tp);
|
const char *eolian_type_free_func_get(const Eolian_Type *tp);
|
||||||
|
const char *eolian_typedecl_free_func_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
Eolian_Value_t eolian_expression_eval(const Eolian_Expression *expr, Eolian_Expression_Mask m);
|
Eolian_Value_t eolian_expression_eval(const Eolian_Expression *expr, Eolian_Expression_Mask m);
|
||||||
Eolian_Value_t eolian_expression_eval_type(const Eolian_Expression *expr, const Eolian_Type *type);
|
Eolian_Value_t eolian_expression_eval_type(const Eolian_Expression *expr, const Eolian_Type *type);
|
||||||
const char *eolian_expression_value_to_literal(const Eolian_Value *v);
|
const char *eolian_expression_value_to_literal(const Eolian_Value *v);
|
||||||
|
@ -416,36 +447,44 @@ M.declaration_type = {
|
||||||
}
|
}
|
||||||
|
|
||||||
M.type_type = {
|
M.type_type = {
|
||||||
UNKNOWN = 0,
|
UNKNOWN = 0,
|
||||||
VOID = 1,
|
VOID = 1,
|
||||||
REGULAR = 2,
|
REGULAR = 2,
|
||||||
COMPLEX = 3,
|
COMPLEX = 3,
|
||||||
POINTER = 4,
|
POINTER = 4,
|
||||||
FUNCTION = 5,
|
FUNCTION = 5,
|
||||||
STRUCT = 6,
|
STRUCT = 6,
|
||||||
STRUCT_OPAQUE = 7,
|
STRUCT_OPAQUE = 7,
|
||||||
ENUM = 8,
|
ENUM = 8,
|
||||||
ALIAS = 9,
|
ALIAS = 9,
|
||||||
CLASS = 10,
|
CLASS = 10,
|
||||||
UNDEFINED = 11
|
UNDEFINED = 11
|
||||||
|
}
|
||||||
|
|
||||||
|
M.typedecl_type = {
|
||||||
|
UNKNOWN = 0,
|
||||||
|
STRUCT = 1,
|
||||||
|
STRUCT_OPAQUE = 2,
|
||||||
|
ENUM = 3,
|
||||||
|
ALIAS = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
ffi.metatype("Eolian_Struct_Type_Field", {
|
ffi.metatype("Eolian_Struct_Type_Field", {
|
||||||
__index = {
|
__index = {
|
||||||
name_get = function(self)
|
name_get = function(self)
|
||||||
local v = eolian.eolian_type_struct_field_name_get(self)
|
local v = eolian.eolian_typedecl_struct_field_name_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return ffi.string(v)
|
return ffi.string(v)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
documentation_get = function(self)
|
documentation_get = function(self)
|
||||||
local v = eolian.eolian_type_struct_field_documentation_get(self)
|
local v = eolian.eolian_typedecl_struct_field_documentation_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
|
||||||
type_get = function(self)
|
type_get = function(self)
|
||||||
local v = eolian.eolian_type_struct_field_type_get(self)
|
local v = eolian.eolian_typedecl_struct_field_type_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
|
@ -455,89 +494,155 @@ ffi.metatype("Eolian_Struct_Type_Field", {
|
||||||
ffi.metatype("Eolian_Enum_Type_Field", {
|
ffi.metatype("Eolian_Enum_Type_Field", {
|
||||||
__index = {
|
__index = {
|
||||||
name_get = function(self)
|
name_get = function(self)
|
||||||
local v = eolian.eolian_type_enum_field_name_get(self)
|
local v = eolian.eolian_typedecl_enum_field_name_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return ffi.string(v)
|
return ffi.string(v)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
c_name_get = function(self)
|
||||||
|
local v = eolian.eolian_typedecl_enum_field_c_name_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi_stringshare(v)
|
||||||
|
end,
|
||||||
|
|
||||||
documentation_get = function(self)
|
documentation_get = function(self)
|
||||||
local v = eolian.eolian_type_enum_field_documentation_get(self)
|
local v = eolian.eolian_typedecl_enum_field_documentation_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
|
||||||
value_get = function(self, force)
|
value_get = function(self, force)
|
||||||
local v = eolian.eolian_type_enum_field_value_get(self, force and 1 or 0)
|
local v = eolian.eolian_typedecl_enum_field_value_get(self, force and 1 or 0)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
M.Typedecl = ffi.metatype("Eolian_Typedecl", {
|
||||||
|
__index = {
|
||||||
|
type_get = function(self)
|
||||||
|
return tonumber(eolian.eolian_typedecl_type_get(self))
|
||||||
|
end,
|
||||||
|
|
||||||
|
struct_fields_get = function(self)
|
||||||
|
return Ptr_Iterator("const Eolian_Struct_Type_Field*",
|
||||||
|
eolian.eolian_typedecl_struct_fields_get(self))
|
||||||
|
end,
|
||||||
|
|
||||||
|
struct_field_get = function(self, name)
|
||||||
|
local v = eolian.eolian_typedecl_struct_field_get(self, name)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return v
|
||||||
|
end,
|
||||||
|
|
||||||
|
enum_fields_get = function(self)
|
||||||
|
return Ptr_Iterator("const Eolian_Enum_Type_Field*",
|
||||||
|
eolian.eolian_typedecl_enum_fields_get(self))
|
||||||
|
end,
|
||||||
|
|
||||||
|
enum_field_get = function(self, field)
|
||||||
|
local v = eolian.eolian_typedecl_enum_field_get(self, field)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return v
|
||||||
|
end,
|
||||||
|
|
||||||
|
enum_legacy_prefix_get = function(self)
|
||||||
|
local v = eolian.eolian_typedecl_enum_legacy_prefix_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
documentation_get = function(self, name)
|
||||||
|
local v = eolian.eolian_typedecl_documentation_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return v
|
||||||
|
end,
|
||||||
|
|
||||||
|
file_get = function(self, name)
|
||||||
|
local v = eolian.eolian_typedecl_file_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
base_type_get = function(self)
|
||||||
|
local v = eolian.eolian_typedecl_base_type_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return v
|
||||||
|
end,
|
||||||
|
|
||||||
|
aliased_base_get = function(self)
|
||||||
|
local v = eolian.eolian_typedecl_aliased_byse_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return v
|
||||||
|
end,
|
||||||
|
|
||||||
|
is_extern = function(self)
|
||||||
|
return eolian.eolian_typedecl_is_extern(self) ~= 0
|
||||||
|
end,
|
||||||
|
|
||||||
|
c_type_named_get = function(self, name)
|
||||||
|
local v = eolian.eolian_typedecl_c_type_named_get(self, name)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi_stringshare(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
c_type_get = function(self)
|
||||||
|
local v = eolian.eolian_typedecl_c_type_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi_stringshare(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
name_get = function(self)
|
||||||
|
local v = eolian.eolian_typedecl_name_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
full_name_get = function(self)
|
||||||
|
local v = eolian.eolian_typedecl_full_name_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
namespaces_get = function(self)
|
||||||
|
return iterator.String_Iterator(
|
||||||
|
eolian.eolian_typedecl_namespaces_get(self))
|
||||||
|
end,
|
||||||
|
|
||||||
|
free_func_get = function(self)
|
||||||
|
local v = eolian.eolian_typedecl_free_func_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
M.Type = ffi.metatype("Eolian_Type", {
|
M.Type = ffi.metatype("Eolian_Type", {
|
||||||
__index = {
|
__index = {
|
||||||
type_get = function(self)
|
type_get = function(self)
|
||||||
return tonumber(eolian.eolian_type_type_get(self))
|
return tonumber(eolian.eolian_type_type_get(self))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
arguments_get = function(self)
|
|
||||||
return Ptr_Iterator("const Eolian_Type*",
|
|
||||||
eolian.eolian_type_arguments_get(self))
|
|
||||||
end,
|
|
||||||
|
|
||||||
subtypes_get = function(self)
|
subtypes_get = function(self)
|
||||||
return Ptr_Iterator("const Eolian_Type*",
|
return Ptr_Iterator("const Eolian_Type*",
|
||||||
eolian.eolian_type_subtypes_get(self))
|
eolian.eolian_type_subtypes_get(self))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
struct_fields_get = function(self)
|
|
||||||
return Ptr_Iterator("const Eolian_Struct_Type_Field*",
|
|
||||||
eolian.eolian_type_struct_fields_get(self))
|
|
||||||
end,
|
|
||||||
|
|
||||||
struct_field_get = function(self, name)
|
|
||||||
local v = eolian.eolian_type_struct_field_get(self, name)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return v
|
|
||||||
end,
|
|
||||||
|
|
||||||
enum_fields_get = function(self)
|
|
||||||
return Ptr_Iterator("const Eolian_Enum_Type_Field*",
|
|
||||||
eolian.eolian_type_enum_fields_get(self))
|
|
||||||
end,
|
|
||||||
|
|
||||||
enum_field_get = function(self, field)
|
|
||||||
local v = eolian.eolian_type_enum_field_get(self, field)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return v
|
|
||||||
end,
|
|
||||||
|
|
||||||
enum_legacy_prefix_get = function(self)
|
|
||||||
local v = eolian.eolian_type_enum_legacy_prefix_get(self)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return ffi.string(v)
|
|
||||||
end,
|
|
||||||
|
|
||||||
documentation_get = function(self, name)
|
|
||||||
local v = eolian.eolian_type_documentation_get(self)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return v
|
|
||||||
end,
|
|
||||||
|
|
||||||
file_get = function(self, name)
|
file_get = function(self, name)
|
||||||
local v = eolian.eolian_type_file_get(self)
|
local v = eolian.eolian_type_file_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return ffi.string(v)
|
return ffi.string(v)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
return_type_get = function(self)
|
base_type_get = function(self)
|
||||||
local v = eolian.eolian_type_return_type_get(self)
|
local v = eolian.eolian_type_base_type_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
|
||||||
base_type_get = function(self)
|
typedecl_get = function(self)
|
||||||
local v = eolian.eolian_type_base_type_get(self)
|
local v = eolian.eolian_type_typedecl_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
@ -562,10 +667,6 @@ M.Type = ffi.metatype("Eolian_Type", {
|
||||||
return eolian.eolian_type_is_const(self) ~= 0
|
return eolian.eolian_type_is_const(self) ~= 0
|
||||||
end,
|
end,
|
||||||
|
|
||||||
is_extern = function(self)
|
|
||||||
return eolian.eolian_type_is_extern(self) ~= 0
|
|
||||||
end,
|
|
||||||
|
|
||||||
c_type_named_get = function(self, name)
|
c_type_named_get = function(self, name)
|
||||||
local v = eolian.eolian_type_c_type_named_get(self, name)
|
local v = eolian.eolian_type_c_type_named_get(self, name)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
|
@ -1002,36 +1103,36 @@ M.Class = ffi.metatype("Eolian_Class", {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
M.type_alias_get_by_name = function(name)
|
M.typedecl_alias_get_by_name = function(name)
|
||||||
local v = eolian.eolian_type_alias_get_by_name(name)
|
local v = eolian.eolian_typedecl_alias_get_by_name(name)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
|
|
||||||
M.type_struct_get_by_name = function(name)
|
M.typedecl_struct_get_by_name = function(name)
|
||||||
local v = eolian.eolian_type_struct_get_by_name(name)
|
local v = eolian.eolian_typedecl_struct_get_by_name(name)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
|
|
||||||
M.type_enum_get_by_name = function(name)
|
M.typedecl_enum_get_by_name = function(name)
|
||||||
local v = eolian.eolian_type_enum_get_by_name(name)
|
local v = eolian.eolian_typedecl_enum_get_by_name(name)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
|
|
||||||
M.type_aliases_get_by_file = function(fname)
|
M.typedecl_aliases_get_by_file = function(fname)
|
||||||
return Ptr_Iterator("const Eolian_Type*",
|
return Ptr_Iterator("const Eolian_Typedecl *",
|
||||||
eolian.eolian_type_aliases_get_by_file(self))
|
eolian.eolian_type_aliases_get_by_file(self))
|
||||||
end
|
end
|
||||||
|
|
||||||
M.type_structs_get_by_file = function(fname)
|
M.typedecl_structs_get_by_file = function(fname)
|
||||||
return Ptr_Iterator("const Eolian_Type*",
|
return Ptr_Iterator("const Eolian_Typedecl *",
|
||||||
eolian.eolian_type_structs_get_by_file(self))
|
eolian.eolian_type_structs_get_by_file(self))
|
||||||
end
|
end
|
||||||
|
|
||||||
M.type_enums_get_by_file = function(fname)
|
M.typedecl_enums_get_by_file = function(fname)
|
||||||
return Ptr_Iterator("const Eolian_Type*",
|
return Ptr_Iterator("const Eolian_Typedecl *",
|
||||||
eolian.eolian_type_enums_get_by_file(self))
|
eolian.eolian_type_enums_get_by_file(self))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,12 @@ typedef struct _Eolian_Function Eolian_Function;
|
||||||
*/
|
*/
|
||||||
typedef struct _Eolian_Type Eolian_Type;
|
typedef struct _Eolian_Type Eolian_Type;
|
||||||
|
|
||||||
|
/* Type declaration.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
typedef struct _Eolian_Typedecl Eolian_Typedecl;
|
||||||
|
|
||||||
/* Class function parameter information
|
/* Class function parameter information
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
|
@ -167,7 +173,7 @@ typedef struct _Eolian_Documentation Eolian_Documentation;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_UNRESOLVED,
|
EOLIAN_UNRESOLVED = 0,
|
||||||
EOLIAN_PROPERTY,
|
EOLIAN_PROPERTY,
|
||||||
EOLIAN_PROP_SET,
|
EOLIAN_PROP_SET,
|
||||||
EOLIAN_PROP_GET,
|
EOLIAN_PROP_GET,
|
||||||
|
@ -176,14 +182,14 @@ typedef enum
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_IN_PARAM,
|
EOLIAN_IN_PARAM = 0,
|
||||||
EOLIAN_OUT_PARAM,
|
EOLIAN_OUT_PARAM,
|
||||||
EOLIAN_INOUT_PARAM
|
EOLIAN_INOUT_PARAM
|
||||||
} Eolian_Parameter_Dir;
|
} Eolian_Parameter_Dir;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_CLASS_UNKNOWN_TYPE,
|
EOLIAN_CLASS_UNKNOWN_TYPE = 0,
|
||||||
EOLIAN_CLASS_REGULAR,
|
EOLIAN_CLASS_REGULAR,
|
||||||
EOLIAN_CLASS_ABSTRACT,
|
EOLIAN_CLASS_ABSTRACT,
|
||||||
EOLIAN_CLASS_MIXIN,
|
EOLIAN_CLASS_MIXIN,
|
||||||
|
@ -192,22 +198,27 @@ typedef enum
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_SCOPE_PUBLIC,
|
EOLIAN_SCOPE_PUBLIC = 0,
|
||||||
EOLIAN_SCOPE_PRIVATE,
|
EOLIAN_SCOPE_PRIVATE,
|
||||||
EOLIAN_SCOPE_PROTECTED
|
EOLIAN_SCOPE_PROTECTED
|
||||||
} Eolian_Object_Scope;
|
} Eolian_Object_Scope;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_TYPE_UNKNOWN_TYPE,
|
EOLIAN_TYPEDECL_UNKNOWN = 0,
|
||||||
|
EOLIAN_TYPEDECL_STRUCT,
|
||||||
|
EOLIAN_TYPEDECL_STRUCT_OPAQUE,
|
||||||
|
EOLIAN_TYPEDECL_ENUM,
|
||||||
|
EOLIAN_TYPEDECL_ALIAS
|
||||||
|
} Eolian_Typedecl_Type;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
EOLIAN_TYPE_UNKNOWN_TYPE = 0,
|
||||||
EOLIAN_TYPE_VOID,
|
EOLIAN_TYPE_VOID,
|
||||||
EOLIAN_TYPE_REGULAR,
|
EOLIAN_TYPE_REGULAR,
|
||||||
EOLIAN_TYPE_COMPLEX,
|
EOLIAN_TYPE_COMPLEX,
|
||||||
EOLIAN_TYPE_POINTER,
|
EOLIAN_TYPE_POINTER,
|
||||||
EOLIAN_TYPE_STRUCT,
|
|
||||||
EOLIAN_TYPE_STRUCT_OPAQUE,
|
|
||||||
EOLIAN_TYPE_ENUM,
|
|
||||||
EOLIAN_TYPE_ALIAS,
|
|
||||||
EOLIAN_TYPE_CLASS,
|
EOLIAN_TYPE_CLASS,
|
||||||
EOLIAN_TYPE_UNDEFINED
|
EOLIAN_TYPE_UNDEFINED
|
||||||
} Eolian_Type_Type;
|
} Eolian_Type_Type;
|
||||||
|
@ -1253,34 +1264,34 @@ EAPI Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass);
|
||||||
EAPI Eina_Stringshare *eolian_class_c_get_function_name_get(const Eolian_Class *klass);
|
EAPI Eina_Stringshare *eolian_class_c_get_function_name_get(const Eolian_Class *klass);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get an alias type by name. Supports namespaces.
|
* @brief Get an alias type declaration by name. Supports namespaces.
|
||||||
*
|
*
|
||||||
* @param[in] name the name of the alias
|
* @param[in] name the name of the alias
|
||||||
* @return the alias type or NULL
|
* @return the alias type or NULL
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI const Eolian_Type *eolian_type_alias_get_by_name(const char *name);
|
EAPI const Eolian_Typedecl *eolian_typedecl_alias_get_by_name(const char *name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get a struct by name. Supports namespaces.
|
* @brief Get a struct declaration by name. Supports namespaces.
|
||||||
*
|
*
|
||||||
* @param[in] name the name of the struct
|
* @param[in] name the name of the struct
|
||||||
* @return the struct or NULL
|
* @return the struct or NULL
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI const Eolian_Type *eolian_type_struct_get_by_name(const char *name);
|
EAPI const Eolian_Typedecl *eolian_typedecl_struct_get_by_name(const char *name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get an enum by name. Supports namespaces.
|
* @brief Get an enum declaration by name. Supports namespaces.
|
||||||
*
|
*
|
||||||
* @param[in] name the name of the struct
|
* @param[in] name the name of the struct
|
||||||
* @return the struct or NULL
|
* @return the struct or NULL
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI const Eolian_Type *eolian_type_enum_get_by_name(const char *name);
|
EAPI const Eolian_Typedecl *eolian_typedecl_enum_get_by_name(const char *name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get an iterator to all aliases contained in a file.
|
* @brief Get an iterator to all aliases contained in a file.
|
||||||
|
@ -1292,7 +1303,7 @@ EAPI const Eolian_Type *eolian_type_enum_get_by_name(const char *name);
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Iterator *eolian_type_aliases_get_by_file(const char *fname);
|
EAPI Eina_Iterator *eolian_typedecl_aliases_get_by_file(const char *fname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get an iterator to all named structs contained in a file.
|
* @brief Get an iterator to all named structs contained in a file.
|
||||||
|
@ -1304,7 +1315,7 @@ EAPI Eina_Iterator *eolian_type_aliases_get_by_file(const char *fname);
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Iterator *eolian_type_structs_get_by_file(const char *fname);
|
EAPI Eina_Iterator *eolian_typedecl_structs_get_by_file(const char *fname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get an iterator to all enums contained in a file.
|
* @brief Get an iterator to all enums contained in a file.
|
||||||
|
@ -1316,10 +1327,284 @@ EAPI Eina_Iterator *eolian_type_structs_get_by_file(const char *fname);
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Iterator *eolian_type_enums_get_by_file(const char *fname);
|
EAPI Eina_Iterator *eolian_typedecl_enums_get_by_file(const char *fname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get the type of a type (regular, function, pointer)
|
* @brief Get the type of a type declaration.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return an Eolian_Typedecl_Type.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get an iterator to all fields of a struct type.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the iterator when @c tp is EOLIAN_TYPEDECL_STRUCT, NULL otherwise.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Iterator *eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get a field of a struct type.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @param[in] field the field name.
|
||||||
|
* @return the field when @c tp is EOLIAN_TYPEDECL_STRUCT, @c field is not NULL
|
||||||
|
* and the field exists, NULL otherwise.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Struct_Type_Field *eolian_typedecl_struct_field_get(const Eolian_Typedecl *tp, const char *field);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the name of a field of a struct type.
|
||||||
|
*
|
||||||
|
* @param[in] fl the field.
|
||||||
|
* @return the name.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_struct_field_name_get(const Eolian_Struct_Type_Field *fl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the documentation of a field of a struct type.
|
||||||
|
*
|
||||||
|
* @param[in] fl the field.
|
||||||
|
* @return the documentation.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Documentation *eolian_typedecl_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the type of a field of a struct type.
|
||||||
|
*
|
||||||
|
* @param[in] fl the field.
|
||||||
|
* @return the type.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get an iterator to all fields of an enum type.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the iterator when @c tp is EOLIAN_TYPEDECL_ENUM, NULL otherwise.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get a field of an enum type.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @param[in] field the field name.
|
||||||
|
* @return the field when @c tp is EOLIAN_TYPEDECL_ENUM, @c field is not NULL,
|
||||||
|
* field exists and has a value set, NULL otherwise.
|
||||||
|
*
|
||||||
|
* Keep in mind that this can return NULL for an existing field, particularly
|
||||||
|
* when the field has no value set (i.e. increments by 1 over previous value).
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Enum_Type_Field *eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the name of a field of an enum type.
|
||||||
|
*
|
||||||
|
* @param[in] fl the field.
|
||||||
|
* @return the name.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *fl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the C name of a field of an enum type.
|
||||||
|
*
|
||||||
|
* The user of the API is responsible for the resulting stringshare.
|
||||||
|
*
|
||||||
|
* @param[in] fl the field.
|
||||||
|
* @return the name.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the documentation of a field of an enum type.
|
||||||
|
*
|
||||||
|
* @param[in] fl the field.
|
||||||
|
* @return the documentation.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the value of a field of an enum type.
|
||||||
|
*
|
||||||
|
* When the @c force parameter is EINA_FALSE, this will only return values for
|
||||||
|
* fields which are explicitly specified in the eo file, otherwise it will
|
||||||
|
* return a valid expression for any field.
|
||||||
|
*
|
||||||
|
* @param[in] fl the field.
|
||||||
|
* @param[in] force force the value retrieval.
|
||||||
|
* @return the expression.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the legacy prefix of enum field names. When not specified,
|
||||||
|
* enum name is used.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the legacy prefix or NULL.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_enum_legacy_prefix_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the documentation of a struct/alias type.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the documentation when @c tp is EOLIAN_TYPE_STRUCT or
|
||||||
|
* EOLIAN_TYPE_STRUCT_OPAQUE, NULL otherwise.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Documentation *eolian_typedecl_documentation_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the filename of a type declaration.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the filename.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_file_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the base type of an alias declaration.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the base type when @c tp is an alias, NULL otherwise.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the lowest base type of an alias stack.
|
||||||
|
*
|
||||||
|
* If the given typedecl is an alias, it returns the result of
|
||||||
|
* eolian_type_aliased_base_get on its base type. Otherwise this returns NULL.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the lowest alias base or the given type.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Check if a struct or alias type declaration is extern.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return EINA_TRUE if it's extern, EINA_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the full C type name of the given type declaration with a name.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @param[in] name the name.
|
||||||
|
* @return The C type name assuming @c tp is not NULL.
|
||||||
|
*
|
||||||
|
* Name is ignored for alias types and they're turned into C typedefs.
|
||||||
|
*
|
||||||
|
* Keep in mind that if @c name is NULL, the name won't be included.
|
||||||
|
* Also, you're responsible for deleting the stringshare.
|
||||||
|
*
|
||||||
|
* @see eolian_typedecl_c_type_get
|
||||||
|
* @see eolian_type_c_type_named_get
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_c_type_named_get(const Eolian_Typedecl *tp, const char *name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the full C type name of the given type without a name.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return The C type name assuming @c tp is not NULL.
|
||||||
|
*
|
||||||
|
* This behaves exactly like eolian_typedecl_c_type_named_get when name is NULL.
|
||||||
|
*
|
||||||
|
* @see eolian_typedecl_c_type_named_get
|
||||||
|
* @see eolian_type_c_type_get
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the name of the given type declaration. Keep in mind that the
|
||||||
|
* name doesn't include namespaces.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the name.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_name_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the full (namespaced) name of a type declaration.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the name.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_full_name_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get an iterator to the list of namespaces of the given type decl.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the iterator.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Iterator *eolian_typedecl_namespaces_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the name of the function used to free this type declaration.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type declaration.
|
||||||
|
* @return the free func name.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *eolian_typedecl_free_func_get(const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the type of a type.
|
||||||
*
|
*
|
||||||
* @param[in] tp the type.
|
* @param[in] tp the type.
|
||||||
* @return an Eolian_Type_Type.
|
* @return an Eolian_Type_Type.
|
||||||
|
@ -1339,153 +1624,7 @@ EAPI Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
|
||||||
EAPI Eina_Iterator *eolian_type_subtypes_get(const Eolian_Type *tp);
|
EAPI Eina_Iterator *eolian_type_subtypes_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get an iterator to all fields of a struct type.
|
* @brief Get the filename of a type.
|
||||||
*
|
|
||||||
* @param[in] tp the type.
|
|
||||||
* @return the iterator when @c tp is EOLIAN_TYPE_STRUCT, NULL otherwise.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI Eina_Iterator *eolian_type_struct_fields_get(const Eolian_Type *tp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get a field of a struct type.
|
|
||||||
*
|
|
||||||
* @param[in] tp the type.
|
|
||||||
* @param[in] field the field name.
|
|
||||||
* @return the field when @c tp is EOLIAN_TYPE_STRUCT, @c field is not NULL
|
|
||||||
* and the field exists, NULL otherwise.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI const Eolian_Struct_Type_Field *eolian_type_struct_field_get(const Eolian_Type *tp, const char *field);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the name of a field of a struct type.
|
|
||||||
*
|
|
||||||
* @param[in] fl the field.
|
|
||||||
* @return the name.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI Eina_Stringshare *eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the documentation of a field of a struct type.
|
|
||||||
*
|
|
||||||
* @param[in] fl the field.
|
|
||||||
* @return the documentation.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI const Eolian_Documentation *eolian_type_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the type of a field of a struct type.
|
|
||||||
*
|
|
||||||
* @param[in] fl the field.
|
|
||||||
* @return the type.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI const Eolian_Type *eolian_type_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get an iterator to all fields of an enum type.
|
|
||||||
*
|
|
||||||
* @param[in] tp the type.
|
|
||||||
* @return the iterator when @c tp is EOLIAN_TYPE_ENUM, NULL otherwise.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI Eina_Iterator *eolian_type_enum_fields_get(const Eolian_Type *tp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get a field of an enum type.
|
|
||||||
*
|
|
||||||
* @param[in] tp the type.
|
|
||||||
* @param[in] field the field name.
|
|
||||||
* @return the field when @c tp is EOLIAN_TYPE_ENUM, @c field is not NULL,
|
|
||||||
* field exists and has a value set, NULL otherwise.
|
|
||||||
*
|
|
||||||
* Keep in mind that this can return NULL for an existing field, particularly
|
|
||||||
* when the field has no value set (i.e. increments by 1 over previous value).
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI const Eolian_Enum_Type_Field *eolian_type_enum_field_get(const Eolian_Type *tp, const char *field);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the name of a field of an enum type.
|
|
||||||
*
|
|
||||||
* @param[in] fl the field.
|
|
||||||
* @return the name.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI Eina_Stringshare *eolian_type_enum_field_name_get(const Eolian_Enum_Type_Field *fl);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the C name of a field of an enum type.
|
|
||||||
*
|
|
||||||
* The user of the API is responsible for the resulting stringshare.
|
|
||||||
*
|
|
||||||
* @param[in] fl the field.
|
|
||||||
* @return the name.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI Eina_Stringshare *eolian_type_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the documentation of a field of an enum type.
|
|
||||||
*
|
|
||||||
* @param[in] fl the field.
|
|
||||||
* @return the documentation.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI const Eolian_Documentation *eolian_type_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the value of a field of an enum type.
|
|
||||||
*
|
|
||||||
* When the @c force parameter is EINA_FALSE, this will only return values for
|
|
||||||
* fields which are explicitly specified in the eo file, otherwise it will
|
|
||||||
* return a valid expression for any field.
|
|
||||||
*
|
|
||||||
* @param[in] fl the field.
|
|
||||||
* @param[in] force force the value retrieval.
|
|
||||||
* @return the expression.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI const Eolian_Expression *eolian_type_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the legacy prefix of enum field names. When not specified,
|
|
||||||
* enum name is used.
|
|
||||||
*
|
|
||||||
* @param[in] tp the type.
|
|
||||||
* @return the legacy prefix or NULL.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI Eina_Stringshare *eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the documentation of a struct/alias type.
|
|
||||||
*
|
|
||||||
* @param[in] tp the type.
|
|
||||||
* @return the documentation when @c tp is EOLIAN_TYPE_STRUCT or
|
|
||||||
* EOLIAN_TYPE_STRUCT_OPAQUE, NULL otherwise.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI const Eolian_Documentation *eolian_type_documentation_get(const Eolian_Type *tp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Get the filename of a struct/alias type.
|
|
||||||
*
|
*
|
||||||
* @param[in] tp the type.
|
* @param[in] tp the type.
|
||||||
* @return the filename.
|
* @return the filename.
|
||||||
|
@ -1495,27 +1634,35 @@ EAPI const Eolian_Documentation *eolian_type_documentation_get(const Eolian_Type
|
||||||
EAPI Eina_Stringshare *eolian_type_file_get(const Eolian_Type *tp);
|
EAPI Eina_Stringshare *eolian_type_file_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get the base type of a pointer, alias or regular type.
|
* @brief Get the base type of a pointer type.
|
||||||
*
|
|
||||||
* For pointers and aliases, it's a simple lookup. For regular types, it
|
|
||||||
* tries to look up alias, struct and enum in that order.
|
|
||||||
*
|
*
|
||||||
* @param[in] tp the type.
|
* @param[in] tp the type.
|
||||||
* @return the base type when @c tp is a pointer or alias, NULL otherwise.
|
* @return the base type when @c tp is a pointer, NULL otherwise.
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp);
|
EAPI const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get the declaration a regular type points to.
|
||||||
|
*
|
||||||
|
* This tries to look up alias, struct and enum in that order.
|
||||||
|
*
|
||||||
|
* @param[in] tp the type.
|
||||||
|
* @return the pointed to type decalration or NULL.
|
||||||
|
*
|
||||||
|
* @ingroup Eolian
|
||||||
|
*/
|
||||||
|
EAPI const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get the lowest base type of an alias stack.
|
* @brief Get the lowest base type of an alias stack.
|
||||||
*
|
*
|
||||||
* If the given type is an alias, it returns the result of a recursive call
|
* If this is a regular type, it first tries to retrieve its base declaration
|
||||||
* to this function on its base type. If it's a regular type, it first tries
|
* using eolian_type_typedecl_get and if the retrieved base is an alias, returns
|
||||||
* to retrieve its base using eolian_type_base_type_get and if the retrieved
|
* a call of eolian_typedecl_aliased_base_get function on it. Otherwise it
|
||||||
* base is an alias, returns a recursive call of this function on it. Otherwise
|
* returns the given type. This is useful in order to retrieve what an aliased
|
||||||
* it returns the given type. This is useful in order to retrieve what an
|
* type actually is while still having convenience.
|
||||||
* aliased type actually is while still having convenience.
|
|
||||||
*
|
*
|
||||||
* @param[in] tp the type.
|
* @param[in] tp the type.
|
||||||
* @return the lowest alias base or the given type.
|
* @return the lowest alias base or the given type.
|
||||||
|
@ -1556,16 +1703,6 @@ EAPI Eina_Bool eolian_type_is_own(const Eolian_Type *tp);
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
|
EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief Check if a struct or alias type is extern.
|
|
||||||
*
|
|
||||||
* @param[in] tp the type.
|
|
||||||
* @return EINA_TRUE if it's extern, EINA_FALSE otherwise.
|
|
||||||
*
|
|
||||||
* @ingroup Eolian
|
|
||||||
*/
|
|
||||||
EAPI Eina_Bool eolian_type_is_extern(const Eolian_Type *tp);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get the full C type name of the given type with a name.
|
* @brief Get the full C type name of the given type with a name.
|
||||||
*
|
*
|
||||||
|
@ -1573,16 +1710,11 @@ EAPI Eina_Bool eolian_type_is_extern(const Eolian_Type *tp);
|
||||||
* @param[in] name the name.
|
* @param[in] name the name.
|
||||||
* @return The C type name assuming @c tp is not NULL.
|
* @return The C type name assuming @c tp is not NULL.
|
||||||
*
|
*
|
||||||
* Providing the name is useful for function types, as in C a function
|
|
||||||
* pointer type alone is not valid syntax. For non-function types, the
|
|
||||||
* name is simply appended to the type (with a space). C type names do
|
|
||||||
* not include subtypes as C doesn't support them. Name is ignored for
|
|
||||||
* alias types. Alias types are turned into C typedefs.
|
|
||||||
*
|
|
||||||
* Keep in mind that if @c name is NULL, the name won't be included.
|
* Keep in mind that if @c name is NULL, the name won't be included.
|
||||||
* Also, you're responsible for deleting the stringshare.
|
* Also, you're responsible for deleting the stringshare.
|
||||||
*
|
*
|
||||||
* @see eolian_type_c_type_get
|
* @see eolian_type_c_type_get
|
||||||
|
* @see eolian_typedecl_c_type_named_get
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
|
@ -1595,11 +1727,9 @@ EAPI Eina_Stringshare *eolian_type_c_type_named_get(const Eolian_Type *tp, const
|
||||||
* @return The C type name assuming @c tp is not NULL.
|
* @return The C type name assuming @c tp is not NULL.
|
||||||
*
|
*
|
||||||
* This behaves exactly like eolian_type_c_type_named_get when name is NULL.
|
* This behaves exactly like eolian_type_c_type_named_get when name is NULL.
|
||||||
* Keep in mind that this is not useful for function types as a function
|
|
||||||
* pointer type in C cannot be used without a name.
|
|
||||||
* Also, you're responsible for deleting the stringshare.
|
|
||||||
*
|
*
|
||||||
* @see eolian_type_c_type_named_get
|
* @see eolian_type_c_type_named_get
|
||||||
|
* @see eolian_typedecl_c_type_get
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
|
@ -1607,10 +1737,8 @@ EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get the name of the given type. For regular or complex types, this
|
* @brief Get the name of the given type. For regular or complex types, this
|
||||||
* is for example "int". For EOLIAN_TYPE_STRUCT, EOLIAN_TYPE_STRUCT_OPAQUE and
|
* is for example "int". For EOLIAN_TYPE_CLASS, this can be "Button". Keep in
|
||||||
* EOLIAN_TYPE_ALIAS, this is the name of the alias or of the struct. For
|
* mind that the name doesn't include namespaces.
|
||||||
* EOLIAN_TYPE_CLASS, this can be "Button". Keep in mind that the name doesn't
|
|
||||||
* include namespaces for structs and aliases.
|
|
||||||
*
|
*
|
||||||
* @param[in] tp the type.
|
* @param[in] tp the type.
|
||||||
* @return the name.
|
* @return the name.
|
||||||
|
@ -1620,8 +1748,7 @@ EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp);
|
||||||
EAPI Eina_Stringshare *eolian_type_name_get(const Eolian_Type *tp);
|
EAPI Eina_Stringshare *eolian_type_name_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get the full (namespaced) name of a function. Only works on named
|
* @brief Get the full (namespaced) name of a type.
|
||||||
* types (not pointers, not functions, not void).
|
|
||||||
*
|
*
|
||||||
* @param[in] tp the type.
|
* @param[in] tp the type.
|
||||||
* @return the name.
|
* @return the name.
|
||||||
|
@ -1631,8 +1758,7 @@ EAPI Eina_Stringshare *eolian_type_name_get(const Eolian_Type *tp);
|
||||||
EAPI Eina_Stringshare *eolian_type_full_name_get(const Eolian_Type *tp);
|
EAPI Eina_Stringshare *eolian_type_full_name_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get an iterator to the list of namespaces of the given type. Only
|
* @brief Get an iterator to the list of namespaces of the given type.
|
||||||
* works on named types (not pointers, not functions, not void).
|
|
||||||
*
|
*
|
||||||
* @param[in] tp the type.
|
* @param[in] tp the type.
|
||||||
* @return the iterator.
|
* @return the iterator.
|
||||||
|
@ -1648,8 +1774,7 @@ EAPI Eina_Iterator *eolian_type_namespaces_get(const Eolian_Type *tp);
|
||||||
* @return the free func name.
|
* @return the free func name.
|
||||||
*
|
*
|
||||||
* For pointer types, this returns name of the func used to free the pointer.
|
* For pointer types, this returns name of the func used to free the pointer.
|
||||||
* For struct and alias types, this returns name of the func used to free a
|
* For other types, this returns NULL.
|
||||||
* pointer to that type. For other types, this returns NULL.
|
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
|
@ -2004,7 +2129,7 @@ EAPI const Eolian_Class *eolian_declaration_class_get(const Eolian_Declaration *
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI const Eolian_Type *eolian_declaration_data_type_get(const Eolian_Declaration *decl);
|
EAPI const Eolian_Typedecl *eolian_declaration_data_type_get(const Eolian_Declaration *decl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get the variable of a variable (constant, global) declaration.
|
* @brief Get the variable of a variable (constant, global) declaration.
|
||||||
|
|
|
@ -497,7 +497,7 @@ eval_exp(const Eolian_Expression *expr, Eolian_Expression_Mask mask,
|
||||||
|
|
||||||
if (!var)
|
if (!var)
|
||||||
{
|
{
|
||||||
const Eolian_Type *etp;
|
const Eolian_Typedecl *etpd;
|
||||||
const Eolian_Enum_Type_Field *fl;
|
const Eolian_Enum_Type_Field *fl;
|
||||||
|
|
||||||
/* try aliases, hoping it'll be enum */
|
/* try aliases, hoping it'll be enum */
|
||||||
|
@ -510,20 +510,24 @@ eval_exp(const Eolian_Expression *expr, Eolian_Expression_Mask mask,
|
||||||
if (!(mask & EOLIAN_MASK_INT))
|
if (!(mask & EOLIAN_MASK_INT))
|
||||||
return expr_type_error(expr, EOLIAN_MASK_INT, mask);
|
return expr_type_error(expr, EOLIAN_MASK_INT, mask);
|
||||||
|
|
||||||
etp = eolian_type_alias_get_by_name(fulln);
|
etpd = eolian_typedecl_alias_get_by_name(fulln);
|
||||||
while (etp && (etp->type == EOLIAN_TYPE_ALIAS
|
while (etpd && etpd->type == EOLIAN_TYPEDECL_ALIAS)
|
||||||
|| etp->type == EOLIAN_TYPE_REGULAR))
|
{
|
||||||
etp = eolian_type_base_type_get(etp);
|
const Eolian_Type *etp = eolian_typedecl_base_type_get(etpd);
|
||||||
|
if (!etp || etp->type != EOLIAN_TYPE_REGULAR)
|
||||||
|
break;
|
||||||
|
etpd = eolian_type_typedecl_get(etp);
|
||||||
|
}
|
||||||
|
|
||||||
if (!etp) etp = eolian_type_enum_get_by_name(fulln);
|
if (!etpd) etpd = eolian_typedecl_enum_get_by_name(fulln);
|
||||||
if (!etp || etp->type != EOLIAN_TYPE_ENUM)
|
if (!etpd || etpd->type != EOLIAN_TYPEDECL_ENUM)
|
||||||
{
|
{
|
||||||
free(fulln);
|
free(fulln);
|
||||||
return expr_error(expr, "undefined variable");
|
return expr_error(expr, "undefined variable");
|
||||||
}
|
}
|
||||||
|
|
||||||
fl = eolian_type_enum_field_get(etp, memb);
|
fl = eolian_typedecl_enum_field_get(etpd, memb);
|
||||||
if (fl) exp = eolian_type_enum_field_value_get(fl, EINA_TRUE);
|
if (fl) exp = eolian_typedecl_enum_field_value_get(fl, EINA_TRUE);
|
||||||
free(fulln);
|
free(fulln);
|
||||||
|
|
||||||
if (!exp)
|
if (!exp)
|
||||||
|
|
|
@ -23,8 +23,6 @@ _eval_type(const Eolian_Expression *expr, const Eolian_Type *type)
|
||||||
return err;
|
return err;
|
||||||
switch (type->type)
|
switch (type->type)
|
||||||
{
|
{
|
||||||
case EOLIAN_TYPE_ALIAS:
|
|
||||||
return _eval_type(expr, eolian_type_base_type_get(type));
|
|
||||||
case EOLIAN_TYPE_POINTER:
|
case EOLIAN_TYPE_POINTER:
|
||||||
{
|
{
|
||||||
int mask = EOLIAN_MASK_NULL;
|
int mask = EOLIAN_MASK_NULL;
|
||||||
|
@ -36,15 +34,18 @@ _eval_type(const Eolian_Expression *expr, const Eolian_Type *type)
|
||||||
}
|
}
|
||||||
case EOLIAN_TYPE_CLASS:
|
case EOLIAN_TYPE_CLASS:
|
||||||
return database_expr_eval(expr, EOLIAN_MASK_NULL);
|
return database_expr_eval(expr, EOLIAN_MASK_NULL);
|
||||||
case EOLIAN_TYPE_ENUM:
|
|
||||||
return database_expr_eval(expr, EOLIAN_MASK_INT);
|
|
||||||
case EOLIAN_TYPE_REGULAR:
|
case EOLIAN_TYPE_REGULAR:
|
||||||
{
|
{
|
||||||
int kw = eo_lexer_keyword_str_to_id(type->name);
|
int kw = eo_lexer_keyword_str_to_id(type->name);
|
||||||
if (!kw || kw < KW_byte || kw >= KW_void)
|
if (!kw || kw < KW_byte || kw >= KW_void)
|
||||||
{
|
{
|
||||||
const Eolian_Type *base = eolian_type_base_type_get(type);
|
const Eolian_Typedecl *base = eolian_type_typedecl_get(type);
|
||||||
if (base) return _eval_type(expr, base);
|
if (!base)
|
||||||
|
return err;
|
||||||
|
if (base->type == EOLIAN_TYPEDECL_ALIAS)
|
||||||
|
return _eval_type(expr, eolian_typedecl_base_type_get(base));
|
||||||
|
else if (base->type == EOLIAN_TYPEDECL_ENUM)
|
||||||
|
return database_expr_eval(expr, EOLIAN_MASK_INT);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
switch (kw)
|
switch (kw)
|
||||||
|
|
|
@ -14,8 +14,22 @@ database_type_del(Eolian_Type *tp)
|
||||||
if (tp->base.file) eina_stringshare_del(tp->base.file);
|
if (tp->base.file) eina_stringshare_del(tp->base.file);
|
||||||
if (tp->subtypes) EINA_LIST_FREE(tp->subtypes, stp)
|
if (tp->subtypes) EINA_LIST_FREE(tp->subtypes, stp)
|
||||||
database_type_del(stp);
|
database_type_del(stp);
|
||||||
if (tp->base_type)
|
database_type_del(tp->base_type);
|
||||||
database_type_del(tp->base_type);
|
if (tp->name) eina_stringshare_del(tp->name);
|
||||||
|
if (tp->full_name) eina_stringshare_del(tp->full_name);
|
||||||
|
if (tp->namespaces) EINA_LIST_FREE(tp->namespaces, sp)
|
||||||
|
eina_stringshare_del(sp);
|
||||||
|
if (tp->freefunc) eina_stringshare_del(tp->freefunc);
|
||||||
|
free(tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
database_typedecl_del(Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
if (!tp) return;
|
||||||
|
const char *sp;
|
||||||
|
if (tp->base.file) eina_stringshare_del(tp->base.file);
|
||||||
|
database_type_del(tp->base_type);
|
||||||
if (tp->name) eina_stringshare_del(tp->name);
|
if (tp->name) eina_stringshare_del(tp->name);
|
||||||
if (tp->full_name) eina_stringshare_del(tp->full_name);
|
if (tp->full_name) eina_stringshare_del(tp->full_name);
|
||||||
if (tp->fields) eina_hash_free(tp->fields);
|
if (tp->fields) eina_hash_free(tp->fields);
|
||||||
|
@ -29,24 +43,7 @@ database_type_del(Eolian_Type *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
database_typedef_del(Eolian_Type *tp)
|
database_type_add(Eolian_Typedecl *def)
|
||||||
{
|
|
||||||
if (!tp) return;
|
|
||||||
Eolian_Type *btp = tp->base_type;
|
|
||||||
/* prevent deletion of named structs/enums as they're deleted later on */
|
|
||||||
if (btp)
|
|
||||||
{
|
|
||||||
if (btp->type == EOLIAN_TYPE_ENUM)
|
|
||||||
tp->base_type = NULL;
|
|
||||||
else if ((btp->type == EOLIAN_TYPE_STRUCT
|
|
||||||
|| btp->type == EOLIAN_TYPE_STRUCT_OPAQUE) && btp->name)
|
|
||||||
tp->base_type = NULL;
|
|
||||||
}
|
|
||||||
database_type_del(tp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
database_type_add(Eolian_Type *def)
|
|
||||||
{
|
{
|
||||||
eina_hash_set(_aliases, def->full_name, def);
|
eina_hash_set(_aliases, def->full_name, def);
|
||||||
eina_hash_set(_aliasesf, def->base.file, eina_list_append
|
eina_hash_set(_aliasesf, def->base.file, eina_list_append
|
||||||
|
@ -55,7 +52,7 @@ database_type_add(Eolian_Type *def)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
database_struct_add(Eolian_Type *tp)
|
database_struct_add(Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
eina_hash_set(_structs, tp->full_name, tp);
|
eina_hash_set(_structs, tp->full_name, tp);
|
||||||
eina_hash_set(_structsf, tp->base.file, eina_list_append
|
eina_hash_set(_structsf, tp->base.file, eina_list_append
|
||||||
|
@ -64,7 +61,7 @@ database_struct_add(Eolian_Type *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
database_enum_add(Eolian_Type *tp)
|
database_enum_add(Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
eina_hash_set(_enums, tp->full_name, tp);
|
eina_hash_set(_enums, tp->full_name, tp);
|
||||||
eina_hash_set(_enumsf, tp->base.file, eina_list_append
|
eina_hash_set(_enumsf, tp->base.file, eina_list_append
|
||||||
|
@ -72,123 +69,9 @@ database_enum_add(Eolian_Type *tp)
|
||||||
database_decl_add(tp->full_name, EOLIAN_DECL_ENUM, tp->base.file, tp);
|
database_decl_add(tp->full_name, EOLIAN_DECL_ENUM, tp->base.file, tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_stype_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
|
|
||||||
{
|
|
||||||
Eolian_Struct_Type_Field *sf;
|
|
||||||
Eina_List *l;
|
|
||||||
eina_strbuf_append(buf, "struct ");
|
|
||||||
if (tp->name)
|
|
||||||
{
|
|
||||||
Eina_List *m;
|
|
||||||
const char *sp;
|
|
||||||
EINA_LIST_FOREACH(tp->namespaces, m, sp)
|
|
||||||
{
|
|
||||||
eina_strbuf_append(buf, sp);
|
|
||||||
eina_strbuf_append_char(buf, '_');
|
|
||||||
}
|
|
||||||
eina_strbuf_append(buf, tp->name);
|
|
||||||
eina_strbuf_append_char(buf, ' ');
|
|
||||||
}
|
|
||||||
if (tp->type == EOLIAN_TYPE_STRUCT_OPAQUE)
|
|
||||||
goto append_name;
|
|
||||||
eina_strbuf_append(buf, "{ ");
|
|
||||||
EINA_LIST_FOREACH(tp->field_list, l, sf)
|
|
||||||
{
|
|
||||||
database_type_to_str(sf->type, buf, sf->name);
|
|
||||||
eina_strbuf_append(buf, "; ");
|
|
||||||
}
|
|
||||||
eina_strbuf_append(buf, "}");
|
|
||||||
append_name:
|
|
||||||
if (name)
|
|
||||||
{
|
|
||||||
eina_strbuf_append_char(buf, ' ');
|
|
||||||
eina_strbuf_append(buf, name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_etype_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
|
|
||||||
{
|
|
||||||
Eolian_Enum_Type_Field *ef;
|
|
||||||
Eina_List *l;
|
|
||||||
eina_strbuf_append(buf, "enum ");
|
|
||||||
if (tp->name)
|
|
||||||
{
|
|
||||||
Eina_List *m;
|
|
||||||
const char *sp;
|
|
||||||
EINA_LIST_FOREACH(tp->namespaces, m, sp)
|
|
||||||
{
|
|
||||||
eina_strbuf_append(buf, sp);
|
|
||||||
eina_strbuf_append_char(buf, '_');
|
|
||||||
}
|
|
||||||
eina_strbuf_append(buf, tp->name);
|
|
||||||
eina_strbuf_append_char(buf, ' ');
|
|
||||||
}
|
|
||||||
eina_strbuf_append(buf, "{ ");
|
|
||||||
EINA_LIST_FOREACH(tp->field_list, l, ef)
|
|
||||||
{
|
|
||||||
eina_strbuf_append(buf, ef->name);
|
|
||||||
if (ef->value)
|
|
||||||
{
|
|
||||||
Eolian_Value val = eolian_expression_eval(ef->value,
|
|
||||||
EOLIAN_MASK_INT);
|
|
||||||
const char *ret;
|
|
||||||
eina_strbuf_append(buf, " = ");
|
|
||||||
ret = eolian_expression_value_to_literal(&val);
|
|
||||||
eina_strbuf_append(buf, ret);
|
|
||||||
eina_stringshare_del(ret);
|
|
||||||
}
|
|
||||||
if (l != eina_list_last(tp->field_list))
|
|
||||||
eina_strbuf_append(buf, ", ");
|
|
||||||
}
|
|
||||||
eina_strbuf_append(buf, " }");
|
|
||||||
if (name)
|
|
||||||
{
|
|
||||||
eina_strbuf_append_char(buf, ' ');
|
|
||||||
eina_strbuf_append(buf, name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_atype_to_str(const Eolian_Type *tp, Eina_Strbuf *buf)
|
|
||||||
{
|
|
||||||
Eina_Strbuf *fulln = eina_strbuf_new();
|
|
||||||
Eina_List *l;
|
|
||||||
const char *sp;
|
|
||||||
|
|
||||||
eina_strbuf_append(buf, "typedef ");
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(tp->namespaces, l, sp)
|
|
||||||
{
|
|
||||||
eina_strbuf_append(fulln, sp);
|
|
||||||
eina_strbuf_append_char(fulln, '_');
|
|
||||||
}
|
|
||||||
eina_strbuf_append(fulln, tp->name);
|
|
||||||
|
|
||||||
database_type_to_str(tp->base_type, buf, eina_strbuf_string_get(fulln));
|
|
||||||
eina_strbuf_free(fulln);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
|
database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
|
||||||
{
|
{
|
||||||
if (tp->type == EOLIAN_TYPE_ALIAS)
|
|
||||||
{
|
|
||||||
_atype_to_str(tp, buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (tp->type == EOLIAN_TYPE_STRUCT
|
|
||||||
|| tp->type == EOLIAN_TYPE_STRUCT_OPAQUE)
|
|
||||||
{
|
|
||||||
_stype_to_str(tp, buf, name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (tp->type == EOLIAN_TYPE_ENUM)
|
|
||||||
{
|
|
||||||
_etype_to_str(tp, buf, name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((tp->type == EOLIAN_TYPE_REGULAR
|
if ((tp->type == EOLIAN_TYPE_REGULAR
|
||||||
|| tp->type == EOLIAN_TYPE_COMPLEX
|
|| tp->type == EOLIAN_TYPE_COMPLEX
|
||||||
|| tp->type == EOLIAN_TYPE_VOID
|
|| tp->type == EOLIAN_TYPE_VOID
|
||||||
|
@ -234,81 +117,127 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_typedef_print(Eolian_Type *tp)
|
_stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
||||||
{
|
{
|
||||||
printf("type %s: ", tp->full_name);
|
Eolian_Struct_Type_Field *sf;
|
||||||
database_type_print(tp->base_type);
|
Eina_List *l;
|
||||||
}
|
eina_strbuf_append(buf, "struct ");
|
||||||
|
if (tp->name)
|
||||||
void
|
|
||||||
database_expr_print(Eolian_Expression *exp)
|
|
||||||
{
|
|
||||||
Eolian_Value val = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
|
||||||
const char *ret = eolian_expression_value_to_literal(&val);
|
|
||||||
printf("%s", ret);
|
|
||||||
eina_stringshare_del(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
database_type_print(Eolian_Type *tp)
|
|
||||||
{
|
|
||||||
if (tp->type == EOLIAN_TYPE_ALIAS)
|
|
||||||
{
|
{
|
||||||
_typedef_print(tp);
|
Eina_List *m;
|
||||||
|
const char *sp;
|
||||||
|
EINA_LIST_FOREACH(tp->namespaces, m, sp)
|
||||||
|
{
|
||||||
|
eina_strbuf_append(buf, sp);
|
||||||
|
eina_strbuf_append_char(buf, '_');
|
||||||
|
}
|
||||||
|
eina_strbuf_append(buf, tp->name);
|
||||||
|
eina_strbuf_append_char(buf, ' ');
|
||||||
|
}
|
||||||
|
if (tp->type == EOLIAN_TYPEDECL_STRUCT_OPAQUE)
|
||||||
|
goto append_name;
|
||||||
|
eina_strbuf_append(buf, "{ ");
|
||||||
|
EINA_LIST_FOREACH(tp->field_list, l, sf)
|
||||||
|
{
|
||||||
|
database_type_to_str(sf->type, buf, sf->name);
|
||||||
|
eina_strbuf_append(buf, "; ");
|
||||||
|
}
|
||||||
|
eina_strbuf_append(buf, "}");
|
||||||
|
append_name:
|
||||||
|
if (name)
|
||||||
|
{
|
||||||
|
eina_strbuf_append_char(buf, ' ');
|
||||||
|
eina_strbuf_append(buf, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
||||||
|
{
|
||||||
|
Eolian_Enum_Type_Field *ef;
|
||||||
|
Eina_List *l;
|
||||||
|
eina_strbuf_append(buf, "enum ");
|
||||||
|
if (tp->name)
|
||||||
|
{
|
||||||
|
Eina_List *m;
|
||||||
|
const char *sp;
|
||||||
|
EINA_LIST_FOREACH(tp->namespaces, m, sp)
|
||||||
|
{
|
||||||
|
eina_strbuf_append(buf, sp);
|
||||||
|
eina_strbuf_append_char(buf, '_');
|
||||||
|
}
|
||||||
|
eina_strbuf_append(buf, tp->name);
|
||||||
|
eina_strbuf_append_char(buf, ' ');
|
||||||
|
}
|
||||||
|
eina_strbuf_append(buf, "{ ");
|
||||||
|
EINA_LIST_FOREACH(tp->field_list, l, ef)
|
||||||
|
{
|
||||||
|
eina_strbuf_append(buf, ef->name);
|
||||||
|
if (ef->value)
|
||||||
|
{
|
||||||
|
Eolian_Value val = eolian_expression_eval(ef->value,
|
||||||
|
EOLIAN_MASK_INT);
|
||||||
|
const char *ret;
|
||||||
|
eina_strbuf_append(buf, " = ");
|
||||||
|
ret = eolian_expression_value_to_literal(&val);
|
||||||
|
eina_strbuf_append(buf, ret);
|
||||||
|
eina_stringshare_del(ret);
|
||||||
|
}
|
||||||
|
if (l != eina_list_last(tp->field_list))
|
||||||
|
eina_strbuf_append(buf, ", ");
|
||||||
|
}
|
||||||
|
eina_strbuf_append(buf, " }");
|
||||||
|
if (name)
|
||||||
|
{
|
||||||
|
eina_strbuf_append_char(buf, ' ');
|
||||||
|
eina_strbuf_append(buf, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
|
||||||
|
{
|
||||||
|
Eina_Strbuf *fulln = eina_strbuf_new();
|
||||||
|
Eina_List *l;
|
||||||
|
const char *sp;
|
||||||
|
|
||||||
|
eina_strbuf_append(buf, "typedef ");
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(tp->namespaces, l, sp)
|
||||||
|
{
|
||||||
|
eina_strbuf_append(fulln, sp);
|
||||||
|
eina_strbuf_append_char(fulln, '_');
|
||||||
|
}
|
||||||
|
eina_strbuf_append(fulln, tp->name);
|
||||||
|
|
||||||
|
database_type_to_str(tp->base_type, buf, eina_strbuf_string_get(fulln));
|
||||||
|
eina_strbuf_free(fulln);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
||||||
|
{
|
||||||
|
if (tp->type == EOLIAN_TYPEDECL_ALIAS)
|
||||||
|
{
|
||||||
|
_atype_to_str(tp, buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tp->is_own)
|
else if (tp->type == EOLIAN_TYPEDECL_STRUCT
|
||||||
printf("own(");
|
|| tp->type == EOLIAN_TYPEDECL_STRUCT_OPAQUE)
|
||||||
if (tp->is_const)
|
|
||||||
printf("const(");
|
|
||||||
if (tp->type == EOLIAN_TYPE_REGULAR || tp->type == EOLIAN_TYPE_COMPLEX
|
|
||||||
|| tp->type == EOLIAN_TYPE_CLASS)
|
|
||||||
printf("%s", tp->full_name);
|
|
||||||
else if (tp->type == EOLIAN_TYPE_VOID)
|
|
||||||
printf("void");
|
|
||||||
else if (tp->type == EOLIAN_TYPE_STRUCT_OPAQUE)
|
|
||||||
printf("struct %s", tp->full_name);
|
|
||||||
else if (tp->type == EOLIAN_TYPE_POINTER)
|
|
||||||
{
|
{
|
||||||
database_type_print(tp->base_type);
|
_stype_to_str(tp, buf, name);
|
||||||
putchar('*');
|
return;
|
||||||
}
|
}
|
||||||
else if (tp->type == EOLIAN_TYPE_STRUCT)
|
else if (tp->type == EOLIAN_TYPEDECL_ENUM)
|
||||||
{
|
{
|
||||||
Eolian_Struct_Type_Field *sf;
|
_etype_to_str(tp, buf, name);
|
||||||
Eina_List *m;
|
return;
|
||||||
printf("struct ");
|
|
||||||
if (tp->full_name) printf("%s ", tp->full_name);
|
|
||||||
printf("{ ");
|
|
||||||
EINA_LIST_FOREACH(tp->field_list, m, sf)
|
|
||||||
{
|
|
||||||
printf("%s: ", sf->name);
|
|
||||||
database_type_print(sf->type);
|
|
||||||
printf("; ");
|
|
||||||
}
|
|
||||||
printf("}");
|
|
||||||
}
|
}
|
||||||
else if (tp->type == EOLIAN_TYPE_ENUM)
|
else
|
||||||
|
return;
|
||||||
|
if (name)
|
||||||
{
|
{
|
||||||
Eolian_Enum_Type_Field *ef;
|
eina_strbuf_append_char(buf, ' ');
|
||||||
Eina_List *m;
|
eina_strbuf_append(buf, name);
|
||||||
printf("enum %s ", tp->full_name);
|
|
||||||
printf("{ ");
|
|
||||||
EINA_LIST_FOREACH(tp->field_list, m, ef)
|
|
||||||
{
|
|
||||||
printf("%s", ef->name);
|
|
||||||
if (ef->value)
|
|
||||||
{
|
|
||||||
printf(" = ");
|
|
||||||
database_expr_print(ef->value);
|
|
||||||
}
|
|
||||||
if (m != eina_list_last(tp->field_list))
|
|
||||||
printf(", ");
|
|
||||||
}
|
|
||||||
printf(" }");
|
|
||||||
}
|
}
|
||||||
if (tp->is_own)
|
|
||||||
putchar(')');
|
|
||||||
if (tp->is_const)
|
|
||||||
putchar(')');
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,38 +6,41 @@
|
||||||
#include "eolian_database.h"
|
#include "eolian_database.h"
|
||||||
#include "eo_lexer.h"
|
#include "eo_lexer.h"
|
||||||
|
|
||||||
EAPI const Eolian_Type *
|
EAPI const Eolian_Typedecl *
|
||||||
eolian_type_alias_get_by_name(const char *name)
|
eolian_typedecl_alias_get_by_name(const char *name)
|
||||||
{
|
{
|
||||||
if (!_aliases) return NULL;
|
if (!_aliases) return NULL;
|
||||||
Eina_Stringshare *shr = eina_stringshare_add(name);
|
Eina_Stringshare *shr = eina_stringshare_add(name);
|
||||||
Eolian_Type *tp = eina_hash_find(_aliases, shr);
|
Eolian_Typedecl *tp = eina_hash_find(_aliases, shr);
|
||||||
eina_stringshare_del(shr);
|
eina_stringshare_del(shr);
|
||||||
|
if (!tp) return NULL;
|
||||||
return tp;
|
return tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Type *
|
EAPI const Eolian_Typedecl *
|
||||||
eolian_type_struct_get_by_name(const char *name)
|
eolian_typedecl_struct_get_by_name(const char *name)
|
||||||
{
|
{
|
||||||
if (!_structs) return NULL;
|
if (!_structs) return NULL;
|
||||||
Eina_Stringshare *shr = eina_stringshare_add(name);
|
Eina_Stringshare *shr = eina_stringshare_add(name);
|
||||||
Eolian_Type *tp = eina_hash_find(_structs, shr);
|
Eolian_Typedecl *tp = eina_hash_find(_structs, shr);
|
||||||
eina_stringshare_del(shr);
|
eina_stringshare_del(shr);
|
||||||
|
if (!tp) return NULL;
|
||||||
return tp;
|
return tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Type *
|
EAPI const Eolian_Typedecl *
|
||||||
eolian_type_enum_get_by_name(const char *name)
|
eolian_typedecl_enum_get_by_name(const char *name)
|
||||||
{
|
{
|
||||||
if (!_enums) return NULL;
|
if (!_enums) return NULL;
|
||||||
Eina_Stringshare *shr = eina_stringshare_add(name);
|
Eina_Stringshare *shr = eina_stringshare_add(name);
|
||||||
Eolian_Type *tp = eina_hash_find(_enums, shr);
|
Eolian_Typedecl *tp = eina_hash_find(_enums, shr);
|
||||||
eina_stringshare_del(shr);
|
eina_stringshare_del(shr);
|
||||||
|
if (!tp) return NULL;
|
||||||
return tp;
|
return tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Iterator *
|
EAPI Eina_Iterator *
|
||||||
eolian_type_aliases_get_by_file(const char *fname)
|
eolian_typedecl_aliases_get_by_file(const char *fname)
|
||||||
{
|
{
|
||||||
if (!_aliasesf) return NULL;
|
if (!_aliasesf) return NULL;
|
||||||
Eina_Stringshare *shr = eina_stringshare_add(fname);
|
Eina_Stringshare *shr = eina_stringshare_add(fname);
|
||||||
|
@ -48,7 +51,7 @@ eolian_type_aliases_get_by_file(const char *fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Iterator *
|
EAPI Eina_Iterator *
|
||||||
eolian_type_structs_get_by_file(const char *fname)
|
eolian_typedecl_structs_get_by_file(const char *fname)
|
||||||
{
|
{
|
||||||
if (!_structsf) return NULL;
|
if (!_structsf) return NULL;
|
||||||
Eina_Stringshare *shr = eina_stringshare_add(fname);
|
Eina_Stringshare *shr = eina_stringshare_add(fname);
|
||||||
|
@ -59,9 +62,9 @@ eolian_type_structs_get_by_file(const char *fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Iterator *
|
EAPI Eina_Iterator *
|
||||||
eolian_type_enums_get_by_file(const char *fname)
|
eolian_typedecl_enums_get_by_file(const char *fname)
|
||||||
{
|
{
|
||||||
if (!_structsf) return NULL;
|
if (!_enumsf) return NULL;
|
||||||
Eina_Stringshare *shr = eina_stringshare_add(fname);
|
Eina_Stringshare *shr = eina_stringshare_add(fname);
|
||||||
Eina_List *l = eina_hash_find(_enumsf, shr);
|
Eina_List *l = eina_hash_find(_enumsf, shr);
|
||||||
eina_stringshare_del(shr);
|
eina_stringshare_del(shr);
|
||||||
|
@ -76,6 +79,13 @@ eolian_type_type_get(const Eolian_Type *tp)
|
||||||
return tp->type;
|
return tp->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eolian_Typedecl_Type
|
||||||
|
eolian_typedecl_type_get(const Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EOLIAN_TYPEDECL_UNKNOWN);
|
||||||
|
return tp->type;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Iterator *
|
EAPI Eina_Iterator *
|
||||||
eolian_type_subtypes_get(const Eolian_Type *tp)
|
eolian_type_subtypes_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
|
@ -88,21 +98,21 @@ eolian_type_subtypes_get(const Eolian_Type *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Iterator *
|
EAPI Eina_Iterator *
|
||||||
eolian_type_struct_fields_get(const Eolian_Type *tp)
|
eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
if (tp->type != EOLIAN_TYPE_STRUCT)
|
if (tp->type != EOLIAN_TYPEDECL_STRUCT)
|
||||||
return NULL;
|
return NULL;
|
||||||
return eina_list_iterator_new(tp->field_list);
|
return eina_list_iterator_new(tp->field_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Struct_Type_Field *
|
EAPI const Eolian_Struct_Type_Field *
|
||||||
eolian_type_struct_field_get(const Eolian_Type *tp, const char *field)
|
eolian_typedecl_struct_field_get(const Eolian_Typedecl *tp, const char *field)
|
||||||
{
|
{
|
||||||
Eolian_Struct_Type_Field *sf = NULL;
|
Eolian_Struct_Type_Field *sf = NULL;
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(field, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(field, NULL);
|
||||||
if (tp->type != EOLIAN_TYPE_STRUCT)
|
if (tp->type != EOLIAN_TYPEDECL_STRUCT)
|
||||||
return NULL;
|
return NULL;
|
||||||
sf = eina_hash_find(tp->fields, field);
|
sf = eina_hash_find(tp->fields, field);
|
||||||
if (!sf) return NULL;
|
if (!sf) return NULL;
|
||||||
|
@ -110,42 +120,42 @@ eolian_type_struct_field_get(const Eolian_Type *tp, const char *field)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Stringshare *
|
EAPI Eina_Stringshare *
|
||||||
eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl)
|
eolian_typedecl_struct_field_name_get(const Eolian_Struct_Type_Field *fl)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
||||||
return fl->name;
|
return fl->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Documentation *
|
EAPI const Eolian_Documentation *
|
||||||
eolian_type_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl)
|
eolian_typedecl_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
||||||
return fl->doc;
|
return fl->doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Type *
|
EAPI const Eolian_Type *
|
||||||
eolian_type_struct_field_type_get(const Eolian_Struct_Type_Field *fl)
|
eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
||||||
return fl->type;
|
return fl->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Iterator *
|
EAPI Eina_Iterator *
|
||||||
eolian_type_enum_fields_get(const Eolian_Type *tp)
|
eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
if (tp->type != EOLIAN_TYPE_ENUM)
|
if (tp->type != EOLIAN_TYPEDECL_ENUM)
|
||||||
return NULL;
|
return NULL;
|
||||||
return eina_list_iterator_new(tp->field_list);
|
return eina_list_iterator_new(tp->field_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Enum_Type_Field *
|
EAPI const Eolian_Enum_Type_Field *
|
||||||
eolian_type_enum_field_get(const Eolian_Type *tp, const char *field)
|
eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field)
|
||||||
{
|
{
|
||||||
Eolian_Enum_Type_Field *ef = NULL;
|
Eolian_Enum_Type_Field *ef = NULL;
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(field, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(field, NULL);
|
||||||
if (tp->type != EOLIAN_TYPE_ENUM)
|
if (tp->type != EOLIAN_TYPEDECL_ENUM)
|
||||||
return NULL;
|
return NULL;
|
||||||
ef = eina_hash_find(tp->fields, field);
|
ef = eina_hash_find(tp->fields, field);
|
||||||
if (!ef) return NULL;
|
if (!ef) return NULL;
|
||||||
|
@ -153,14 +163,14 @@ eolian_type_enum_field_get(const Eolian_Type *tp, const char *field)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Stringshare *
|
EAPI Eina_Stringshare *
|
||||||
eolian_type_enum_field_name_get(const Eolian_Enum_Type_Field *fl)
|
eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *fl)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
||||||
return fl->name;
|
return fl->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Stringshare *
|
EAPI Eina_Stringshare *
|
||||||
eolian_type_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl)
|
eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl)
|
||||||
{
|
{
|
||||||
Eina_Stringshare *ret;
|
Eina_Stringshare *ret;
|
||||||
Eina_Strbuf *buf;
|
Eina_Strbuf *buf;
|
||||||
|
@ -183,14 +193,14 @@ eolian_type_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Documentation *
|
EAPI const Eolian_Documentation *
|
||||||
eolian_type_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl)
|
eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
||||||
return fl->doc;
|
return fl->doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Expression *
|
EAPI const Eolian_Expression *
|
||||||
eolian_type_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force)
|
eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
|
||||||
if (!force && !fl->is_public_value) return NULL;
|
if (!force && !fl->is_public_value) return NULL;
|
||||||
|
@ -198,16 +208,16 @@ eolian_type_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool for
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Stringshare *
|
EAPI Eina_Stringshare *
|
||||||
eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp)
|
eolian_typedecl_enum_legacy_prefix_get(const Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
if (tp->type != EOLIAN_TYPE_ENUM)
|
if (tp->type != EOLIAN_TYPEDECL_ENUM)
|
||||||
return NULL;
|
return NULL;
|
||||||
return tp->legacy;
|
return tp->legacy;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Documentation *
|
EAPI const Eolian_Documentation *
|
||||||
eolian_type_documentation_get(const Eolian_Type *tp)
|
eolian_typedecl_documentation_get(const Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
return tp->doc;
|
return tp->doc;
|
||||||
|
@ -220,48 +230,63 @@ eolian_type_file_get(const Eolian_Type *tp)
|
||||||
return tp->base.file;
|
return tp->base.file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Stringshare *
|
||||||
|
eolian_typedecl_file_get(const Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
|
return tp->base.file;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Type *
|
EAPI const Eolian_Type *
|
||||||
eolian_type_base_type_get(const Eolian_Type *tp)
|
eolian_type_base_type_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
Eolian_Type_Type tpt;
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
tpt = eolian_type_type_get(tp);
|
return tp->base_type;
|
||||||
if ((tpt != EOLIAN_TYPE_POINTER) && (tpt != EOLIAN_TYPE_ALIAS) &&
|
}
|
||||||
(tpt != EOLIAN_TYPE_REGULAR))
|
|
||||||
|
EAPI const Eolian_Typedecl *
|
||||||
|
eolian_type_typedecl_get(const Eolian_Type *tp)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
|
if (eolian_type_type_get(tp) != EOLIAN_TYPE_REGULAR)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (tpt == EOLIAN_TYPE_REGULAR)
|
/* try looking up if it belongs to a struct, enum or an alias... otherwise
|
||||||
|
* return NULL, but first check for builtins
|
||||||
|
*/
|
||||||
|
int kw = eo_lexer_keyword_str_to_id(tp->full_name);
|
||||||
|
if (!kw || kw < KW_byte || kw >= KW_true)
|
||||||
{
|
{
|
||||||
/* for regular types, try looking up if it belongs to a struct,
|
Eolian_Declaration *decl = eina_hash_find(_decls, tp->full_name);
|
||||||
* enum or an alias... otherwise return NULL
|
if (decl && decl->type != EOLIAN_DECL_CLASS
|
||||||
* but first check for builtins
|
&& decl->type != EOLIAN_DECL_VAR)
|
||||||
*/
|
return decl->data;
|
||||||
int kw = eo_lexer_keyword_str_to_id(tp->full_name);
|
|
||||||
if (!kw || kw < KW_byte || kw >= KW_true)
|
|
||||||
{
|
|
||||||
Eolian_Declaration *decl = eina_hash_find(_decls, tp->full_name);
|
|
||||||
if (decl && decl->type != EOLIAN_DECL_CLASS
|
|
||||||
&& decl->type != EOLIAN_DECL_VAR)
|
|
||||||
return decl->data;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI const Eolian_Type *
|
||||||
|
eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
return tp->base_type;
|
return tp->base_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Type *
|
EAPI const Eolian_Type *
|
||||||
eolian_type_aliased_base_get(const Eolian_Type *tp)
|
eolian_type_aliased_base_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
if (!tp)
|
if (!tp || tp->type != EOLIAN_TYPE_REGULAR)
|
||||||
return NULL;
|
|
||||||
if (eolian_type_type_get(tp) == EOLIAN_TYPE_REGULAR)
|
|
||||||
{
|
|
||||||
const Eolian_Type *btp = eolian_type_base_type_get(tp);
|
|
||||||
if (btp && (eolian_type_type_get(btp) == EOLIAN_TYPE_ALIAS))
|
|
||||||
return eolian_type_aliased_base_get(btp);
|
|
||||||
return tp;
|
|
||||||
}
|
|
||||||
else if (eolian_type_type_get(tp) != EOLIAN_TYPE_ALIAS)
|
|
||||||
return tp;
|
return tp;
|
||||||
|
const Eolian_Typedecl *btp = eolian_type_typedecl_get(tp);
|
||||||
|
if (btp && (btp->type == EOLIAN_TYPEDECL_ALIAS))
|
||||||
|
return eolian_typedecl_aliased_base_get(btp);
|
||||||
|
return tp;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI const Eolian_Type *
|
||||||
|
eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
if (!tp || tp->type != EOLIAN_TYPEDECL_ALIAS)
|
||||||
|
return NULL;
|
||||||
return eolian_type_aliased_base_get(tp->base_type);
|
return eolian_type_aliased_base_get(tp->base_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +314,7 @@ eolian_type_is_const(const Eolian_Type *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eolian_type_is_extern(const Eolian_Type *tp)
|
eolian_typedecl_is_extern(const Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
|
||||||
return tp->is_extern;
|
return tp->is_extern;
|
||||||
|
@ -308,12 +333,31 @@ eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Stringshare *
|
||||||
|
eolian_typedecl_c_type_named_get(const Eolian_Typedecl *tp, const char *name)
|
||||||
|
{
|
||||||
|
Eina_Stringshare *ret;
|
||||||
|
Eina_Strbuf *buf;
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
|
buf = eina_strbuf_new();
|
||||||
|
database_typedecl_to_str(tp, buf, name);
|
||||||
|
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||||
|
eina_strbuf_free(buf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Stringshare *
|
EAPI Eina_Stringshare *
|
||||||
eolian_type_c_type_get(const Eolian_Type *tp)
|
eolian_type_c_type_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
return eolian_type_c_type_named_get(tp, NULL);
|
return eolian_type_c_type_named_get(tp, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Stringshare *
|
||||||
|
eolian_typedecl_c_type_get(const Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
return eolian_typedecl_c_type_named_get(tp, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Stringshare *
|
EAPI Eina_Stringshare *
|
||||||
eolian_type_name_get(const Eolian_Type *tp)
|
eolian_type_name_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
|
@ -321,6 +365,13 @@ eolian_type_name_get(const Eolian_Type *tp)
|
||||||
return tp->name;
|
return tp->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Stringshare *
|
||||||
|
eolian_typedecl_name_get(const Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
|
return tp->name;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Stringshare *
|
EAPI Eina_Stringshare *
|
||||||
eolian_type_full_name_get(const Eolian_Type *tp)
|
eolian_type_full_name_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
|
@ -328,6 +379,13 @@ eolian_type_full_name_get(const Eolian_Type *tp)
|
||||||
return tp->full_name;
|
return tp->full_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Stringshare *
|
||||||
|
eolian_typedecl_full_name_get(const Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
|
return tp->full_name;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Iterator *
|
EAPI Eina_Iterator *
|
||||||
eolian_type_namespaces_get(const Eolian_Type *tp)
|
eolian_type_namespaces_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
|
@ -336,9 +394,24 @@ eolian_type_namespaces_get(const Eolian_Type *tp)
|
||||||
return eina_list_iterator_new(tp->namespaces);
|
return eina_list_iterator_new(tp->namespaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Iterator *
|
||||||
|
eolian_typedecl_namespaces_get(const Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
|
if (!tp->namespaces) return NULL;
|
||||||
|
return eina_list_iterator_new(tp->namespaces);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Stringshare *
|
EAPI Eina_Stringshare *
|
||||||
eolian_type_free_func_get(const Eolian_Type *tp)
|
eolian_type_free_func_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
return tp->freefunc;
|
return tp->freefunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Stringshare *
|
||||||
|
eolian_typedecl_free_func_get(const Eolian_Typedecl *tp)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
|
return tp->freefunc;
|
||||||
|
}
|
||||||
|
|
|
@ -27,20 +27,20 @@ _validate_ref(const Validator *vs EINA_UNUSED, const char *ref,
|
||||||
|
|
||||||
Eina_Stringshare *base = eina_stringshare_add_length(ref, suffix - ref);
|
Eina_Stringshare *base = eina_stringshare_add_length(ref, suffix - ref);
|
||||||
|
|
||||||
const Eolian_Type *tp = eolian_type_struct_get_by_name(base);
|
const Eolian_Typedecl *tpd = eolian_typedecl_struct_get_by_name(base);
|
||||||
if (tp)
|
if (tpd)
|
||||||
{
|
{
|
||||||
eina_stringshare_del(base);
|
eina_stringshare_del(base);
|
||||||
if (!eolian_type_struct_field_get(tp, suffix + 1))
|
if (!eolian_typedecl_struct_field_get(tpd, suffix + 1))
|
||||||
goto failed;
|
goto failed;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tp = eolian_type_enum_get_by_name(base);
|
tpd = eolian_typedecl_enum_get_by_name(base);
|
||||||
if (tp)
|
if (tpd)
|
||||||
{
|
{
|
||||||
eina_stringshare_del(base);
|
eina_stringshare_del(base);
|
||||||
if (!eolian_type_enum_field_get(tp, suffix + 1))
|
if (!eolian_typedecl_enum_field_get(tpd, suffix + 1))
|
||||||
goto failed;
|
goto failed;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -189,11 +189,42 @@ _type_error(const Validator *vs, const Eolian_Type *tp, const char *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_validate_type(const Validator *vs, const Eolian_Type *tp)
|
_validate_typedecl(const Validator *vs, const Eolian_Typedecl *tp)
|
||||||
{
|
{
|
||||||
if (!_validate_doc(vs, tp->doc))
|
if (!_validate_doc(vs, tp->doc))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
switch (tp->type)
|
||||||
|
{
|
||||||
|
case EOLIAN_TYPEDECL_ALIAS:
|
||||||
|
return _validate_type(vs, tp->base_type);
|
||||||
|
case EOLIAN_TYPEDECL_STRUCT:
|
||||||
|
{
|
||||||
|
Val_Success succ;
|
||||||
|
succ.vs = vs;
|
||||||
|
succ.success = EINA_TRUE;
|
||||||
|
eina_hash_foreach(tp->fields, (Eina_Hash_Foreach)_sf_map_cb, &succ);
|
||||||
|
return succ.success;
|
||||||
|
}
|
||||||
|
case EOLIAN_TYPEDECL_STRUCT_OPAQUE:
|
||||||
|
return EINA_TRUE;
|
||||||
|
case EOLIAN_TYPEDECL_ENUM:
|
||||||
|
{
|
||||||
|
Val_Success succ;
|
||||||
|
succ.vs = vs;
|
||||||
|
succ.success = EINA_TRUE;
|
||||||
|
eina_hash_foreach(tp->fields, (Eina_Hash_Foreach)_ef_map_cb, &succ);
|
||||||
|
return succ.success;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_validate_type(const Validator *vs, const Eolian_Type *tp)
|
||||||
|
{
|
||||||
switch (tp->type)
|
switch (tp->type)
|
||||||
{
|
{
|
||||||
case EOLIAN_TYPE_VOID:
|
case EOLIAN_TYPE_VOID:
|
||||||
|
@ -202,42 +233,23 @@ _validate_type(const Validator *vs, const Eolian_Type *tp)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
case EOLIAN_TYPE_REGULAR:
|
case EOLIAN_TYPE_REGULAR:
|
||||||
{
|
{
|
||||||
const Eolian_Type *tpp;
|
const Eolian_Typedecl *tpp;
|
||||||
/* builtins */
|
/* builtins */
|
||||||
int id = eo_lexer_keyword_str_to_id(tp->full_name);
|
int id = eo_lexer_keyword_str_to_id(tp->full_name);
|
||||||
if (id)
|
if (id)
|
||||||
return eo_lexer_is_type_keyword(id);
|
return eo_lexer_is_type_keyword(id);
|
||||||
/* user defined */
|
/* user defined */
|
||||||
tpp = eolian_type_base_type_get(tp);
|
tpp = eolian_type_typedecl_get(tp);
|
||||||
if (!tpp)
|
if (!tpp)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name);
|
snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name);
|
||||||
return _type_error(vs, tp, buf);
|
return _type_error(vs, tp, buf);
|
||||||
}
|
}
|
||||||
return _validate_type(vs, tpp);
|
return _validate_typedecl(vs, tpp);
|
||||||
}
|
}
|
||||||
case EOLIAN_TYPE_POINTER:
|
case EOLIAN_TYPE_POINTER:
|
||||||
case EOLIAN_TYPE_ALIAS:
|
|
||||||
return _validate_type(vs, tp->base_type);
|
return _validate_type(vs, tp->base_type);
|
||||||
case EOLIAN_TYPE_STRUCT:
|
|
||||||
{
|
|
||||||
Val_Success succ;
|
|
||||||
succ.vs = vs;
|
|
||||||
succ.success = EINA_TRUE;
|
|
||||||
eina_hash_foreach(tp->fields, (Eina_Hash_Foreach)_sf_map_cb, &succ);
|
|
||||||
return succ.success;
|
|
||||||
}
|
|
||||||
case EOLIAN_TYPE_STRUCT_OPAQUE:
|
|
||||||
return EINA_TRUE;
|
|
||||||
case EOLIAN_TYPE_ENUM:
|
|
||||||
{
|
|
||||||
Val_Success succ;
|
|
||||||
succ.vs = vs;
|
|
||||||
succ.success = EINA_TRUE;
|
|
||||||
eina_hash_foreach(tp->fields, (Eina_Hash_Foreach)_ef_map_cb, &succ);
|
|
||||||
return succ.success;
|
|
||||||
}
|
|
||||||
case EOLIAN_TYPE_CLASS:
|
case EOLIAN_TYPE_CLASS:
|
||||||
{
|
{
|
||||||
if (!eolian_type_class_get(tp))
|
if (!eolian_type_class_get(tp))
|
||||||
|
@ -388,10 +400,10 @@ _validate_variable(const Validator *vs, const Eolian_Variable *var)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_type_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
|
_typedecl_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
|
||||||
const Eolian_Type *tp, Val_Success *sc)
|
const Eolian_Typedecl *tp, Val_Success *sc)
|
||||||
{
|
{
|
||||||
sc->success = _validate_type(sc->vs, tp);
|
sc->success = _validate_typedecl(sc->vs, tp);
|
||||||
return sc->success;
|
return sc->success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,15 +436,15 @@ database_validate(Eina_Bool silent_types)
|
||||||
succ.vs = &vs;
|
succ.vs = &vs;
|
||||||
succ.success = EINA_TRUE;
|
succ.success = EINA_TRUE;
|
||||||
|
|
||||||
eina_hash_foreach(_aliases, (Eina_Hash_Foreach)_type_map_cb, &succ);
|
eina_hash_foreach(_aliases, (Eina_Hash_Foreach)_typedecl_map_cb, &succ);
|
||||||
if (!succ.success)
|
if (!succ.success)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
eina_hash_foreach(_structs, (Eina_Hash_Foreach)_type_map_cb, &succ);
|
eina_hash_foreach(_structs, (Eina_Hash_Foreach)_typedecl_map_cb, &succ);
|
||||||
if (!succ.success)
|
if (!succ.success)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
eina_hash_foreach(_enums, (Eina_Hash_Foreach)_type_map_cb, &succ);
|
eina_hash_foreach(_enums, (Eina_Hash_Foreach)_typedecl_map_cb, &succ);
|
||||||
if (!succ.success)
|
if (!succ.success)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1015,6 +1015,7 @@ _temps_free(Eo_Lexer_Temps *tmp)
|
||||||
{
|
{
|
||||||
Eina_Strbuf *buf;
|
Eina_Strbuf *buf;
|
||||||
Eolian_Type *tp;
|
Eolian_Type *tp;
|
||||||
|
Eolian_Typedecl *tpd;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
if (tmp->kls)
|
if (tmp->kls)
|
||||||
|
@ -1027,10 +1028,10 @@ _temps_free(Eo_Lexer_Temps *tmp)
|
||||||
eina_strbuf_free(buf);
|
eina_strbuf_free(buf);
|
||||||
|
|
||||||
EINA_LIST_FREE(tmp->type_defs, tp)
|
EINA_LIST_FREE(tmp->type_defs, tp)
|
||||||
if (tp->type == EOLIAN_TYPE_ALIAS)
|
database_type_del(tp);
|
||||||
database_typedef_del(tp);
|
|
||||||
else
|
EINA_LIST_FREE(tmp->type_decls, tpd)
|
||||||
database_type_del(tp);
|
database_typedecl_del(tpd);
|
||||||
|
|
||||||
EINA_LIST_FREE(tmp->strs, s)
|
EINA_LIST_FREE(tmp->strs, s)
|
||||||
if (s) eina_stringshare_del(s);
|
if (s) eina_stringshare_del(s);
|
||||||
|
|
|
@ -118,6 +118,7 @@ typedef struct _Eo_Lexer_Temps
|
||||||
Eolian_Variable *var;
|
Eolian_Variable *var;
|
||||||
Eina_List *str_bufs;
|
Eina_List *str_bufs;
|
||||||
Eina_List *type_defs;
|
Eina_List *type_defs;
|
||||||
|
Eina_List *type_decls;
|
||||||
Eina_List *expr_defs;
|
Eina_List *expr_defs;
|
||||||
Eina_List *strs;
|
Eina_List *strs;
|
||||||
} Eo_Lexer_Temps;
|
} Eo_Lexer_Temps;
|
||||||
|
|
|
@ -117,12 +117,26 @@ push_type(Eo_Lexer *ls)
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eolian_Typedecl *
|
||||||
|
push_typedecl(Eo_Lexer *ls)
|
||||||
|
{
|
||||||
|
Eolian_Typedecl *def = calloc(1, sizeof(Eolian_Typedecl));
|
||||||
|
ls->tmp.type_decls = eina_list_prepend(ls->tmp.type_decls, def);
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pop_type(Eo_Lexer *ls)
|
pop_type(Eo_Lexer *ls)
|
||||||
{
|
{
|
||||||
ls->tmp.type_defs = eina_list_remove_list(ls->tmp.type_defs, ls->tmp.type_defs);
|
ls->tmp.type_defs = eina_list_remove_list(ls->tmp.type_defs, ls->tmp.type_defs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pop_typedecl(Eo_Lexer *ls)
|
||||||
|
{
|
||||||
|
ls->tmp.type_decls = eina_list_remove_list(ls->tmp.type_decls, ls->tmp.type_decls);
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Stringshare *
|
static Eina_Stringshare *
|
||||||
push_str(Eo_Lexer *ls, const char *val)
|
push_str(Eo_Lexer *ls, const char *val)
|
||||||
{
|
{
|
||||||
|
@ -471,15 +485,15 @@ _struct_field_free(Eolian_Struct_Type_Field *def)
|
||||||
free(def);
|
free(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eolian_Type *
|
static Eolian_Typedecl *
|
||||||
parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
|
parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
|
||||||
int line, int column, const char *freefunc)
|
int line, int column, const char *freefunc)
|
||||||
{
|
{
|
||||||
int bline = ls->line_number, bcolumn = ls->column;
|
int bline = ls->line_number, bcolumn = ls->column;
|
||||||
Eolian_Type *def = push_type(ls);
|
Eolian_Typedecl *def = push_typedecl(ls);
|
||||||
def->is_extern = is_extern;
|
def->is_extern = is_extern;
|
||||||
if (name) _fill_name(name, &def->full_name, &def->name, &def->namespaces);
|
if (name) _fill_name(name, &def->full_name, &def->name, &def->namespaces);
|
||||||
def->type = EOLIAN_TYPE_STRUCT;
|
def->type = EOLIAN_TYPEDECL_STRUCT;
|
||||||
def->fields = eina_hash_string_small_new(EINA_FREE_CB(_struct_field_free));
|
def->fields = eina_hash_string_small_new(EINA_FREE_CB(_struct_field_free));
|
||||||
def->freefunc = freefunc;
|
def->freefunc = freefunc;
|
||||||
pop_str(ls);
|
pop_str(ls);
|
||||||
|
@ -524,15 +538,15 @@ _enum_field_free(Eolian_Enum_Type_Field *def)
|
||||||
free(def);
|
free(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eolian_Type *
|
static Eolian_Typedecl *
|
||||||
parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
|
parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
|
||||||
int line, int column)
|
int line, int column)
|
||||||
{
|
{
|
||||||
int bline = ls->line_number, bcolumn = ls->column;
|
int bline = ls->line_number, bcolumn = ls->column;
|
||||||
Eolian_Type *def = push_type(ls);
|
Eolian_Typedecl *def = push_typedecl(ls);
|
||||||
def->is_extern = is_extern;
|
def->is_extern = is_extern;
|
||||||
_fill_name(name, &def->full_name, &def->name, &def->namespaces);
|
_fill_name(name, &def->full_name, &def->name, &def->namespaces);
|
||||||
def->type = EOLIAN_TYPE_ENUM;
|
def->type = EOLIAN_TYPEDECL_ENUM;
|
||||||
def->fields = eina_hash_string_small_new(EINA_FREE_CB(_enum_field_free));
|
def->fields = eina_hash_string_small_new(EINA_FREE_CB(_enum_field_free));
|
||||||
check_next(ls, '{');
|
check_next(ls, '{');
|
||||||
FILL_DOC(ls, def, doc);
|
FILL_DOC(ls, def, doc);
|
||||||
|
@ -843,11 +857,11 @@ parse_type_void(Eo_Lexer *ls)
|
||||||
return parse_type_void_base(ls, EINA_FALSE);
|
return parse_type_void_base(ls, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eolian_Type *
|
static Eolian_Typedecl *
|
||||||
parse_typedef(Eo_Lexer *ls)
|
parse_typedef(Eo_Lexer *ls)
|
||||||
{
|
{
|
||||||
Eolian_Declaration *decl;
|
Eolian_Declaration *decl;
|
||||||
Eolian_Type *def = push_type(ls);
|
Eolian_Typedecl *def = push_typedecl(ls);
|
||||||
Eina_Bool has_extern;
|
Eina_Bool has_extern;
|
||||||
const char *freefunc;
|
const char *freefunc;
|
||||||
Eina_Strbuf *buf;
|
Eina_Strbuf *buf;
|
||||||
|
@ -855,7 +869,7 @@ parse_typedef(Eo_Lexer *ls)
|
||||||
parse_struct_attrs(ls, EINA_FALSE, &has_extern, &freefunc);
|
parse_struct_attrs(ls, EINA_FALSE, &has_extern, &freefunc);
|
||||||
def->freefunc = freefunc;
|
def->freefunc = freefunc;
|
||||||
pop_str(ls);
|
pop_str(ls);
|
||||||
def->type = EOLIAN_TYPE_ALIAS;
|
def->type = EOLIAN_TYPEDECL_ALIAS;
|
||||||
def->is_extern = has_extern;
|
def->is_extern = has_extern;
|
||||||
buf = push_strbuf(ls);
|
buf = push_strbuf(ls);
|
||||||
eo_lexer_context_push(ls);
|
eo_lexer_context_push(ls);
|
||||||
|
@ -1856,7 +1870,7 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
|
||||||
case KW_type:
|
case KW_type:
|
||||||
{
|
{
|
||||||
database_type_add(parse_typedef(ls));
|
database_type_add(parse_typedef(ls));
|
||||||
pop_type(ls);
|
pop_typedecl(ls);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case KW_const:
|
case KW_const:
|
||||||
|
@ -1895,9 +1909,9 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
|
||||||
pop_strbuf(ls);
|
pop_strbuf(ls);
|
||||||
if (!is_enum && ls->t.token == ';')
|
if (!is_enum && ls->t.token == ';')
|
||||||
{
|
{
|
||||||
Eolian_Type *def = push_type(ls);
|
Eolian_Typedecl *def = push_typedecl(ls);
|
||||||
def->is_extern = has_extern;
|
def->is_extern = has_extern;
|
||||||
def->type = EOLIAN_TYPE_STRUCT_OPAQUE;
|
def->type = EOLIAN_TYPEDECL_STRUCT_OPAQUE;
|
||||||
def->freefunc = freefunc;
|
def->freefunc = freefunc;
|
||||||
pop_str(ls);
|
pop_str(ls);
|
||||||
_fill_name(name, &def->full_name, &def->name, &def->namespaces);
|
_fill_name(name, &def->full_name, &def->name, &def->namespaces);
|
||||||
|
@ -1905,14 +1919,14 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
|
||||||
FILL_DOC(ls, def, doc);
|
FILL_DOC(ls, def, doc);
|
||||||
FILL_BASE(def->base, ls, line, col);
|
FILL_BASE(def->base, ls, line, col);
|
||||||
database_struct_add(def);
|
database_struct_add(def);
|
||||||
pop_type(ls);
|
pop_typedecl(ls);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (is_enum)
|
if (is_enum)
|
||||||
parse_enum(ls, name, has_extern, line, col);
|
parse_enum(ls, name, has_extern, line, col);
|
||||||
else
|
else
|
||||||
parse_struct(ls, name, has_extern, line, col, freefunc);
|
parse_struct(ls, name, has_extern, line, col, freefunc);
|
||||||
pop_type(ls);
|
pop_typedecl(ls);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
def:
|
def:
|
||||||
|
|
|
@ -43,9 +43,9 @@ database_init()
|
||||||
if (_database_init_count > 0) return ++_database_init_count;
|
if (_database_init_count > 0) return ++_database_init_count;
|
||||||
eina_init();
|
eina_init();
|
||||||
_classes = eina_hash_stringshared_new(EINA_FREE_CB(database_class_del));
|
_classes = eina_hash_stringshared_new(EINA_FREE_CB(database_class_del));
|
||||||
_aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedef_del));
|
_aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
|
||||||
_structs = eina_hash_stringshared_new(EINA_FREE_CB(database_type_del));
|
_structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
|
||||||
_enums = eina_hash_stringshared_new(EINA_FREE_CB(database_type_del));
|
_enums = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
|
||||||
_globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
|
_globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
|
||||||
_constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
|
_constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
|
||||||
_classesf = eina_hash_stringshared_new(NULL);
|
_classesf = eina_hash_stringshared_new(NULL);
|
||||||
|
@ -156,14 +156,14 @@ eolian_declaration_class_get(const Eolian_Declaration *decl)
|
||||||
return (const Eolian_Class *)decl->data;
|
return (const Eolian_Class *)decl->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Type *
|
EAPI const Eolian_Typedecl *
|
||||||
eolian_declaration_data_type_get(const Eolian_Declaration *decl)
|
eolian_declaration_data_type_get(const Eolian_Declaration *decl)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(decl, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(decl, NULL);
|
||||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(decl->type == EOLIAN_DECL_ALIAS ||
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(decl->type == EOLIAN_DECL_ALIAS ||
|
||||||
decl->type == EOLIAN_DECL_STRUCT ||
|
decl->type == EOLIAN_DECL_STRUCT ||
|
||||||
decl->type == EOLIAN_DECL_ENUM, NULL);
|
decl->type == EOLIAN_DECL_ENUM, NULL);
|
||||||
return (const Eolian_Type *)decl->data;
|
return (const Eolian_Typedecl *)decl->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -170,13 +170,24 @@ struct _Eolian_Type
|
||||||
Eina_Stringshare *name;
|
Eina_Stringshare *name;
|
||||||
Eina_Stringshare *full_name;
|
Eina_Stringshare *full_name;
|
||||||
Eina_List *namespaces;
|
Eina_List *namespaces;
|
||||||
|
Eina_Stringshare *freefunc;
|
||||||
|
Eina_Bool is_const :1;
|
||||||
|
Eina_Bool is_own :1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Eolian_Typedecl
|
||||||
|
{
|
||||||
|
Eolian_Object base;
|
||||||
|
Eolian_Typedecl_Type type;
|
||||||
|
Eolian_Type *base_type;
|
||||||
|
Eina_Stringshare *name;
|
||||||
|
Eina_Stringshare *full_name;
|
||||||
|
Eina_List *namespaces;
|
||||||
Eina_Hash *fields;
|
Eina_Hash *fields;
|
||||||
Eina_List *field_list;
|
Eina_List *field_list;
|
||||||
Eolian_Documentation *doc;
|
Eolian_Documentation *doc;
|
||||||
Eina_Stringshare *legacy;
|
Eina_Stringshare *legacy;
|
||||||
Eina_Stringshare *freefunc;
|
Eina_Stringshare *freefunc;
|
||||||
Eina_Bool is_const :1;
|
|
||||||
Eina_Bool is_own :1;
|
|
||||||
Eina_Bool is_extern :1;
|
Eina_Bool is_extern :1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -223,7 +234,7 @@ struct _Eolian_Struct_Type_Field
|
||||||
|
|
||||||
struct _Eolian_Enum_Type_Field
|
struct _Eolian_Enum_Type_Field
|
||||||
{
|
{
|
||||||
Eolian_Type *base_enum;
|
Eolian_Typedecl *base_enum;
|
||||||
Eina_Stringshare *name;
|
Eina_Stringshare *name;
|
||||||
Eolian_Object base;
|
Eolian_Object base;
|
||||||
Eolian_Expression *value;
|
Eolian_Expression *value;
|
||||||
|
@ -281,14 +292,14 @@ void database_doc_del(Eolian_Documentation *doc);
|
||||||
|
|
||||||
/* types */
|
/* types */
|
||||||
|
|
||||||
void database_type_add(Eolian_Type *def);
|
void database_type_add(Eolian_Typedecl *def);
|
||||||
void database_struct_add(Eolian_Type *tp);
|
void database_struct_add(Eolian_Typedecl *tp);
|
||||||
void database_enum_add(Eolian_Type *tp);
|
void database_enum_add(Eolian_Typedecl *tp);
|
||||||
void database_type_del(Eolian_Type *tp);
|
void database_type_del(Eolian_Type *tp);
|
||||||
void database_typedef_del(Eolian_Type *tp);
|
void database_typedecl_del(Eolian_Typedecl *tp);
|
||||||
|
|
||||||
void database_type_print(Eolian_Type *type);
|
|
||||||
void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name);
|
void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name);
|
||||||
|
void database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name);
|
||||||
|
|
||||||
/* expressions */
|
/* expressions */
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,8 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(eolian_typedef)
|
START_TEST(eolian_typedef)
|
||||||
{
|
{
|
||||||
const Eolian_Type *atype = NULL, *type = NULL;
|
const Eolian_Type *type = NULL;
|
||||||
|
const Eolian_Typedecl *tdl = NULL;
|
||||||
const char *type_name = NULL;
|
const char *type_name = NULL;
|
||||||
Eina_Iterator *iter = NULL;
|
Eina_Iterator *iter = NULL;
|
||||||
const Eolian_Class *class;
|
const Eolian_Class *class;
|
||||||
|
@ -361,14 +362,14 @@ START_TEST(eolian_typedef)
|
||||||
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
||||||
|
|
||||||
/* Basic type */
|
/* Basic type */
|
||||||
fail_if(!(atype = eolian_type_alias_get_by_name("Evas.Coord")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Evas.Coord")));
|
||||||
fail_if(eolian_type_type_get(atype) != EOLIAN_TYPE_ALIAS);
|
fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_ALIAS);
|
||||||
fail_if(!(type_name = eolian_type_name_get(atype)));
|
fail_if(!(type_name = eolian_typedecl_name_get(tdl)));
|
||||||
fail_if(strcmp(type_name, "Coord"));
|
fail_if(strcmp(type_name, "Coord"));
|
||||||
fail_if(!(type_name = eolian_type_c_type_get(atype)));
|
fail_if(!(type_name = eolian_typedecl_c_type_get(tdl)));
|
||||||
fail_if(strcmp(type_name, "typedef int Evas_Coord"));
|
fail_if(strcmp(type_name, "typedef int Evas_Coord"));
|
||||||
eina_stringshare_del(type_name);
|
eina_stringshare_del(type_name);
|
||||||
fail_if(!(type = eolian_type_base_type_get(atype)));
|
fail_if(!(type = eolian_typedecl_base_type_get(tdl)));
|
||||||
fail_if(!(type_name = eolian_type_name_get(type)));
|
fail_if(!(type_name = eolian_type_name_get(type)));
|
||||||
fail_if(eolian_type_is_own(type));
|
fail_if(eolian_type_is_own(type));
|
||||||
fail_if(eolian_type_is_const(type));
|
fail_if(eolian_type_is_const(type));
|
||||||
|
@ -376,19 +377,19 @@ START_TEST(eolian_typedef)
|
||||||
fail_if(strcmp(type_name, "int"));
|
fail_if(strcmp(type_name, "int"));
|
||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
fail_if(!(file = eolian_type_file_get(atype)));
|
fail_if(!(file = eolian_typedecl_file_get(tdl)));
|
||||||
fail_if(strcmp(file, "typedef.eo"));
|
fail_if(strcmp(file, "typedef.eo"));
|
||||||
|
|
||||||
/* Lowest alias base */
|
/* Lowest alias base */
|
||||||
fail_if(!(atype = eolian_type_alias_get_by_name("Evas.Coord3")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Evas.Coord3")));
|
||||||
fail_if(!(atype = eolian_type_aliased_base_get(atype)));
|
fail_if(!(type = eolian_typedecl_aliased_base_get(tdl)));
|
||||||
fail_if(strcmp(eolian_type_name_get(atype), "int"));
|
fail_if(strcmp(eolian_type_name_get(type), "int"));
|
||||||
|
|
||||||
/* Complex type */
|
/* Complex type */
|
||||||
fail_if(!(atype = eolian_type_alias_get_by_name("List_Objects")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("List_Objects")));
|
||||||
fail_if(!(type_name = eolian_type_name_get(atype)));
|
fail_if(!(type_name = eolian_typedecl_name_get(tdl)));
|
||||||
fail_if(strcmp(type_name, "List_Objects"));
|
fail_if(strcmp(type_name, "List_Objects"));
|
||||||
fail_if(!(type = eolian_type_base_type_get(atype)));
|
fail_if(!(type = eolian_typedecl_base_type_get(tdl)));
|
||||||
fail_if(!(type_name = eolian_type_c_type_get(type)));
|
fail_if(!(type_name = eolian_type_c_type_get(type)));
|
||||||
fail_if(!eolian_type_is_own(type));
|
fail_if(!eolian_type_is_own(type));
|
||||||
fail_if(strcmp(type_name, "Eina_List *"));
|
fail_if(strcmp(type_name, "Eina_List *"));
|
||||||
|
@ -403,21 +404,21 @@ START_TEST(eolian_typedef)
|
||||||
eina_iterator_free(iter);
|
eina_iterator_free(iter);
|
||||||
|
|
||||||
/* List */
|
/* List */
|
||||||
fail_if(!(iter = eolian_type_aliases_get_by_file("typedef.eo")));
|
fail_if(!(iter = eolian_typedecl_aliases_get_by_file("typedef.eo")));
|
||||||
fail_if(!eina_iterator_next(iter, (void**)&atype));
|
fail_if(!eina_iterator_next(iter, (void**)&tdl));
|
||||||
fail_if(!(type_name = eolian_type_name_get(atype)));
|
fail_if(!(type_name = eolian_typedecl_name_get(tdl)));
|
||||||
fail_if(strcmp(type_name, "Coord"));
|
fail_if(strcmp(type_name, "Coord"));
|
||||||
fail_if(!eina_iterator_next(iter, (void**)&atype));
|
fail_if(!eina_iterator_next(iter, (void**)&tdl));
|
||||||
fail_if(!(type_name = eolian_type_name_get(atype)));
|
fail_if(!(type_name = eolian_typedecl_name_get(tdl)));
|
||||||
fail_if(strcmp(type_name, "List_Objects"));
|
fail_if(strcmp(type_name, "List_Objects"));
|
||||||
/* coord2 and coord3, skip */
|
/* coord2 and coord3, skip */
|
||||||
fail_if(!eina_iterator_next(iter, (void**)&atype));
|
fail_if(!eina_iterator_next(iter, (void**)&tdl));
|
||||||
fail_if(!eina_iterator_next(iter, (void**)&atype));
|
fail_if(!eina_iterator_next(iter, (void**)&tdl));
|
||||||
/* not generated extern, skip */
|
/* not generated extern, skip */
|
||||||
fail_if(!eina_iterator_next(iter, (void**)&atype));
|
fail_if(!eina_iterator_next(iter, (void**)&tdl));
|
||||||
/* not generated undefined type, skip */
|
/* not generated undefined type, skip */
|
||||||
fail_if(!eina_iterator_next(iter, (void**)&atype));
|
fail_if(!eina_iterator_next(iter, (void**)&tdl));
|
||||||
fail_if(eina_iterator_next(iter, (void**)&atype));
|
fail_if(eina_iterator_next(iter, (void**)&tdl));
|
||||||
|
|
||||||
eolian_shutdown();
|
eolian_shutdown();
|
||||||
}
|
}
|
||||||
|
@ -664,6 +665,7 @@ START_TEST(eolian_struct)
|
||||||
{
|
{
|
||||||
const Eolian_Struct_Type_Field *field = NULL;
|
const Eolian_Struct_Type_Field *field = NULL;
|
||||||
const Eolian_Type *type = NULL, *ftype = NULL;
|
const Eolian_Type *type = NULL, *ftype = NULL;
|
||||||
|
const Eolian_Typedecl *tdl = NULL;
|
||||||
const Eolian_Class *class;
|
const Eolian_Class *class;
|
||||||
const Eolian_Function *func;
|
const Eolian_Function *func;
|
||||||
const char *type_name;
|
const char *type_name;
|
||||||
|
@ -679,42 +681,40 @@ START_TEST(eolian_struct)
|
||||||
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
||||||
|
|
||||||
/* named struct */
|
/* named struct */
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Named")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Named")));
|
||||||
fail_if(!(type_name = eolian_type_name_get(type)));
|
fail_if(!(type_name = eolian_typedecl_name_get(tdl)));
|
||||||
fail_if(!(file = eolian_type_file_get(type)));
|
fail_if(!(file = eolian_typedecl_file_get(tdl)));
|
||||||
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT);
|
fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT);
|
||||||
fail_if(eolian_type_is_own(type));
|
|
||||||
fail_if(eolian_type_is_const(type));
|
|
||||||
fail_if(strcmp(type_name, "Named"));
|
fail_if(strcmp(type_name, "Named"));
|
||||||
fail_if(strcmp(file, "struct.eo"));
|
fail_if(strcmp(file, "struct.eo"));
|
||||||
fail_if(!(field = eolian_type_struct_field_get(type, "field")));
|
fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "field")));
|
||||||
fail_if(!(ftype = eolian_type_struct_field_type_get(field)));
|
fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field)));
|
||||||
fail_if(!(type_name = eolian_type_name_get(ftype)));
|
fail_if(!(type_name = eolian_type_name_get(ftype)));
|
||||||
fail_if(strcmp(type_name, "int"));
|
fail_if(strcmp(type_name, "int"));
|
||||||
fail_if(!(field = eolian_type_struct_field_get(type, "something")));
|
fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something")));
|
||||||
fail_if(!(ftype = eolian_type_struct_field_type_get(field)));
|
fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field)));
|
||||||
fail_if(!(type_name = eolian_type_c_type_get(ftype)));
|
fail_if(!(type_name = eolian_type_c_type_get(ftype)));
|
||||||
fail_if(strcmp(type_name, "const char *"));
|
fail_if(strcmp(type_name, "const char *"));
|
||||||
eina_stringshare_del(type_name);
|
eina_stringshare_del(type_name);
|
||||||
|
|
||||||
/* referencing */
|
/* referencing */
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Another")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Another")));
|
||||||
fail_if(!(type_name = eolian_type_name_get(type)));
|
fail_if(!(type_name = eolian_typedecl_name_get(tdl)));
|
||||||
fail_if(!(file = eolian_type_file_get(type)));
|
fail_if(!(file = eolian_typedecl_file_get(tdl)));
|
||||||
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT);
|
fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT);
|
||||||
fail_if(strcmp(type_name, "Another"));
|
fail_if(strcmp(type_name, "Another"));
|
||||||
fail_if(strcmp(file, "struct.eo"));
|
fail_if(strcmp(file, "struct.eo"));
|
||||||
fail_if(!(field = eolian_type_struct_field_get(type, "field")));
|
fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "field")));
|
||||||
fail_if(!(ftype = eolian_type_struct_field_type_get(field)));
|
fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field)));
|
||||||
fail_if(!(type_name = eolian_type_name_get(ftype)));
|
fail_if(!(type_name = eolian_type_name_get(ftype)));
|
||||||
fail_if(strcmp(type_name, "Named"));
|
fail_if(strcmp(type_name, "Named"));
|
||||||
fail_if(eolian_type_type_get(ftype) != EOLIAN_TYPE_REGULAR);
|
fail_if(eolian_type_type_get(ftype) != EOLIAN_TYPE_REGULAR);
|
||||||
fail_if(eolian_type_type_get(eolian_type_base_type_get(ftype))
|
fail_if(eolian_typedecl_type_get(eolian_type_typedecl_get(ftype))
|
||||||
!= EOLIAN_TYPE_STRUCT);
|
!= EOLIAN_TYPEDECL_STRUCT);
|
||||||
|
|
||||||
/* opaque struct */
|
/* opaque struct */
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Opaque")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Opaque")));
|
||||||
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT_OPAQUE);
|
fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT_OPAQUE);
|
||||||
|
|
||||||
/* use in function */
|
/* use in function */
|
||||||
fail_if(!(func = eolian_class_function_get_by_name(class, "bar", EOLIAN_METHOD)));
|
fail_if(!(func = eolian_class_function_get_by_name(class, "bar", EOLIAN_METHOD)));
|
||||||
|
@ -722,8 +722,8 @@ START_TEST(eolian_struct)
|
||||||
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_POINTER);
|
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_POINTER);
|
||||||
fail_if(!(type = eolian_type_base_type_get(type)));
|
fail_if(!(type = eolian_type_base_type_get(type)));
|
||||||
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_REGULAR);
|
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_REGULAR);
|
||||||
fail_if(!(type = eolian_type_base_type_get(type)));
|
fail_if(!(tdl = eolian_type_typedecl_get(type)));
|
||||||
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT);
|
fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT);
|
||||||
|
|
||||||
eolian_shutdown();
|
eolian_shutdown();
|
||||||
}
|
}
|
||||||
|
@ -731,7 +731,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(eolian_extern)
|
START_TEST(eolian_extern)
|
||||||
{
|
{
|
||||||
const Eolian_Type *type = NULL;
|
const Eolian_Typedecl *tdl = NULL;
|
||||||
const Eolian_Class *class;
|
const Eolian_Class *class;
|
||||||
|
|
||||||
eolian_init();
|
eolian_init();
|
||||||
|
@ -744,20 +744,20 @@ START_TEST(eolian_extern)
|
||||||
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
||||||
|
|
||||||
/* regular type */
|
/* regular type */
|
||||||
fail_if(!(type = eolian_type_alias_get_by_name("Foo")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Foo")));
|
||||||
fail_if(eolian_type_is_extern(type));
|
fail_if(eolian_typedecl_is_extern(tdl));
|
||||||
|
|
||||||
/* extern type */
|
/* extern type */
|
||||||
fail_if(!(type = eolian_type_alias_get_by_name("Evas.Coord")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Evas.Coord")));
|
||||||
fail_if(!eolian_type_is_extern(type));
|
fail_if(!eolian_typedecl_is_extern(tdl));
|
||||||
|
|
||||||
/* regular struct */
|
/* regular struct */
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("X")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("X")));
|
||||||
fail_if(eolian_type_is_extern(type));
|
fail_if(eolian_typedecl_is_extern(tdl));
|
||||||
|
|
||||||
/* extern struct */
|
/* extern struct */
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Y")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Y")));
|
||||||
fail_if(!eolian_type_is_extern(type));
|
fail_if(!eolian_typedecl_is_extern(tdl));
|
||||||
|
|
||||||
eolian_shutdown();
|
eolian_shutdown();
|
||||||
}
|
}
|
||||||
|
@ -831,6 +831,7 @@ START_TEST(eolian_enum)
|
||||||
{
|
{
|
||||||
const Eolian_Enum_Type_Field *field = NULL;
|
const Eolian_Enum_Type_Field *field = NULL;
|
||||||
const Eolian_Variable *var = NULL;
|
const Eolian_Variable *var = NULL;
|
||||||
|
const Eolian_Typedecl *tdl = NULL;
|
||||||
const Eolian_Type *type = NULL;
|
const Eolian_Type *type = NULL;
|
||||||
const Eolian_Class *class;
|
const Eolian_Class *class;
|
||||||
const Eolian_Expression *exp;
|
const Eolian_Expression *exp;
|
||||||
|
@ -847,60 +848,60 @@ START_TEST(eolian_enum)
|
||||||
fail_if(!(class = eolian_class_get_by_name("Enum")));
|
fail_if(!(class = eolian_class_get_by_name("Enum")));
|
||||||
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_enum_get_by_name("Foo")));
|
fail_if(!(tdl = eolian_typedecl_enum_get_by_name("Foo")));
|
||||||
|
|
||||||
fail_if(!(field = eolian_type_enum_field_get(type, "first")));
|
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "first")));
|
||||||
fail_if(!(exp = eolian_type_enum_field_value_get(field, EINA_FALSE)));
|
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
|
||||||
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
||||||
fail_if(v.type != EOLIAN_EXPR_INT);
|
fail_if(v.type != EOLIAN_EXPR_INT);
|
||||||
fail_if(v.value.i != 0);
|
fail_if(v.value.i != 0);
|
||||||
|
|
||||||
fail_if(!(field = eolian_type_enum_field_get(type, "bar")));
|
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "bar")));
|
||||||
fail_if(eolian_type_enum_field_value_get(field, EINA_FALSE));
|
fail_if(eolian_typedecl_enum_field_value_get(field, EINA_FALSE));
|
||||||
|
|
||||||
fail_if(!(field = eolian_type_enum_field_get(type, "baz")));
|
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "baz")));
|
||||||
fail_if(!(exp = eolian_type_enum_field_value_get(field, EINA_FALSE)));
|
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
|
||||||
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
||||||
fail_if(v.type != EOLIAN_EXPR_INT);
|
fail_if(v.type != EOLIAN_EXPR_INT);
|
||||||
fail_if(v.value.i != 15);
|
fail_if(v.value.i != 15);
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_enum_get_by_name("Bar")));
|
fail_if(!(tdl = eolian_typedecl_enum_get_by_name("Bar")));
|
||||||
fail_if(strcmp(eolian_type_enum_legacy_prefix_get(type), "test"));
|
fail_if(strcmp(eolian_typedecl_enum_legacy_prefix_get(tdl), "test"));
|
||||||
|
|
||||||
fail_if(!(field = eolian_type_enum_field_get(type, "foo")));
|
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "foo")));
|
||||||
fail_if(!(exp = eolian_type_enum_field_value_get(field, EINA_FALSE)));
|
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
|
||||||
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
||||||
fail_if(v.type != EOLIAN_EXPR_INT);
|
fail_if(v.type != EOLIAN_EXPR_INT);
|
||||||
fail_if(v.value.i != 15);
|
fail_if(v.value.i != 15);
|
||||||
|
|
||||||
cname = eolian_type_enum_field_c_name_get(field);
|
cname = eolian_typedecl_enum_field_c_name_get(field);
|
||||||
fail_if(strcmp(cname, "TEST_FOO"));
|
fail_if(strcmp(cname, "TEST_FOO"));
|
||||||
eina_stringshare_del(cname);
|
eina_stringshare_del(cname);
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_enum_get_by_name("Baz")));
|
fail_if(!(tdl = eolian_typedecl_enum_get_by_name("Baz")));
|
||||||
|
|
||||||
fail_if(!(field = eolian_type_enum_field_get(type, "flag1")));
|
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "flag1")));
|
||||||
fail_if(!(exp = eolian_type_enum_field_value_get(field, EINA_FALSE)));
|
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
|
||||||
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
||||||
fail_if(v.type != EOLIAN_EXPR_INT);
|
fail_if(v.type != EOLIAN_EXPR_INT);
|
||||||
fail_if(v.value.i != (1 << 0));
|
fail_if(v.value.i != (1 << 0));
|
||||||
|
|
||||||
fail_if(!(field = eolian_type_enum_field_get(type, "flag2")));
|
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "flag2")));
|
||||||
fail_if(!(exp = eolian_type_enum_field_value_get(field, EINA_FALSE)));
|
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
|
||||||
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
||||||
fail_if(v.type != EOLIAN_EXPR_INT);
|
fail_if(v.type != EOLIAN_EXPR_INT);
|
||||||
fail_if(v.value.i != (1 << 1));
|
fail_if(v.value.i != (1 << 1));
|
||||||
|
|
||||||
fail_if(!(field = eolian_type_enum_field_get(type, "flag3")));
|
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "flag3")));
|
||||||
fail_if(!(exp = eolian_type_enum_field_value_get(field, EINA_FALSE)));
|
fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE)));
|
||||||
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
v = eolian_expression_eval(exp, EOLIAN_MASK_ALL);
|
||||||
fail_if(v.type != EOLIAN_EXPR_INT);
|
fail_if(v.type != EOLIAN_EXPR_INT);
|
||||||
fail_if(v.value.i != (1 << 2));
|
fail_if(v.value.i != (1 << 2));
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_enum_get_by_name("Name.Spaced")));
|
fail_if(!(tdl = eolian_typedecl_enum_get_by_name("Name.Spaced")));
|
||||||
fail_if(!(field = eolian_type_enum_field_get(type, "pants")));
|
fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "pants")));
|
||||||
|
|
||||||
cname = eolian_type_enum_field_c_name_get(field);
|
cname = eolian_typedecl_enum_field_c_name_get(field);
|
||||||
fail_if(strcmp(cname, "NAME_SPACED_PANTS"));
|
fail_if(strcmp(cname, "NAME_SPACED_PANTS"));
|
||||||
eina_stringshare_del(cname);
|
eina_stringshare_del(cname);
|
||||||
|
|
||||||
|
@ -963,6 +964,7 @@ END_TEST
|
||||||
START_TEST(eolian_free_func)
|
START_TEST(eolian_free_func)
|
||||||
{
|
{
|
||||||
const Eolian_Class *class;
|
const Eolian_Class *class;
|
||||||
|
const Eolian_Typedecl *tdl;
|
||||||
const Eolian_Type *type;
|
const Eolian_Type *type;
|
||||||
|
|
||||||
eolian_init();
|
eolian_init();
|
||||||
|
@ -975,29 +977,29 @@ START_TEST(eolian_free_func)
|
||||||
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
|
||||||
|
|
||||||
/* regular struct */
|
/* regular struct */
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Named1")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Named1")));
|
||||||
fail_if(eolian_type_free_func_get(type));
|
fail_if(eolian_typedecl_free_func_get(tdl));
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Named2")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Named2")));
|
||||||
fail_if(strcmp(eolian_type_free_func_get(type), "test_free"));
|
fail_if(strcmp(eolian_typedecl_free_func_get(tdl), "test_free"));
|
||||||
|
|
||||||
/* typedef */
|
/* typedef */
|
||||||
fail_if(!(type = eolian_type_alias_get_by_name("Typedef1")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Typedef1")));
|
||||||
fail_if(eolian_type_free_func_get(type));
|
fail_if(eolian_typedecl_free_func_get(tdl));
|
||||||
fail_if(!(type = eolian_type_alias_get_by_name("Typedef2")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Typedef2")));
|
||||||
fail_if(strcmp(eolian_type_free_func_get(type), "def_free"));
|
fail_if(strcmp(eolian_typedecl_free_func_get(tdl), "def_free"));
|
||||||
|
|
||||||
/* opaque struct */
|
/* opaque struct */
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Opaque1")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Opaque1")));
|
||||||
fail_if(eolian_type_free_func_get(type));
|
fail_if(eolian_typedecl_free_func_get(tdl));
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Opaque2")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Opaque2")));
|
||||||
fail_if(strcmp(eolian_type_free_func_get(type), "opaque_free"));
|
fail_if(strcmp(eolian_typedecl_free_func_get(tdl), "opaque_free"));
|
||||||
|
|
||||||
/* pointer */
|
/* pointer */
|
||||||
fail_if(!(type = eolian_type_alias_get_by_name("Pointer1")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Pointer1")));
|
||||||
fail_if(!(type = eolian_type_base_type_get(type)));
|
fail_if(!(type = eolian_typedecl_base_type_get(tdl)));
|
||||||
fail_if(eolian_type_free_func_get(type));
|
fail_if(eolian_type_free_func_get(type));
|
||||||
fail_if(!(type = eolian_type_alias_get_by_name("Pointer2")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Pointer2")));
|
||||||
fail_if(!(type = eolian_type_base_type_get(type)));
|
fail_if(!(type = eolian_typedecl_base_type_get(tdl)));
|
||||||
fail_if(strcmp(eolian_type_free_func_get(type), "ptr_free"));
|
fail_if(strcmp(eolian_type_free_func_get(type), "ptr_free"));
|
||||||
|
|
||||||
eolian_shutdown();
|
eolian_shutdown();
|
||||||
|
@ -1055,7 +1057,7 @@ END_TEST
|
||||||
START_TEST(eolian_import)
|
START_TEST(eolian_import)
|
||||||
{
|
{
|
||||||
const Eolian_Class *class;
|
const Eolian_Class *class;
|
||||||
const Eolian_Type *type;
|
const Eolian_Typedecl *tdl;
|
||||||
|
|
||||||
eolian_init();
|
eolian_init();
|
||||||
|
|
||||||
|
@ -1064,11 +1066,11 @@ START_TEST(eolian_import)
|
||||||
fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/import.eo"));
|
fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/import.eo"));
|
||||||
fail_if(!(class = eolian_class_get_by_name("Import")));
|
fail_if(!(class = eolian_class_get_by_name("Import")));
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_alias_get_by_name("Imported")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Imported")));
|
||||||
fail_if(strcmp(eolian_type_file_get(type), "import_types.eot"));
|
fail_if(strcmp(eolian_typedecl_file_get(tdl), "import_types.eot"));
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Imported_Struct")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Imported_Struct")));
|
||||||
fail_if(strcmp(eolian_type_file_get(type), "import_types.eot"));
|
fail_if(strcmp(eolian_typedecl_file_get(tdl), "import_types.eot"));
|
||||||
|
|
||||||
eolian_shutdown();
|
eolian_shutdown();
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1079,7 @@ END_TEST
|
||||||
START_TEST(eolian_decl)
|
START_TEST(eolian_decl)
|
||||||
{
|
{
|
||||||
const Eolian_Declaration *decl;
|
const Eolian_Declaration *decl;
|
||||||
const Eolian_Type *type;
|
const Eolian_Typedecl *tdl;
|
||||||
const Eolian_Class *class;
|
const Eolian_Class *class;
|
||||||
const Eolian_Variable *var;
|
const Eolian_Variable *var;
|
||||||
Eina_Iterator *itr;
|
Eina_Iterator *itr;
|
||||||
|
@ -1094,23 +1096,23 @@ START_TEST(eolian_decl)
|
||||||
fail_if(!eina_iterator_next(itr, (void**)&decl));
|
fail_if(!eina_iterator_next(itr, (void**)&decl));
|
||||||
fail_if(eolian_declaration_type_get(decl) != EOLIAN_DECL_STRUCT);
|
fail_if(eolian_declaration_type_get(decl) != EOLIAN_DECL_STRUCT);
|
||||||
fail_if(strcmp(eolian_declaration_name_get(decl), "A"));
|
fail_if(strcmp(eolian_declaration_name_get(decl), "A"));
|
||||||
fail_if(!(type = eolian_declaration_data_type_get(decl)));
|
fail_if(!(tdl = eolian_declaration_data_type_get(decl)));
|
||||||
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT);
|
fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT);
|
||||||
fail_if(strcmp(eolian_type_name_get(type), "A"));
|
fail_if(strcmp(eolian_typedecl_name_get(tdl), "A"));
|
||||||
|
|
||||||
fail_if(!eina_iterator_next(itr, (void**)&decl));
|
fail_if(!eina_iterator_next(itr, (void**)&decl));
|
||||||
fail_if(eolian_declaration_type_get(decl) != EOLIAN_DECL_ENUM);
|
fail_if(eolian_declaration_type_get(decl) != EOLIAN_DECL_ENUM);
|
||||||
fail_if(strcmp(eolian_declaration_name_get(decl), "B"));
|
fail_if(strcmp(eolian_declaration_name_get(decl), "B"));
|
||||||
fail_if(!(type = eolian_declaration_data_type_get(decl)));
|
fail_if(!(tdl = eolian_declaration_data_type_get(decl)));
|
||||||
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_ENUM);
|
fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_ENUM);
|
||||||
fail_if(strcmp(eolian_type_name_get(type), "B"));
|
fail_if(strcmp(eolian_typedecl_name_get(tdl), "B"));
|
||||||
|
|
||||||
fail_if(!eina_iterator_next(itr, (void**)&decl));
|
fail_if(!eina_iterator_next(itr, (void**)&decl));
|
||||||
fail_if(eolian_declaration_type_get(decl) != EOLIAN_DECL_ALIAS);
|
fail_if(eolian_declaration_type_get(decl) != EOLIAN_DECL_ALIAS);
|
||||||
fail_if(strcmp(eolian_declaration_name_get(decl), "C"));
|
fail_if(strcmp(eolian_declaration_name_get(decl), "C"));
|
||||||
fail_if(!(type = eolian_declaration_data_type_get(decl)));
|
fail_if(!(tdl = eolian_declaration_data_type_get(decl)));
|
||||||
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_ALIAS);
|
fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_ALIAS);
|
||||||
fail_if(strcmp(eolian_type_name_get(type), "C"));
|
fail_if(strcmp(eolian_typedecl_name_get(tdl), "C"));
|
||||||
|
|
||||||
fail_if(!eina_iterator_next(itr, (void**)&decl));
|
fail_if(!eina_iterator_next(itr, (void**)&decl));
|
||||||
fail_if(eolian_declaration_type_get(decl) != EOLIAN_DECL_VAR);
|
fail_if(eolian_declaration_type_get(decl) != EOLIAN_DECL_VAR);
|
||||||
|
@ -1137,7 +1139,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(eolian_docs)
|
START_TEST(eolian_docs)
|
||||||
{
|
{
|
||||||
const Eolian_Type *type;
|
const Eolian_Typedecl *tdl;
|
||||||
const Eolian_Class *class;
|
const Eolian_Class *class;
|
||||||
const Eolian_Event *event;
|
const Eolian_Event *event;
|
||||||
const Eolian_Variable *var;
|
const Eolian_Variable *var;
|
||||||
|
@ -1154,8 +1156,8 @@ START_TEST(eolian_docs)
|
||||||
|
|
||||||
fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/docs.eo"));
|
fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/docs.eo"));
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Foo")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Foo")));
|
||||||
fail_if(!(doc = eolian_type_documentation_get(type)));
|
fail_if(!(doc = eolian_typedecl_documentation_get(tdl)));
|
||||||
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
||||||
"This is struct Foo. It does stuff."));
|
"This is struct Foo. It does stuff."));
|
||||||
fail_if(strcmp(eolian_documentation_description_get(doc),
|
fail_if(strcmp(eolian_documentation_description_get(doc),
|
||||||
|
@ -1167,45 +1169,45 @@ START_TEST(eolian_docs)
|
||||||
fail_if(strcmp(eolian_documentation_since_get(doc),
|
fail_if(strcmp(eolian_documentation_since_get(doc),
|
||||||
"1.66"));
|
"1.66"));
|
||||||
|
|
||||||
fail_if(!(sfl = eolian_type_struct_field_get(type, "field1")));
|
fail_if(!(sfl = eolian_typedecl_struct_field_get(tdl, "field1")));
|
||||||
fail_if(!(doc = eolian_type_struct_field_documentation_get(sfl)));
|
fail_if(!(doc = eolian_typedecl_struct_field_documentation_get(sfl)));
|
||||||
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
||||||
"Field documentation."));
|
"Field documentation."));
|
||||||
fail_if(eolian_documentation_description_get(doc));
|
fail_if(eolian_documentation_description_get(doc));
|
||||||
|
|
||||||
fail_if(!(sfl = eolian_type_struct_field_get(type, "field2")));
|
fail_if(!(sfl = eolian_typedecl_struct_field_get(tdl, "field2")));
|
||||||
fail_if(eolian_type_struct_field_documentation_get(sfl));
|
fail_if(eolian_typedecl_struct_field_documentation_get(sfl));
|
||||||
|
|
||||||
fail_if(!(sfl = eolian_type_struct_field_get(type, "field3")));
|
fail_if(!(sfl = eolian_typedecl_struct_field_get(tdl, "field3")));
|
||||||
fail_if(!(doc = eolian_type_struct_field_documentation_get(sfl)));
|
fail_if(!(doc = eolian_typedecl_struct_field_documentation_get(sfl)));
|
||||||
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
||||||
"Another field documentation."));
|
"Another field documentation."));
|
||||||
fail_if(eolian_documentation_description_get(doc));
|
fail_if(eolian_documentation_description_get(doc));
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_enum_get_by_name("Bar")));
|
fail_if(!(tdl = eolian_typedecl_enum_get_by_name("Bar")));
|
||||||
fail_if(!(doc = eolian_type_documentation_get(type)));
|
fail_if(!(doc = eolian_typedecl_documentation_get(tdl)));
|
||||||
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
||||||
"Docs for enum Bar."));
|
"Docs for enum Bar."));
|
||||||
fail_if(eolian_documentation_description_get(doc));
|
fail_if(eolian_documentation_description_get(doc));
|
||||||
fail_if(eolian_documentation_since_get(doc));
|
fail_if(eolian_documentation_since_get(doc));
|
||||||
|
|
||||||
fail_if(!(efl = eolian_type_enum_field_get(type, "blah")));
|
fail_if(!(efl = eolian_typedecl_enum_field_get(tdl, "blah")));
|
||||||
fail_if(eolian_type_enum_field_documentation_get(efl));
|
fail_if(eolian_typedecl_enum_field_documentation_get(efl));
|
||||||
|
|
||||||
fail_if(!(efl = eolian_type_enum_field_get(type, "foo")));
|
fail_if(!(efl = eolian_typedecl_enum_field_get(tdl, "foo")));
|
||||||
fail_if(!(doc = eolian_type_enum_field_documentation_get(efl)));
|
fail_if(!(doc = eolian_typedecl_enum_field_documentation_get(efl)));
|
||||||
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
||||||
"Docs for foo."));
|
"Docs for foo."));
|
||||||
fail_if(eolian_documentation_description_get(doc));
|
fail_if(eolian_documentation_description_get(doc));
|
||||||
|
|
||||||
fail_if(!(efl = eolian_type_enum_field_get(type, "bar")));
|
fail_if(!(efl = eolian_typedecl_enum_field_get(tdl, "bar")));
|
||||||
fail_if(!(doc = eolian_type_enum_field_documentation_get(efl)));
|
fail_if(!(doc = eolian_typedecl_enum_field_documentation_get(efl)));
|
||||||
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
||||||
"Docs for bar."));
|
"Docs for bar."));
|
||||||
fail_if(eolian_documentation_description_get(doc));
|
fail_if(eolian_documentation_description_get(doc));
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_alias_get_by_name("Alias")));
|
fail_if(!(tdl = eolian_typedecl_alias_get_by_name("Alias")));
|
||||||
fail_if(!(doc = eolian_type_documentation_get(type)));
|
fail_if(!(doc = eolian_typedecl_documentation_get(tdl)));
|
||||||
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
||||||
"Docs for typedef."));
|
"Docs for typedef."));
|
||||||
fail_if(strcmp(eolian_documentation_description_get(doc),
|
fail_if(strcmp(eolian_documentation_description_get(doc),
|
||||||
|
@ -1219,8 +1221,8 @@ START_TEST(eolian_docs)
|
||||||
"Docs for var."));
|
"Docs for var."));
|
||||||
fail_if(eolian_documentation_description_get(doc));
|
fail_if(eolian_documentation_description_get(doc));
|
||||||
|
|
||||||
fail_if(!(type = eolian_type_struct_get_by_name("Opaque")));
|
fail_if(!(tdl = eolian_typedecl_struct_get_by_name("Opaque")));
|
||||||
fail_if(!(doc = eolian_type_documentation_get(type)));
|
fail_if(!(doc = eolian_typedecl_documentation_get(tdl)));
|
||||||
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
fail_if(strcmp(eolian_documentation_summary_get(doc),
|
||||||
"Opaque struct docs. See @Foo for another struct."));
|
"Opaque struct docs. See @Foo for another struct."));
|
||||||
fail_if(eolian_documentation_description_get(doc));
|
fail_if(eolian_documentation_description_get(doc));
|
||||||
|
|
Loading…
Reference in New Issue