summaryrefslogtreecommitdiff
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-08-01 15:11:28 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-08-21 09:26:03 +0100
commitbb24b606380747e795aec3f468833bde3327dab1 (patch)
tree662a74a0bbd07c1983308442df2ca93da6b21d58 /src/bin/eolian
parentac2ea63867c2ea50608158c095e28e31ab271b01 (diff)
eolian: generate implicit typedef for each class
And use these typedefs instead of just Eo in API.
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/main.c18
-rw-r--r--src/bin/eolian/types_generator.c14
-rw-r--r--src/bin/eolian/types_generator.h2
3 files changed, 34 insertions, 0 deletions
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 0b288d1d38..bcd13fc482 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -126,6 +126,15 @@ _generate_eo_header_file(char *filename, const char *eo_filename)
126 buffer = _include_guard_enclose(eo_filename, "TYPES", buffer); 126 buffer = _include_guard_enclose(eo_filename, "TYPES", buffer);
127 } 127 }
128 128
129 Eina_Strbuf *ctbuf = eina_strbuf_new();
130 if (types_class_typedef_generate(eo_filename, ctbuf))
131 {
132 ctbuf = _include_guard_enclose(eo_filename, "CLASS_TYPE", ctbuf);
133 eina_strbuf_append_char(ctbuf, '\n');
134 eina_strbuf_prepend(buffer, eina_strbuf_string_get(ctbuf));
135 }
136 eina_strbuf_free(ctbuf);
137
129 const Eolian_Class *class = eolian_class_get_by_file(eo_filename); 138 const Eolian_Class *class = eolian_class_get_by_file(eo_filename);
130 if (class) 139 if (class)
131 { 140 {
@@ -218,6 +227,15 @@ _generate_legacy_header_file(char *filename, const char *eo_filename)
218 goto end; 227 goto end;
219 } 228 }
220 229
230 Eina_Strbuf *ctbuf = eina_strbuf_new();
231 if (types_class_typedef_generate(eo_filename, ctbuf))
232 {
233 ctbuf = _include_guard_enclose(eo_filename, "CLASS_TYPE", ctbuf);
234 eina_strbuf_append_char(ctbuf, '\n');
235 eina_strbuf_prepend(buffer, eina_strbuf_string_get(ctbuf));
236 }
237 eina_strbuf_free(ctbuf);
238
221 const Eolian_Class *class = eolian_class_get_by_file(eo_filename); 239 const Eolian_Class *class = eolian_class_get_by_file(eo_filename);
222 if (class) 240 if (class)
223 { 241 {
diff --git a/src/bin/eolian/types_generator.c b/src/bin/eolian/types_generator.c
index f5adcce192..7f42362467 100644
--- a/src/bin/eolian/types_generator.c
+++ b/src/bin/eolian/types_generator.c
@@ -132,3 +132,17 @@ types_header_generate(const char *eo_filename, Eina_Strbuf *buf)
132 eina_iterator_free(itr); 132 eina_iterator_free(itr);
133 return EINA_TRUE; 133 return EINA_TRUE;
134} 134}
135
136Eina_Bool
137types_class_typedef_generate(const char *eo_filename, Eina_Strbuf *buf)
138{
139 const Eolian_Class *class = eolian_class_get_by_file(eo_filename);
140 if (!class)
141 return EINA_FALSE;
142
143 static _eolian_class_vars class_env;
144 _class_env_create(class, NULL, &class_env);
145
146 eina_strbuf_append_printf(buf, "typedef Eo %s;\n", class_env.full_classname);
147 return EINA_TRUE;
148}
diff --git a/src/bin/eolian/types_generator.h b/src/bin/eolian/types_generator.h
index 6738b022c2..2e07b2057f 100644
--- a/src/bin/eolian/types_generator.h
+++ b/src/bin/eolian/types_generator.h
@@ -14,5 +14,7 @@
14 */ 14 */
15Eina_Bool types_header_generate(const char *eo_filename, Eina_Strbuf *buf); 15Eina_Bool types_header_generate(const char *eo_filename, Eina_Strbuf *buf);
16 16
17Eina_Bool types_class_typedef_generate(const char *eo_filename, Eina_Strbuf *buf);
18
17#endif 19#endif
18 20