From 34c2bf66ce0c08def79f905841376a5ab0c8e957 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Thu, 22 Sep 2016 15:58:06 +0200 Subject: [PATCH] eolian gen2: initial stubs for source writing --- src/Makefile_Eolian.am | 2 ++ src/bin/eolian2/main.c | 23 ++++++++++++++++------- src/bin/eolian2/sources.c | 9 +++++++++ src/bin/eolian2/sources.h | 8 ++++++++ 4 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 src/bin/eolian2/sources.c create mode 100644 src/bin/eolian2/sources.h diff --git a/src/Makefile_Eolian.am b/src/Makefile_Eolian.am index 472fa35bb1..e5b3fa4f38 100644 --- a/src/Makefile_Eolian.am +++ b/src/Makefile_Eolian.am @@ -78,6 +78,8 @@ bin_eolian2_eolian_gen2_SOURCES = \ bin/eolian2/types.h \ bin/eolian2/headers.c \ bin/eolian2/headers.h \ + bin/eolian2/sources.c \ + bin/eolian2/sources.h \ bin/eolian2/docs.c \ bin/eolian2/docs.h diff --git a/src/bin/eolian2/main.c b/src/bin/eolian2/main.c index 8a8a4a42bf..a2e0e34e1e 100644 --- a/src/bin/eolian2/main.c +++ b/src/bin/eolian2/main.c @@ -4,6 +4,7 @@ #include "main.h" #include "types.h" #include "headers.h" +#include "sources.h" int _eolian_gen_log_dom = -1; @@ -262,6 +263,7 @@ _write_header(const char *ofname, const char *ifname, Eina_Bool legacy) } } + eina_strbuf_free(buf); return EINA_FALSE; } @@ -292,14 +294,21 @@ static Eina_Bool _write_source(const char *ofname, const char *ifname) { INF("generating source: %s", ofname); - Eina_Strbuf *ebuf = eina_strbuf_new(), - *lbuf = eina_strbuf_new(); + Eina_Strbuf *buf = eina_strbuf_new(); - Eina_Bool ret = _write_file(ofname, ebuf, EINA_FALSE) && - _write_file(ofname, lbuf, EINA_TRUE); - eina_strbuf_free(ebuf); - eina_strbuf_free(lbuf); - return ret; + const Eolian_Class *cl = eolian_class_get_by_file(ifname); + eo_gen_source_gen(cl, buf); + if (cl) + { + if (_write_file(ofname, buf, EINA_FALSE)) + { + eina_strbuf_free(buf); + return EINA_TRUE; + } + } + + eina_strbuf_free(buf); + return EINA_FALSE; } static Eina_Bool diff --git a/src/bin/eolian2/sources.c b/src/bin/eolian2/sources.c new file mode 100644 index 0000000000..f50db7b927 --- /dev/null +++ b/src/bin/eolian2/sources.c @@ -0,0 +1,9 @@ +#include "main.h" +#include "docs.h" + +void +eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf) +{ + if (!cl) + return; +} diff --git a/src/bin/eolian2/sources.h b/src/bin/eolian2/sources.h new file mode 100644 index 0000000000..3a002210d7 --- /dev/null +++ b/src/bin/eolian2/sources.h @@ -0,0 +1,8 @@ +#ifndef EOLIAN_GEN_SOURCES_H +#define EOLIAN_GEN_SOURCES_H + +#include "main.h" + +void eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf); + +#endif