summaryrefslogtreecommitdiff
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-16 13:09:17 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-16 13:09:17 +0900
commitd444e8f5f395d25b255ee9e927e22458cd8738bc (patch)
treea3f8951c94d7e383fe4e3e6348ab48755b96803e /src/bin/eolian
parent401d788bd6ba43f8865dae2b98247d2bf678d4eb (diff)
eolain_gen - fix implementation generation - it didn't even compile
so the test suites were useless because they didn't ecompile what was generated. it was missing a ) at the end of calling eo_do_super to start with. it was missing a call to do_uper fo destructors too. also it didnt deal with the #include "blah.eo.c" at the file end either so it produced uncompilable src at the start. again - also fix. this also fixes test case comparisons to match the now correct generation that compiles.
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/impl_generator.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/bin/eolian/impl_generator.c b/src/bin/eolian/impl_generator.c
index 2b7aa2bb95..d43fd7c32d 100644
--- a/src/bin/eolian/impl_generator.c
+++ b/src/bin/eolian/impl_generator.c
@@ -122,6 +122,8 @@ _prototype_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina
122 Eina_Strbuf *params = NULL, *short_params = NULL, *super_invok = NULL; 122 Eina_Strbuf *params = NULL, *short_params = NULL, *super_invok = NULL;
123 char func_name[PATH_MAX]; 123 char func_name[PATH_MAX];
124 char impl_name[PATH_MAX]; 124 char impl_name[PATH_MAX];
125 const char *fname;
126 int flen;
125 _eolian_class_vars impl_env; 127 _eolian_class_vars impl_env;
126 128
127 if (!impl_desc && eolian_function_is_virtual_pure(foo, ftype)) return EINA_TRUE; 129 if (!impl_desc && eolian_function_is_virtual_pure(foo, ftype)) return EINA_TRUE;
@@ -171,12 +173,26 @@ _prototype_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina
171 if (impl_desc && ftype == EOLIAN_CTOR) 173 if (impl_desc && ftype == EOLIAN_CTOR)
172 { 174 {
173 eina_strbuf_append_printf(super_invok, 175 eina_strbuf_append_printf(super_invok,
174 " eo_do_super(obj, %s_%s, %s_%s(%s);\n", 176 " eo_do_super(obj, %s_%s, %s_%s(%s));\n",
175 class_env.upper_eo_prefix, class_env.upper_classtype, 177 class_env.upper_eo_prefix, class_env.upper_classtype,
176 impl_env.lower_classname, eolian_function_name_get(foo), 178 impl_env.lower_eo_prefix, eolian_function_name_get(foo),
177 eina_strbuf_string_get(short_params)); 179 eina_strbuf_string_get(short_params));
178 } 180 }
179 181
182 fname = eolian_function_name_get(foo);
183 flen = strlen(fname);
184 if ((fname) && (flen >= strlen("destructor")))
185 {
186 if (impl_desc && !strcmp(fname + flen - strlen("destructor"), "destructor"))
187 {
188 eina_strbuf_append_printf(super_invok,
189 " eo_do_super(obj, %s_%s, %s_%s(%s));\n",
190 class_env.upper_eo_prefix, class_env.upper_classtype,
191 impl_env.lower_eo_prefix, eolian_function_name_get(foo),
192 eina_strbuf_string_get(short_params));
193 }
194 }
195
180 const char *rettype = NULL; 196 const char *rettype = NULL;
181 if (rettypet) rettype = eolian_type_c_type_get(rettypet); 197 if (rettypet) rettype = eolian_type_c_type_get(rettypet);
182 198
@@ -209,6 +225,7 @@ impl_source_generate(const Eolian_Class *class, Eina_Strbuf *buffer)
209 const Eolian_Function *foo; 225 const Eolian_Function *foo;
210 Eina_Strbuf *begin = eina_strbuf_new(); 226 Eina_Strbuf *begin = eina_strbuf_new();
211 const char *class_name = eolian_class_name_get(class); 227 const char *class_name = eolian_class_name_get(class);
228 char core_incl[PATH_MAX];
212 229
213 _class_env_create(class, NULL, &class_env); 230 _class_env_create(class, NULL, &class_env);
214 231
@@ -329,6 +346,13 @@ impl_source_generate(const Eolian_Class *class, Eina_Strbuf *buffer)
329 class_env.lower_classname); 346 class_env.lower_classname);
330 } 347 }
331 } 348 }
349 printf("Removal of all inline instances of #include \"%s.eo.c\"\n", class_env.lower_classname);
350 snprintf(core_incl, sizeof(core_incl), "\n#include \"%s.eo.c\"\n", class_env.lower_classname);
351 eina_strbuf_replace_all(buffer, core_incl, "\n");
352
353 snprintf(core_incl, sizeof(core_incl), "\"%s.eo.c\"", class_env.lower_classname);
354 printf("Generation of #include \"%s.eo.c\"\n", class_env.lower_classname);
355 eina_strbuf_append_printf(buffer, "#include \"%s.eo.c\"\n", class_env.lower_classname);
332 356
333 ret = EINA_TRUE; 357 ret = EINA_TRUE;
334end: 358end: