aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-08 19:57:55 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-08 19:57:55 +0100
commitc7b44dfa2c199009ee735610a6d8d6f10c5d5b16 (patch)
treec64fa62c2cd266fccb765bddd3d7095e34655db9 /src/bin/eolian
parenteolian: give objects names, and reduce duplication (diff)
downloadefl-c7b44dfa2c199009ee735610a6d8d6f10c5d5b16.tar.gz
eolian gen: switch from decl api to object api
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/docs.c4
-rw-r--r--src/bin/eolian/main.c6
-rw-r--r--src/bin/eolian/types.c34
3 files changed, 23 insertions, 21 deletions
diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c
index acb56089a9..a9ede0d82b 100644
--- a/src/bin/eolian/docs.c
+++ b/src/bin/eolian/docs.c
@@ -22,10 +22,10 @@ static void
_generate_ref(const Eolian_Unit *src, const char *refn, Eina_Strbuf *wbuf,
Eina_Bool use_legacy)
{
- const Eolian_Declaration *decl = eolian_declaration_get_by_name(src, refn);
+ const Eolian_Object *decl = eolian_unit_object_by_name_get(src, refn);
if (decl)
{
- char *n = strdup(eolian_declaration_name_get(decl));
+ char *n = strdup(eolian_object_name_get(decl));
char *p = n;
while ((p = strchr(p, '.'))) *p = '_';
eina_strbuf_append(wbuf, n);
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 3bc76458df..67fff4f146 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -324,7 +324,7 @@ _write_header(const Eolian_State *eos, const Eolian_Unit *src, const char *ofnam
INF("generating header: %s (legacy: %d)", ofname, legacy);
Eina_Strbuf *buf = eina_strbuf_new();
- eo_gen_types_header_gen(src, eolian_declarations_get_by_file(eos, ifname),
+ eo_gen_types_header_gen(src, eolian_state_objects_by_file_get(eos, ifname),
buf, EINA_TRUE, legacy);
buf = _include_guard(ifname, "TYPES", buf);
@@ -360,7 +360,7 @@ _write_stub_header(const Eolian_State *eos, const Eolian_Unit *src, const char *
INF("generating stub header: %s", ofname);
Eina_Strbuf *buf = eina_strbuf_new();
- eo_gen_types_header_gen(src, eolian_declarations_get_by_file(eos, ifname),
+ eo_gen_types_header_gen(src, eolian_state_objects_by_file_get(eos, ifname),
buf, EINA_FALSE, EINA_FALSE);
Eina_Strbuf *cltd = eo_gen_class_typedef_gen(eos, ifname);
@@ -386,7 +386,7 @@ _write_source(const Eolian_State *eos, const char *ofname,
Eina_Strbuf *buf = eina_strbuf_new();
const Eolian_Class *cl = eolian_state_class_by_file_get(eos, ifname);
- eo_gen_types_source_gen(eolian_declarations_get_by_file(eos, ifname), buf);
+ eo_gen_types_source_gen(eolian_state_objects_by_file_get(eos, ifname), buf);
eo_gen_source_gen(cl, buf);
if (cl || (eot && eina_strbuf_length_get(buf)))
{
diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c
index 6578eace52..924c5515fc 100644
--- a/src/bin/eolian/types.c
+++ b/src/bin/eolian/types.c
@@ -207,14 +207,14 @@ void eo_gen_types_header_gen(const Eolian_Unit *src,
Eina_Iterator *itr, Eina_Strbuf *buf,
Eina_Bool full, Eina_Bool legacy)
{
- const Eolian_Declaration *decl;
+ const Eolian_Object *decl;
EINA_ITERATOR_FOREACH(itr, decl)
{
- Eolian_Declaration_Type dt = eolian_declaration_type_get(decl);
+ Eolian_Object_Type dt = eolian_object_type_get(decl);
- if (dt == EOLIAN_DECL_VAR)
+ if (dt == EOLIAN_OBJECT_VARIABLE)
{
- const Eolian_Variable *vr = eolian_declaration_variable_get(decl);
+ const Eolian_Variable *vr = (const Eolian_Variable *)decl;
if (!vr || eolian_variable_is_extern(vr))
continue;
@@ -228,18 +228,20 @@ void eo_gen_types_header_gen(const Eolian_Unit *src,
continue;
}
- if ((dt != EOLIAN_DECL_ALIAS) &&
- (dt != EOLIAN_DECL_STRUCT) &&
- (dt != EOLIAN_DECL_ENUM))
+ if (dt != EOLIAN_OBJECT_TYPEDECL)
continue;
- if (dt == EOLIAN_DECL_ENUM && !full)
+
+ const Eolian_Typedecl *tp = (const Eolian_Typedecl *)decl;
+
+ if (eolian_typedecl_is_extern(tp))
continue;
- const Eolian_Typedecl *tp = eolian_declaration_data_type_get(decl);
- if (!tp || eolian_typedecl_is_extern(tp))
+ Eolian_Typedecl_Type tpt = eolian_typedecl_type_get(tp);
+
+ if (tpt == EOLIAN_TYPEDECL_ENUM && !full)
continue;
- if (eolian_typedecl_type_get(tp) == EOLIAN_TYPEDECL_ALIAS)
+ if (tpt == EOLIAN_TYPEDECL_ALIAS)
{
const Eolian_Type *btp = eolian_typedecl_base_type_get(tp);
if (eolian_type_type_get(btp) == EOLIAN_TYPE_UNDEFINED)
@@ -259,16 +261,16 @@ void eo_gen_types_header_gen(const Eolian_Unit *src,
void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf)
{
- const Eolian_Declaration *decl;
+ const Eolian_Object *decl;
EINA_ITERATOR_FOREACH(itr, decl)
{
- Eolian_Declaration_Type dt = eolian_declaration_type_get(decl);
+ Eolian_Object_Type dt = eolian_object_type_get(decl);
- if (dt != EOLIAN_DECL_VAR)
+ if (dt != EOLIAN_OBJECT_VARIABLE)
continue;
- const Eolian_Variable *vr = eolian_declaration_variable_get(decl);
- if (!vr || eolian_variable_is_extern(vr))
+ const Eolian_Variable *vr = (const Eolian_Variable *)decl;
+ if (eolian_variable_is_extern(vr))
continue;
if (eolian_variable_type_get(vr) == EOLIAN_VAR_CONSTANT)