eolian gen2: initial stubs for source writing
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Thu, 22 Sep 2016 13:58:06 +0000 (15:58 +0200)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Fri, 7 Oct 2016 09:54:23 +0000 (11:54 +0200)
src/Makefile_Eolian.am
src/bin/eolian2/main.c
src/bin/eolian2/sources.c [new file with mode: 0644]
src/bin/eolian2/sources.h [new file with mode: 0644]

index 472fa35..e5b3fa4 100644 (file)
@@ -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
 
index 8a8a4a4..a2e0e34 100644 (file)
@@ -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 (file)
index 0000000..f50db7b
--- /dev/null
@@ -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 (file)
index 0000000..3a00221
--- /dev/null
@@ -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