summaryrefslogtreecommitdiff
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
parent9cc0ca20f4fc2f95bceda1168181f424c5240c4a (diff)
eolian gen2: fully implement the main func for impl gen
-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)
813 eina_hash_free(_funcs_params_init); 813 eina_hash_free(_funcs_params_init);
814} 814}
815 815
816static void
817_gen_proto(const Eolian_Class *cl, const Eolian_Function *fid,
818 Eolian_Function_Type ftype, Eina_Strbuf *buf,
819 const Eolian_Implement *impl, const char *dtype)
820{
821}
822
816void 823void
817eo_gen_impl_gen(const Eolian_Class *cl, Eina_Strbuf *buf) 824eo_gen_impl_gen(const Eolian_Class *cl, Eina_Strbuf *buf)
818{ 825{
819 if (!cl) 826 if (!cl)
820 return; 827 return;
821 828
822 char *cname = NULL, *cnameu = NULL, *cnamel = NULL; 829 char *cname = NULL, *cnamel = NULL;
823 eo_gen_class_names_get(cl, &cname, &cnameu, &cnamel); 830 eo_gen_class_names_get(cl, &cname, NULL, &cnamel);
824 831
825 Eina_Strbuf *beg = eina_strbuf_new(); 832 Eina_Strbuf *beg = eina_strbuf_new();
826 833
@@ -860,7 +867,69 @@ eo_gen_impl_gen(const Eolian_Class *cl, Eina_Strbuf *buf)
860 867
861 eina_strbuf_free(beg); 868 eina_strbuf_free(beg);
862 869
870 /* method section */
871 {
872 Eina_Iterator *itr = eolian_class_implements_get(cl);
873 const Eolian_Implement *imp;
874 EINA_ITERATOR_FOREACH(itr, imp)
875 {
876 Eolian_Function_Type ftype = EOLIAN_UNRESOLVED;
877 const Eolian_Function *fid = eolian_implement_function_get(imp, &ftype);
878 switch (ftype)
879 {
880 case EOLIAN_PROP_GET:
881 case EOLIAN_PROP_SET:
882 _gen_proto(cl, fid, ftype, buf, imp, adt);
883 break;
884 case EOLIAN_PROPERTY:
885 _gen_proto(cl, fid, EOLIAN_PROP_SET, buf, imp, adt);
886 _gen_proto(cl, fid, EOLIAN_PROP_GET, buf, imp, adt);
887 break;
888 default:
889 _gen_proto(cl, fid, EOLIAN_UNRESOLVED, buf, imp, adt);
890 }
891 }
892 eina_iterator_free(itr);
893 }
894
895 if (eolian_class_ctor_enable_get(cl))
896 {
897 char fname[128];
898 snprintf(fname, sizeof(fname), "_%s_class_constructor", cnamel);
899 if (!_function_exists(fname, buf))
900 {
901 printf("generating function %s...\n", fname);
902 eina_strbuf_append_printf(buf,
903 "EOLIAN static void\n"
904 "_%s_class_constructor(Efl_Class *klass)\n"
905 "{\n"
906 "}\n\n", cnamel);
907 }
908 }
909
910 if (eolian_class_dtor_enable_get(cl))
911 {
912 char fname[128];
913 snprintf(fname, sizeof(fname), "_%s_class_destructor", cnamel);
914 if (!_function_exists(fname, buf))
915 {
916 printf("generating function %s...\n", fname);
917 eina_strbuf_append_printf(buf,
918 "EOLIAN static void\n"
919 "_%s_class_destructor(Efl_Class *klass)\n"
920 "{\n"
921 "}\n\n", cnamel);
922 }
923 }
924
925 printf("removing includes for \"%s.eo.c\"\n", cnamel);
926 char ibuf[512];
927 snprintf(ibuf, sizeof(ibuf), "\n#include \"%s.eo.c\"\n", cnamel);
928 eina_strbuf_replace_all(buf, ibuf, "\n");
929
930 printf("generating include for \"%s.eo.c\"\n", cnamel);
931 eina_strbuf_append_printf(buf, "#include \"%s.eo.c\"\n", cnamel);
932
863 free(cname); 933 free(cname);
864 free(cnameu);
865 free(cnamel); 934 free(cnamel);
866} 935}