summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-09-15 15:48:15 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-10-07 11:54:23 +0200
commitb70299fd35f13bf820592443960df328a5d0b07b (patch)
treedc874f092336622c47704e7776749a710cfcbf79
parent341ef8fc05b88ae8ee1c46de1baaf548cb5e4725 (diff)
eolian gen2: initial type gen subroutine
-rw-r--r--src/bin/eolian2/main.c7
-rw-r--r--src/bin/eolian2/types.c43
-rw-r--r--src/bin/eolian2/types.h2
3 files changed, 50 insertions, 2 deletions
diff --git a/src/bin/eolian2/main.c b/src/bin/eolian2/main.c
index 0e6b019e60..9edb821c25 100644
--- a/src/bin/eolian2/main.c
+++ b/src/bin/eolian2/main.c
@@ -221,12 +221,15 @@ _write_header(const char *ofname, const char *ifname, Eina_Bool legacy)
221 INF("generating header: %s (legacy: %d)", ofname, legacy); 221 INF("generating header: %s (legacy: %d)", ofname, legacy);
222 Eina_Strbuf *buf = eina_strbuf_new(); 222 Eina_Strbuf *buf = eina_strbuf_new();
223 223
224 eo_gen_types_header_gen(ifname, buf, EINA_TRUE, legacy);
225 buf = _include_guard(ifname, "TYPES", buf);
226
224 Eina_Strbuf *cltd = eo_gen_class_typedef_gen(ifname); 227 Eina_Strbuf *cltd = eo_gen_class_typedef_gen(ifname);
225 if (cltd) 228 if (cltd)
226 { 229 {
227 cltd = _include_guard(ifname, "CLASS_TYPE", cltd); 230 cltd = _include_guard(ifname, "CLASS_TYPE", cltd);
228 eina_strbuf_append(buf, eina_strbuf_string_get(cltd)); 231 eina_strbuf_prepend_char(buf, '\n');
229 eina_strbuf_append_char(buf, '\n'); 232 eina_strbuf_prepend(buf, eina_strbuf_string_get(cltd));
230 eina_strbuf_free(cltd); 233 eina_strbuf_free(cltd);
231 } 234 }
232 235
diff --git a/src/bin/eolian2/types.c b/src/bin/eolian2/types.c
index 4669e281c1..a2970cef8d 100644
--- a/src/bin/eolian2/types.c
+++ b/src/bin/eolian2/types.c
@@ -1,5 +1,48 @@
1#include "main.h" 1#include "main.h"
2 2
3static Eina_Strbuf *
4_type_generate(const Eolian_Typedecl *tp, Eina_Bool full, Eina_Bool legacy)
5{
6 return NULL;
7}
8
9void eo_gen_types_header_gen(const char *eof, Eina_Strbuf *buf,
10 Eina_Bool full, Eina_Bool legacy)
11{
12 const Eolian_Declaration *decl;
13
14 Eina_Iterator *itr = eolian_declarations_get_by_file(eof);
15 EINA_ITERATOR_FOREACH(itr, decl)
16 {
17 Eolian_Declaration_Type dt = eolian_declaration_type_get(decl);
18 if ((dt != EOLIAN_DECL_ALIAS) &&
19 (dt != EOLIAN_DECL_STRUCT) &&
20 (dt != EOLIAN_DECL_ENUM))
21 continue;
22 if (dt == EOLIAN_DECL_ENUM && !full)
23 continue;
24
25 const Eolian_Typedecl *tp = eolian_declaration_data_type_get(decl);
26 if (!tp || eolian_typedecl_is_extern(tp))
27 continue;
28
29 if (eolian_typedecl_type_get(tp) == EOLIAN_TYPEDECL_ALIAS)
30 {
31 const Eolian_Type *btp = eolian_typedecl_base_type_get(tp);
32 if (eolian_type_type_get(btp) == EOLIAN_TYPE_UNDEFINED)
33 continue;
34 }
35
36 Eina_Strbuf *tbuf = _type_generate(tp, full, legacy);
37 if (tbuf)
38 {
39 eina_strbuf_append(buf, eina_strbuf_string_get(tbuf));
40 eina_strbuf_append(buf, ";\n\n");
41 eina_strbuf_free(tbuf);
42 }
43 }
44}
45
3Eina_Strbuf *eo_gen_class_typedef_gen(const char *eof) 46Eina_Strbuf *eo_gen_class_typedef_gen(const char *eof)
4{ 47{
5 const Eolian_Class *cl = eolian_class_get_by_file(eof); 48 const Eolian_Class *cl = eolian_class_get_by_file(eof);
diff --git a/src/bin/eolian2/types.h b/src/bin/eolian2/types.h
index 2f4434ecaa..609d097287 100644
--- a/src/bin/eolian2/types.h
+++ b/src/bin/eolian2/types.h
@@ -1,6 +1,8 @@
1#ifndef EOLIAN_GEN_TYPES_H 1#ifndef EOLIAN_GEN_TYPES_H
2#define EOLIAN_GEN_TYPES_H 2#define EOLIAN_GEN_TYPES_H
3 3
4void eo_gen_types_header_gen(const char *eof, Eina_Strbuf *buf,
5 Eina_Bool full, Eina_Bool legacy);
4Eina_Strbuf *eo_gen_class_typedef_gen(const char *eof); 6Eina_Strbuf *eo_gen_class_typedef_gen(const char *eof);
5 7
6#endif 8#endif