aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-15 16:08:27 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-15 17:11:11 +0100
commitc8aa30e698fa95cf425c35bb359fbab55cb64110 (patch)
tree3417a7bd3bc6c8e4e089bd59be27df2534482173 /src/bin/eolian
parentefl_ui_focus_manager_calc: dont use sqrt (diff)
downloadefl-c8aa30e698fa95cf425c35bb359fbab55cb64110.tar.gz
eolian: make declaration APIs use units
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/docs.c2
-rw-r--r--src/bin/eolian/main.c22
-rw-r--r--src/bin/eolian/types.c10
-rw-r--r--src/bin/eolian/types.h4
4 files changed, 19 insertions, 19 deletions
diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c
index 9807b727b7..09e63bf9ac 100644
--- a/src/bin/eolian/docs.c
+++ b/src/bin/eolian/docs.c
@@ -22,7 +22,7 @@ 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(refn);
+ const Eolian_Declaration *decl = eolian_declaration_get_by_name(src, refn);
if (decl)
{
char *n = strdup(eolian_declaration_name_get(decl));
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 92643c6f7e..4c51e18d17 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -318,13 +318,14 @@ void eo_gen_class_names_get(const Eolian_Class *cl, char **cname,
}
static Eina_Bool
-_write_header(const Eolian_Unit *src, const char *ofname,
+_write_header(const Eolian *eos, const Eolian_Unit *src, const char *ofname,
const char *ifname, Eina_Bool legacy)
{
INF("generating header: %s (legacy: %d)", ofname, legacy);
Eina_Strbuf *buf = eina_strbuf_new();
- eo_gen_types_header_gen(src, ifname, buf, EINA_TRUE, legacy);
+ eo_gen_types_header_gen(src, eolian_declarations_get_by_file(eos, ifname),
+ buf, EINA_TRUE, legacy);
buf = _include_guard(ifname, "TYPES", buf);
Eina_Strbuf *cltd = eo_gen_class_typedef_gen(src, ifname);
@@ -353,13 +354,14 @@ _write_header(const Eolian_Unit *src, const char *ofname,
}
static Eina_Bool
-_write_stub_header(const Eolian_Unit *src, const char *ofname,
+_write_stub_header(const Eolian *eos, const Eolian_Unit *src, const char *ofname,
const char *ifname)
{
INF("generating stub header: %s", ofname);
Eina_Strbuf *buf = eina_strbuf_new();
- eo_gen_types_header_gen(src, ifname, buf, EINA_FALSE, EINA_FALSE);
+ eo_gen_types_header_gen(src, eolian_declarations_get_by_file(eos, ifname),
+ buf, EINA_FALSE, EINA_FALSE);
Eina_Strbuf *cltd = eo_gen_class_typedef_gen(src, ifname);
if (cltd)
@@ -377,14 +379,14 @@ _write_stub_header(const Eolian_Unit *src, const char *ofname,
}
static Eina_Bool
-_write_source(const Eolian_Unit *src, const char *ofname,
+_write_source(const Eolian *eos, const Eolian_Unit *src, const char *ofname,
const char *ifname, Eina_Bool eot)
{
INF("generating source: %s", ofname);
Eina_Strbuf *buf = eina_strbuf_new();
const Eolian_Class *cl = eolian_class_get_by_file(src, ifname);
- eo_gen_types_source_gen(src, ifname, buf);
+ eo_gen_types_source_gen(src, eolian_declarations_get_by_file(eos, ifname), buf);
eo_gen_source_gen(src, cl, buf);
if (cl || (eot && eina_strbuf_length_get(buf)))
{
@@ -565,13 +567,13 @@ main(int argc, char **argv)
Eina_Bool succ = EINA_TRUE;
if (gen_what & GEN_H)
- succ = _write_header(src, outs[_get_bit_pos(GEN_H)], eobn, EINA_FALSE);
+ succ = _write_header(eos, src, outs[_get_bit_pos(GEN_H)], eobn, EINA_FALSE);
if (succ && (gen_what & GEN_H_LEGACY))
- succ = _write_header(src, outs[_get_bit_pos(GEN_H_LEGACY)], eobn, EINA_TRUE);
+ succ = _write_header(eos, src, outs[_get_bit_pos(GEN_H_LEGACY)], eobn, EINA_TRUE);
if (succ && (gen_what & GEN_H_STUB))
- succ = _write_stub_header(src, outs[_get_bit_pos(GEN_H_STUB)], eobn);
+ succ = _write_stub_header(eos, src, outs[_get_bit_pos(GEN_H_STUB)], eobn);
if (succ && (gen_what & GEN_C))
- succ = _write_source(src, outs[_get_bit_pos(GEN_C)], eobn, !strcmp(ext, ".eot"));
+ succ = _write_source(eos, src, outs[_get_bit_pos(GEN_C)], eobn, !strcmp(ext, ".eot"));
if (succ && (gen_what & GEN_C_IMPL))
succ = _write_impl(src, outs[_get_bit_pos(GEN_C_IMPL)], eobn);
diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c
index ae4cd72d63..c98791e965 100644
--- a/src/bin/eolian/types.c
+++ b/src/bin/eolian/types.c
@@ -204,12 +204,10 @@ _var_generate(const Eolian_Unit *src, const Eolian_Variable *vr, Eina_Bool legac
}
void eo_gen_types_header_gen(const Eolian_Unit *src,
- const char *eof, Eina_Strbuf *buf,
+ Eina_Iterator *itr, Eina_Strbuf *buf,
Eina_Bool full, Eina_Bool legacy)
{
const Eolian_Declaration *decl;
-
- Eina_Iterator *itr = eolian_declarations_get_by_file(eof);
EINA_ITERATOR_FOREACH(itr, decl)
{
Eolian_Declaration_Type dt = eolian_declaration_type_get(decl);
@@ -256,14 +254,13 @@ void eo_gen_types_header_gen(const Eolian_Unit *src,
eina_strbuf_free(tbuf);
}
}
+ eina_iterator_free(itr);
}
void eo_gen_types_source_gen(const Eolian_Unit *src,
- const char *eof, Eina_Strbuf *buf)
+ Eina_Iterator *itr, Eina_Strbuf *buf)
{
const Eolian_Declaration *decl;
-
- Eina_Iterator *itr = eolian_declarations_get_by_file(eof);
EINA_ITERATOR_FOREACH(itr, decl)
{
Eolian_Declaration_Type dt = eolian_declaration_type_get(decl);
@@ -305,6 +302,7 @@ void eo_gen_types_source_gen(const Eolian_Unit *src,
eina_strbuf_append(buf, "\n");
}
+ eina_iterator_free(itr);
}
Eina_Strbuf *eo_gen_class_typedef_gen(const Eolian_Unit *src, const char *eof)
diff --git a/src/bin/eolian/types.h b/src/bin/eolian/types.h
index 100206f703..7ad56673b9 100644
--- a/src/bin/eolian/types.h
+++ b/src/bin/eolian/types.h
@@ -1,8 +1,8 @@
#ifndef EOLIAN_GEN_TYPES_H
#define EOLIAN_GEN_TYPES_H
-void eo_gen_types_header_gen(const Eolian_Unit *src, const char *eof, Eina_Strbuf *buf, Eina_Bool full, Eina_Bool legacy);
-void eo_gen_types_source_gen(const Eolian_Unit *src, const char *eof, Eina_Strbuf *buf);
+void eo_gen_types_header_gen(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Bool full, Eina_Bool legacy);
+void eo_gen_types_source_gen(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf);
Eina_Strbuf *eo_gen_class_typedef_gen(const Eolian_Unit *src, const char *eof);
#endif