summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-13 11:25:49 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-13 11:26:24 +0100
commit01b3803931390633f96bec9d8d62a2b46b3434ef (patch)
treeb6b268474068bd3bdd1b7c748037d004f116e501 /src/bin
parentec73644cb60ab9ccb6cd3c7cc2633f082f14ac6b (diff)
eolian: remove unneeded cruft (struct/enum cannot be a base for alias)
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian/types_generator.c45
1 files changed, 11 insertions, 34 deletions
diff --git a/src/bin/eolian/types_generator.c b/src/bin/eolian/types_generator.c
index b9d561a79e..e323950f24 100644
--- a/src/bin/eolian/types_generator.c
+++ b/src/bin/eolian/types_generator.c
@@ -46,7 +46,7 @@ _desc_generate(const char *desc, Eina_Strbuf *buf)
46} 46}
47 47
48static Eina_Strbuf * 48static Eina_Strbuf *
49_type_generate(const Eolian_Type *tp, Eina_Bool in_typedef, Eina_Bool full) 49_type_generate(const Eolian_Type *tp, Eina_Bool full)
50{ 50{
51 Eina_Strbuf *buf = eina_strbuf_new(); 51 Eina_Strbuf *buf = eina_strbuf_new();
52 _desc_generate(eolian_type_description_get(tp), buf); 52 _desc_generate(eolian_type_description_get(tp), buf);
@@ -55,29 +55,12 @@ _type_generate(const Eolian_Type *tp, Eina_Bool in_typedef, Eina_Bool full)
55 { 55 {
56 case EOLIAN_TYPE_ALIAS: 56 case EOLIAN_TYPE_ALIAS:
57 { 57 {
58 const Eolian_Type *base_tp = eolian_type_base_type_get(tp); 58 char *name = _concat_name(tp);
59 Eolian_Type_Type base_tp_type = eolian_type_type_get(base_tp); 59 Eina_Stringshare *c_type = eolian_type_c_type_named_get(
60 if (base_tp_type == EOLIAN_TYPE_STRUCT || base_tp_type == EOLIAN_TYPE_ENUM) 60 eolian_type_base_type_get(tp), name);
61 { 61 eina_strbuf_append_printf(buf, "typedef %s", c_type);
62 if (!full && !eolian_type_name_get(base_tp)) 62 eina_stringshare_del(c_type);
63 { 63 free(name);
64 eina_strbuf_free(buf);
65 return NULL;
66 }
67 const char *name = eolian_type_name_get(tp);
68 Eina_Strbuf *struct_buf = _type_generate(base_tp, EINA_TRUE, full);
69 eina_strbuf_append_printf(buf, "typedef %s%s%s",
70 eina_strbuf_string_get(struct_buf),
71 name?" ":"", name?name:"");
72 eina_strbuf_free(struct_buf);
73 }
74 else
75 {
76 char *name = _concat_name(tp);
77 Eina_Stringshare *c_type = eolian_type_c_type_named_get(base_tp, name);
78 eina_strbuf_append_printf(buf, "typedef %s", c_type);
79 free(name);
80 }
81 break; 64 break;
82 } 65 }
83 case EOLIAN_TYPE_STRUCT: 66 case EOLIAN_TYPE_STRUCT:
@@ -85,7 +68,7 @@ _type_generate(const Eolian_Type *tp, Eina_Bool in_typedef, Eina_Bool full)
85 { 68 {
86 const Eolian_Struct_Type_Field *member; 69 const Eolian_Struct_Type_Field *member;
87 char *name = _concat_name(tp); 70 char *name = _concat_name(tp);
88 if ((in_typedef && name) || tp_type == EOLIAN_TYPE_STRUCT_OPAQUE || !full) 71 if (tp_type == EOLIAN_TYPE_STRUCT_OPAQUE || !full)
89 { 72 {
90 eina_strbuf_append_printf(buf, "typedef struct _%s %s", name, name); 73 eina_strbuf_append_printf(buf, "typedef struct _%s %s", name, name);
91 free(name); 74 free(name);
@@ -116,12 +99,6 @@ _type_generate(const Eolian_Type *tp, Eina_Bool in_typedef, Eina_Bool full)
116 if (!full) 99 if (!full)
117 break; 100 break;
118 name = _concat_name(tp); 101 name = _concat_name(tp);
119 if (in_typedef)
120 {
121 eina_strbuf_append_printf(buf, "enum %s", name);
122 free(name);
123 break;
124 }
125 char *pre = NULL; 102 char *pre = NULL;
126 eina_strbuf_append_printf(buf, "typedef enum\n{\n"); 103 eina_strbuf_append_printf(buf, "typedef enum\n{\n");
127 if (eolian_type_enum_legacy_prefix_get(tp)) 104 if (eolian_type_enum_legacy_prefix_get(tp))
@@ -188,7 +165,7 @@ types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full)
188 Eina_Iterator *itr = eolian_type_aliases_get_by_file(eo_filename); 165 Eina_Iterator *itr = eolian_type_aliases_get_by_file(eo_filename);
189 EINA_ITERATOR_FOREACH(itr, tp) 166 EINA_ITERATOR_FOREACH(itr, tp)
190 { 167 {
191 Eina_Strbuf *type_buf = _type_generate(tp, EINA_TRUE, full); 168 Eina_Strbuf *type_buf = _type_generate(tp, full);
192 if (type_buf) 169 if (type_buf)
193 { 170 {
194 eina_strbuf_append(buf, eina_strbuf_string_get(type_buf)); 171 eina_strbuf_append(buf, eina_strbuf_string_get(type_buf));
@@ -202,7 +179,7 @@ types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full)
202 itr = eolian_type_structs_get_by_file(eo_filename); 179 itr = eolian_type_structs_get_by_file(eo_filename);
203 EINA_ITERATOR_FOREACH(itr, tp) 180 EINA_ITERATOR_FOREACH(itr, tp)
204 { 181 {
205 Eina_Strbuf *type_buf = _type_generate(tp, EINA_FALSE, full); 182 Eina_Strbuf *type_buf = _type_generate(tp, full);
206 if (type_buf) 183 if (type_buf)
207 { 184 {
208 eina_strbuf_append(buf, eina_strbuf_string_get(type_buf)); 185 eina_strbuf_append(buf, eina_strbuf_string_get(type_buf));
@@ -219,7 +196,7 @@ types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full)
219 itr = eolian_type_enums_get_by_file(eo_filename); 196 itr = eolian_type_enums_get_by_file(eo_filename);
220 EINA_ITERATOR_FOREACH(itr, tp) 197 EINA_ITERATOR_FOREACH(itr, tp)
221 { 198 {
222 Eina_Strbuf *type_buf = _type_generate(tp, EINA_FALSE, EINA_TRUE); 199 Eina_Strbuf *type_buf = _type_generate(tp, EINA_TRUE);
223 if (type_buf) 200 if (type_buf)
224 { 201 {
225 eina_strbuf_append(buf, eina_strbuf_string_get(type_buf)); 202 eina_strbuf_append(buf, eina_strbuf_string_get(type_buf));