summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-10-06 14:46:07 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-10-07 11:54:23 +0200
commit08e270391766e210e346dfcee2ed224a982b0223 (patch)
treef2a5d9ab6a5cc6e9a1ef9b1f039f7d68fb646bd8 /src
parent9cc0ca20f4fc2f95bceda1168181f424c5240c4a (diff)
downloadefl-08e270391766e210e346dfcee2ed224a982b0223.tar.gz
eolian gen2: fully implement the main func for impl gen
Diffstat (limited to 'src')
-rw-r--r--src/bin/eolian2/sources.c75
1 files changed, 72 insertions, 3 deletions
diff --git a/src/bin/eolian2/sources.c b/src/bin/eolian2/sources.c
index 7ce03e0eb0..dfcf224371 100644
--- a/src/bin/eolian2/sources.c
+++ b/src/bin/eolian2/sources.c
@@ -813,14 +813,21 @@ eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf)
eina_hash_free(_funcs_params_init);
}
+static void
+_gen_proto(const Eolian_Class *cl, const Eolian_Function *fid,
+ Eolian_Function_Type ftype, Eina_Strbuf *buf,
+ const Eolian_Implement *impl, const char *dtype)
+{
+}
+
void
eo_gen_impl_gen(const Eolian_Class *cl, Eina_Strbuf *buf)
{
if (!cl)
return;
- char *cname = NULL, *cnameu = NULL, *cnamel = NULL;
- eo_gen_class_names_get(cl, &cname, &cnameu, &cnamel);
+ char *cname = NULL, *cnamel = NULL;
+ eo_gen_class_names_get(cl, &cname, NULL, &cnamel);
Eina_Strbuf *beg = eina_strbuf_new();
@@ -860,7 +867,69 @@ eo_gen_impl_gen(const Eolian_Class *cl, Eina_Strbuf *buf)
eina_strbuf_free(beg);
+ /* method section */
+ {
+ Eina_Iterator *itr = eolian_class_implements_get(cl);
+ const Eolian_Implement *imp;
+ EINA_ITERATOR_FOREACH(itr, imp)
+ {
+ Eolian_Function_Type ftype = EOLIAN_UNRESOLVED;
+ const Eolian_Function *fid = eolian_implement_function_get(imp, &ftype);
+ switch (ftype)
+ {
+ case EOLIAN_PROP_GET:
+ case EOLIAN_PROP_SET:
+ _gen_proto(cl, fid, ftype, buf, imp, adt);
+ break;
+ case EOLIAN_PROPERTY:
+ _gen_proto(cl, fid, EOLIAN_PROP_SET, buf, imp, adt);
+ _gen_proto(cl, fid, EOLIAN_PROP_GET, buf, imp, adt);
+ break;
+ default:
+ _gen_proto(cl, fid, EOLIAN_UNRESOLVED, buf, imp, adt);
+ }
+ }
+ eina_iterator_free(itr);
+ }
+
+ if (eolian_class_ctor_enable_get(cl))
+ {
+ char fname[128];
+ snprintf(fname, sizeof(fname), "_%s_class_constructor", cnamel);
+ if (!_function_exists(fname, buf))
+ {
+ printf("generating function %s...\n", fname);
+ eina_strbuf_append_printf(buf,
+ "EOLIAN static void\n"
+ "_%s_class_constructor(Efl_Class *klass)\n"
+ "{\n"
+ "}\n\n", cnamel);
+ }
+ }
+
+ if (eolian_class_dtor_enable_get(cl))
+ {
+ char fname[128];
+ snprintf(fname, sizeof(fname), "_%s_class_destructor", cnamel);
+ if (!_function_exists(fname, buf))
+ {
+ printf("generating function %s...\n", fname);
+ eina_strbuf_append_printf(buf,
+ "EOLIAN static void\n"
+ "_%s_class_destructor(Efl_Class *klass)\n"
+ "{\n"
+ "}\n\n", cnamel);
+ }
+ }
+
+ printf("removing includes for \"%s.eo.c\"\n", cnamel);
+ char ibuf[512];
+ snprintf(ibuf, sizeof(ibuf), "\n#include \"%s.eo.c\"\n", cnamel);
+ eina_strbuf_replace_all(buf, ibuf, "\n");
+
+ printf("generating include for \"%s.eo.c\"\n", cnamel);
+ eina_strbuf_append_printf(buf, "#include \"%s.eo.c\"\n", cnamel);
+
free(cname);
- free(cnameu);
free(cnamel);
}