diff options
author | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-05-22 17:24:50 +0300 |
---|---|---|
committer | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-05-26 13:56:06 +0300 |
commit | 62082548bc2210e8ebe1cf59127634e00b5ad30f (patch) | |
tree | 1698cf9a65395407987d62fbb6fce3c295c51f85 /src/bin/eolian/eo1_generator.c | |
parent | 1401ce36b6d8a40270641a5094dbf098ed6858c1 (diff) |
Eolian: modify API to allow future scalability
Until now, the functions giving access to class information were taking
the class name as parameter.
Except the fact that we needed to search into a hash table for the internal
class structure, no flexibility is possible.
This change consists in modifying most of the APIs using the class name
with a new Eolian_Class type and adapt the code of the C and C++
generators accordingly.
Diffstat (limited to 'src/bin/eolian/eo1_generator.c')
-rw-r--r-- | src/bin/eolian/eo1_generator.c | 137 |
1 files changed, 67 insertions, 70 deletions
diff --git a/src/bin/eolian/eo1_generator.c b/src/bin/eolian/eo1_generator.c index 7570842443..bae93c6502 100644 --- a/src/bin/eolian/eo1_generator.c +++ b/src/bin/eolian/eo1_generator.c | |||
@@ -93,7 +93,7 @@ tmpl_eo_retdesc[] =" * @return %s\n"; | |||
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | static Eina_Bool | 95 | static Eina_Bool |
96 | eo_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *functext) | 96 | eo_fundef_generate(const Eolian_Class class, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *functext) |
97 | { | 97 | { |
98 | const char *str_dir[] = {"in", "out", "inout"}; | 98 | const char *str_dir[] = {"in", "out", "inout"}; |
99 | const Eina_List *l; | 99 | const Eina_List *l; |
@@ -132,8 +132,8 @@ eo_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function_ | |||
132 | Eina_Strbuf *str_func = eina_strbuf_new(); | 132 | Eina_Strbuf *str_func = eina_strbuf_new(); |
133 | if (scope == EOLIAN_SCOPE_PROTECTED) | 133 | if (scope == EOLIAN_SCOPE_PROTECTED) |
134 | eina_strbuf_append_printf(str_func, "#ifdef %s_PROTECTED\n", capclass); | 134 | eina_strbuf_append_printf(str_func, "#ifdef %s_PROTECTED\n", capclass); |
135 | _template_fill(str_func, tmpl_eo_funcdef_doxygen, classname, funcname, EINA_FALSE); | 135 | _template_fill(str_func, tmpl_eo_funcdef_doxygen, eolian_class_name_get(class), funcname, EINA_FALSE); |
136 | _template_fill(str_func, tmpl_eo_funcdef, classname, funcname, EINA_FALSE); | 136 | _template_fill(str_func, tmpl_eo_funcdef, eolian_class_name_get(class), funcname, EINA_FALSE); |
137 | if (scope == EOLIAN_SCOPE_PROTECTED) | 137 | if (scope == EOLIAN_SCOPE_PROTECTED) |
138 | eina_strbuf_append_printf(str_func, "#endif\n"); | 138 | eina_strbuf_append_printf(str_func, "#endif\n"); |
139 | eina_strbuf_append_printf(str_func, "\n"); | 139 | eina_strbuf_append_printf(str_func, "\n"); |
@@ -233,23 +233,16 @@ eo_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function_ | |||
233 | } | 233 | } |
234 | 234 | ||
235 | Eina_Bool | 235 | Eina_Bool |
236 | eo_header_generate(const char *classname, Eina_Strbuf *buf) | 236 | eo_header_generate(const Eolian_Class class, Eina_Strbuf *buf) |
237 | { | 237 | { |
238 | const Eolian_Function_Type ftype_order[] = {EOLIAN_CTOR, EOLIAN_PROPERTY, EOLIAN_METHOD}; | 238 | const Eolian_Function_Type ftype_order[] = {EOLIAN_CTOR, EOLIAN_PROPERTY, EOLIAN_METHOD}; |
239 | const Eina_List *l; | 239 | const Eina_List *l; |
240 | void *data; | 240 | void *data; |
241 | char *tmpstr = malloc(0x1FF); | 241 | char *tmpstr = malloc(0x1FF); |
242 | Eina_Strbuf * str_hdr = eina_strbuf_new(); | 242 | Eina_Strbuf * str_hdr = eina_strbuf_new(); |
243 | const char *classname = eolian_class_name_get(class); | ||
243 | 244 | ||
244 | if (!eolian_class_exists(classname)) | 245 | const char *desc = eolian_class_description_get(class); |
245 | { | ||
246 | ERR ("Class \"%s\" not found in database", classname); | ||
247 | free(tmpstr); | ||
248 | eina_strbuf_free(str_hdr); | ||
249 | return EINA_FALSE; | ||
250 | } | ||
251 | |||
252 | const char *desc = eolian_class_description_get(classname); | ||
253 | Eina_Strbuf *linedesc = eina_strbuf_new(); | 246 | Eina_Strbuf *linedesc = eina_strbuf_new(); |
254 | eina_strbuf_append(linedesc, "/**\n"); | 247 | eina_strbuf_append(linedesc, "/**\n"); |
255 | if (desc) | 248 | if (desc) |
@@ -274,7 +267,7 @@ eo_header_generate(const char *classname, Eina_Strbuf *buf) | |||
274 | Eina_Strbuf *tmpbuf = eina_strbuf_new(); | 267 | Eina_Strbuf *tmpbuf = eina_strbuf_new(); |
275 | 268 | ||
276 | Eolian_Event event; | 269 | Eolian_Event event; |
277 | EINA_LIST_FOREACH(eolian_class_events_list_get(classname), l, event) | 270 | EINA_LIST_FOREACH(eolian_class_events_list_get(class), l, event) |
278 | { | 271 | { |
279 | const char *evname = NULL; | 272 | const char *evname = NULL; |
280 | const char *evdesc = NULL; | 273 | const char *evdesc = NULL; |
@@ -296,7 +289,7 @@ eo_header_generate(const char *classname, Eina_Strbuf *buf) | |||
296 | 289 | ||
297 | int i; | 290 | int i; |
298 | for (i = 0; i < 3; i++) | 291 | for (i = 0; i < 3; i++) |
299 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, ftype_order[i]), l, data) | 292 | EINA_LIST_FOREACH(eolian_class_functions_list_get(class, ftype_order[i]), l, data) |
300 | { | 293 | { |
301 | const Eolian_Function_Type ftype = eolian_function_type_get((Eolian_Function)data); | 294 | const Eolian_Function_Type ftype = eolian_function_type_get((Eolian_Function)data); |
302 | const char *funcname = eolian_function_name_get((Eolian_Function)data); | 295 | const char *funcname = eolian_function_name_get((Eolian_Function)data); |
@@ -306,19 +299,19 @@ eo_header_generate(const char *classname, Eina_Strbuf *buf) | |||
306 | if (!prop_read && !prop_write) | 299 | if (!prop_read && !prop_write) |
307 | { | 300 | { |
308 | _template_fill(str_subid, tmpl_eo_subid, classname, funcname, EINA_FALSE); | 301 | _template_fill(str_subid, tmpl_eo_subid, classname, funcname, EINA_FALSE); |
309 | eo_fundef_generate(classname, (Eolian_Function)data, EOLIAN_UNRESOLVED, str_hdr); | 302 | eo_fundef_generate(class, (Eolian_Function)data, EOLIAN_UNRESOLVED, str_hdr); |
310 | } | 303 | } |
311 | if (prop_write) | 304 | if (prop_write) |
312 | { | 305 | { |
313 | sprintf(tmpstr, "%s_set", funcname); | 306 | sprintf(tmpstr, "%s_set", funcname); |
314 | _template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE); | 307 | _template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE); |
315 | eo_fundef_generate(classname, (Eolian_Function)data, EOLIAN_PROP_SET, str_hdr); | 308 | eo_fundef_generate(class, (Eolian_Function)data, EOLIAN_PROP_SET, str_hdr); |
316 | } | 309 | } |
317 | if (prop_read) | 310 | if (prop_read) |
318 | { | 311 | { |
319 | sprintf(tmpstr, "%s_get", funcname); | 312 | sprintf(tmpstr, "%s_get", funcname); |
320 | _template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE); | 313 | _template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE); |
321 | eo_fundef_generate(classname, (Eolian_Function)data, EOLIAN_PROP_GET, str_hdr); | 314 | eo_fundef_generate(class, (Eolian_Function)data, EOLIAN_PROP_GET, str_hdr); |
322 | } | 315 | } |
323 | eina_strbuf_replace_all(str_subid, "@#EOPREFIX", current_eo_prefix_upper); | 316 | eina_strbuf_replace_all(str_subid, "@#EOPREFIX", current_eo_prefix_upper); |
324 | } | 317 | } |
@@ -340,7 +333,7 @@ eo_header_generate(const char *classname, Eina_Strbuf *buf) | |||
340 | } | 333 | } |
341 | 334 | ||
342 | static Eina_Bool | 335 | static Eina_Bool |
343 | eo_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, const char *impl_name) | 336 | eo_bind_func_generate(const Eolian_Class class, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, const char *impl_name) |
344 | { | 337 | { |
345 | const char *suffix = ""; | 338 | const char *suffix = ""; |
346 | Eina_Bool var_as_ret = EINA_FALSE; | 339 | Eina_Bool var_as_ret = EINA_FALSE; |
@@ -348,6 +341,7 @@ eo_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Func | |||
348 | const char *retname = NULL; | 341 | const char *retname = NULL; |
349 | Eina_Bool ret_const = EINA_FALSE; | 342 | Eina_Bool ret_const = EINA_FALSE; |
350 | Eina_Bool add_star = EINA_FALSE; | 343 | Eina_Bool add_star = EINA_FALSE; |
344 | const char *classname = eolian_class_name_get(class); | ||
351 | 345 | ||
352 | Eina_Bool need_implementation = EINA_TRUE; | 346 | Eina_Bool need_implementation = EINA_TRUE; |
353 | if (!impl_name && eolian_function_is_virtual_pure(funcid, ftype)) need_implementation = EINA_FALSE; | 347 | if (!impl_name && eolian_function_is_virtual_pure(funcid, ftype)) need_implementation = EINA_FALSE; |
@@ -467,7 +461,7 @@ eo_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Func | |||
467 | if (need_implementation) | 461 | if (need_implementation) |
468 | { | 462 | { |
469 | eina_strbuf_replace_all(fbody, "@#full_params", eina_strbuf_string_get(full_params)); | 463 | eina_strbuf_replace_all(fbody, "@#full_params", eina_strbuf_string_get(full_params)); |
470 | const char *data_type = eolian_class_data_type_get(classname); | 464 | const char *data_type = eolian_class_data_type_get(class); |
471 | if (data_type && !strcmp(data_type, "null")) | 465 | if (data_type && !strcmp(data_type, "null")) |
472 | eina_strbuf_replace_all(fbody, "@#Datatype_Data", "void"); | 466 | eina_strbuf_replace_all(fbody, "@#Datatype_Data", "void"); |
473 | else | 467 | else |
@@ -491,12 +485,12 @@ eo_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Func | |||
491 | } | 485 | } |
492 | 486 | ||
493 | static Eina_Bool | 487 | static Eina_Bool |
494 | eo_func_desc_generate(const char *class_name, const char *impl_name, const char *func_name, Eina_Strbuf *buf) | 488 | eo_func_desc_generate(const Eolian_Class class, const char *impl_name, const char *func_name, Eina_Strbuf *buf) |
495 | { | 489 | { |
496 | if (impl_name) | 490 | if (impl_name) |
497 | _class_func_names_fill(impl_name, func_name); | 491 | _class_func_names_fill(impl_name, func_name); |
498 | else | 492 | else |
499 | _class_func_names_fill(class_name, func_name); | 493 | _class_func_names_fill(eolian_class_name_get(class), func_name); |
500 | eina_strbuf_reset(buf); | 494 | eina_strbuf_reset(buf); |
501 | eina_strbuf_append_printf(buf, | 495 | eina_strbuf_append_printf(buf, |
502 | "\n EO_OP_FUNC(%s_ID(%s_SUB_ID_%s), _eo_obj_%s%s%s_%s),", | 496 | "\n EO_OP_FUNC(%s_ID(%s_SUB_ID_%s), _eo_obj_%s%s%s_%s),", |
@@ -507,14 +501,14 @@ eo_func_desc_generate(const char *class_name, const char *impl_name, const char | |||
507 | } | 501 | } |
508 | 502 | ||
509 | static Eina_Bool | 503 | static Eina_Bool |
510 | eo_op_desc_generate(const char *classname, Eolian_Function fid, Eolian_Function_Type ftype, | 504 | eo_op_desc_generate(const Eolian_Class class, Eolian_Function fid, Eolian_Function_Type ftype, |
511 | const char *desc, Eina_Strbuf *buf) | 505 | const char *desc, Eina_Strbuf *buf) |
512 | { | 506 | { |
513 | const char *funcname = eolian_function_name_get(fid); | 507 | const char *funcname = eolian_function_name_get(fid); |
514 | const char *suffix = ""; | 508 | const char *suffix = ""; |
515 | 509 | ||
516 | eina_strbuf_reset(buf); | 510 | eina_strbuf_reset(buf); |
517 | _class_func_names_fill(classname, funcname); | 511 | _class_func_names_fill(eolian_class_name_get(class), funcname); |
518 | if (ftype == EOLIAN_PROP_GET) suffix = "_get"; | 512 | if (ftype == EOLIAN_PROP_GET) suffix = "_get"; |
519 | if (ftype == EOLIAN_PROP_SET) suffix = "_set"; | 513 | if (ftype == EOLIAN_PROP_SET) suffix = "_set"; |
520 | Eina_Bool is_virtual_pure = eolian_function_is_virtual_pure(fid, ftype); | 514 | Eina_Bool is_virtual_pure = eolian_function_is_virtual_pure(fid, ftype); |
@@ -528,7 +522,7 @@ eo_op_desc_generate(const char *classname, Eolian_Function fid, Eolian_Function_ | |||
528 | } | 522 | } |
529 | 523 | ||
530 | static Eina_Bool | 524 | static Eina_Bool |
531 | eo_source_beginning_generate(const char *classname, Eina_Strbuf *buf) | 525 | eo_source_beginning_generate(const Eolian_Class class, Eina_Strbuf *buf) |
532 | { | 526 | { |
533 | const Eina_List *itr; | 527 | const Eina_List *itr; |
534 | 528 | ||
@@ -536,7 +530,7 @@ eo_source_beginning_generate(const char *classname, Eina_Strbuf *buf) | |||
536 | Eina_Strbuf *str_ev = eina_strbuf_new(); | 530 | Eina_Strbuf *str_ev = eina_strbuf_new(); |
537 | 531 | ||
538 | Eolian_Event event; | 532 | Eolian_Event event; |
539 | EINA_LIST_FOREACH(eolian_class_events_list_get(classname), itr, event) | 533 | EINA_LIST_FOREACH(eolian_class_events_list_get(class), itr, event) |
540 | { | 534 | { |
541 | const char *evname; | 535 | const char *evname; |
542 | const char *evdesc; | 536 | const char *evdesc; |
@@ -544,7 +538,7 @@ eo_source_beginning_generate(const char *classname, Eina_Strbuf *buf) | |||
544 | 538 | ||
545 | eolian_class_event_information_get(event, &evname, NULL, &evdesc); | 539 | eolian_class_event_information_get(event, &evname, NULL, &evdesc); |
546 | evdesc_line1 = _source_desc_get(evdesc); | 540 | evdesc_line1 = _source_desc_get(evdesc); |
547 | _template_fill(str_ev, "@#CLASS_EVENT_@#FUNC", classname, evname, EINA_TRUE); | 541 | _template_fill(str_ev, "@#CLASS_EVENT_@#FUNC", eolian_class_name_get(class), evname, EINA_TRUE); |
548 | eina_strbuf_replace_all(str_ev, ",", "_"); | 542 | eina_strbuf_replace_all(str_ev, ",", "_"); |
549 | 543 | ||
550 | eina_strbuf_append_printf(tmpbuf, | 544 | eina_strbuf_append_printf(tmpbuf, |
@@ -561,14 +555,15 @@ eo_source_beginning_generate(const char *classname, Eina_Strbuf *buf) | |||
561 | } | 555 | } |
562 | 556 | ||
563 | static Eina_Bool | 557 | static Eina_Bool |
564 | eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | 558 | eo_source_end_generate(const Eolian_Class class, Eina_Strbuf *buf) |
565 | { | 559 | { |
566 | Eina_Bool ret = EINA_FALSE; | 560 | Eina_Bool ret = EINA_FALSE; |
567 | const Eina_List *itr; | 561 | const Eina_List *itr; |
568 | Eolian_Function fn; | 562 | Eolian_Function fn; |
563 | const char *classname = eolian_class_name_get(class); | ||
569 | 564 | ||
570 | const char *str_classtype = NULL; | 565 | const char *str_classtype = NULL; |
571 | switch(eolian_class_type_get(classname)) | 566 | switch(eolian_class_type_get(class)) |
572 | { | 567 | { |
573 | case EOLIAN_CLASS_REGULAR: | 568 | case EOLIAN_CLASS_REGULAR: |
574 | str_classtype = "EO_CLASS_TYPE_REGULAR"; | 569 | str_classtype = "EO_CLASS_TYPE_REGULAR"; |
@@ -610,14 +605,14 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
610 | eina_strbuf_replace_all(str_end, "@#ctor_func", eina_strbuf_string_get(tmpbuf)); | 605 | eina_strbuf_replace_all(str_end, "@#ctor_func", eina_strbuf_string_get(tmpbuf)); |
611 | 606 | ||
612 | eina_strbuf_reset(tmpbuf); | 607 | eina_strbuf_reset(tmpbuf); |
613 | if (eolian_class_ctor_enable_get(classname)) | 608 | if (eolian_class_ctor_enable_get(class)) |
614 | _template_fill(tmpbuf, "_@#class_class_constructor", classname, "", EINA_TRUE); | 609 | _template_fill(tmpbuf, "_@#class_class_constructor", classname, "", EINA_TRUE); |
615 | else | 610 | else |
616 | eina_strbuf_append_printf(tmpbuf, "NULL"); | 611 | eina_strbuf_append_printf(tmpbuf, "NULL"); |
617 | eina_strbuf_replace_all(str_end, "@#ctor_name", eina_strbuf_string_get(tmpbuf)); | 612 | eina_strbuf_replace_all(str_end, "@#ctor_name", eina_strbuf_string_get(tmpbuf)); |
618 | 613 | ||
619 | eina_strbuf_reset(tmpbuf); | 614 | eina_strbuf_reset(tmpbuf); |
620 | if (eolian_class_dtor_enable_get(classname)) | 615 | if (eolian_class_dtor_enable_get(class)) |
621 | { | 616 | { |
622 | eina_strbuf_replace_all(str_end, "@#dtor_func", eina_strbuf_string_get(tmpbuf)); | 617 | eina_strbuf_replace_all(str_end, "@#dtor_func", eina_strbuf_string_get(tmpbuf)); |
623 | eina_strbuf_reset(tmpbuf); | 618 | eina_strbuf_reset(tmpbuf); |
@@ -634,23 +629,23 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
634 | 629 | ||
635 | //Implements - TODO one generate func def for all | 630 | //Implements - TODO one generate func def for all |
636 | Eolian_Implement impl_desc; | 631 | Eolian_Implement impl_desc; |
637 | EINA_LIST_FOREACH(eolian_class_implements_list_get(classname), itr, impl_desc) | 632 | EINA_LIST_FOREACH(eolian_class_implements_list_get(class), itr, impl_desc) |
638 | { | 633 | { |
639 | const char *funcname; | 634 | const char *funcname; |
640 | const char *impl_class; | 635 | const char *impl_classname; |
641 | Eolian_Function_Type ftype; | 636 | Eolian_Function_Type ftype; |
642 | 637 | ||
643 | eolian_implement_information_get(impl_desc, &impl_class, &funcname, &ftype); | 638 | eolian_implement_information_get(impl_desc, &impl_classname, &funcname, &ftype); |
644 | 639 | ||
645 | eina_strbuf_reset(tmpl_impl); | 640 | eina_strbuf_reset(tmpl_impl); |
646 | _template_fill(str_func, NULL, impl_class, NULL, EINA_FALSE); /* Invoked to set the variables */ | 641 | _template_fill(str_func, NULL, impl_classname, NULL, EINA_FALSE); /* Invoked to set the variables */ |
647 | eina_strbuf_append(tmpl_impl, tmpl_eo_func_desc); | 642 | eina_strbuf_append(tmpl_impl, tmpl_eo_func_desc); |
648 | eina_strbuf_replace_all(tmpl_impl, "@#EOPREFIX", current_eo_prefix_upper); | 643 | eina_strbuf_replace_all(tmpl_impl, "@#EOPREFIX", current_eo_prefix_upper); |
649 | eina_strbuf_replace_all(tmpl_impl, "@#eoprefix", current_eo_prefix_lower); | 644 | eina_strbuf_replace_all(tmpl_impl, "@#eoprefix", current_eo_prefix_lower); |
650 | 645 | ||
651 | char implname[0xFF]; | 646 | char implname[0xFF]; |
652 | char *tp = implname; | 647 | char *tp = implname; |
653 | sprintf(implname, "%s_%s", classname, impl_class); | 648 | sprintf(implname, "%s_%s", classname, impl_classname); |
654 | eina_str_tolower(&tp); | 649 | eina_str_tolower(&tp); |
655 | 650 | ||
656 | eina_strbuf_replace_all(tmpl_impl, "@#class", implname); | 651 | eina_strbuf_replace_all(tmpl_impl, "@#class", implname); |
@@ -660,16 +655,17 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
660 | Eolian_Function in_prop = NULL; | 655 | Eolian_Function in_prop = NULL; |
661 | const Eina_List *itr2; | 656 | const Eina_List *itr2; |
662 | Eolian_Function fnid; | 657 | Eolian_Function fnid; |
663 | EINA_LIST_FOREACH(eolian_class_functions_list_get((char *)impl_class, EOLIAN_CTOR), itr2, fnid) | 658 | Eolian_Class impl_class = eolian_class_find_by_name(impl_classname); |
659 | EINA_LIST_FOREACH(eolian_class_functions_list_get(impl_class, EOLIAN_CTOR), itr2, fnid) | ||
664 | if (fnid && !strcmp(eolian_function_name_get(fnid), funcname)) in_meth = fnid; | 660 | if (fnid && !strcmp(eolian_function_name_get(fnid), funcname)) in_meth = fnid; |
665 | EINA_LIST_FOREACH(eolian_class_functions_list_get((char *)impl_class, EOLIAN_METHOD), itr2, fnid) | 661 | EINA_LIST_FOREACH(eolian_class_functions_list_get(impl_class, EOLIAN_METHOD), itr2, fnid) |
666 | if (fnid && !strcmp(eolian_function_name_get(fnid), funcname)) in_meth = fnid; | 662 | if (fnid && !strcmp(eolian_function_name_get(fnid), funcname)) in_meth = fnid; |
667 | EINA_LIST_FOREACH(eolian_class_functions_list_get((char *)impl_class, EOLIAN_PROPERTY), itr2, fnid) | 663 | EINA_LIST_FOREACH(eolian_class_functions_list_get(impl_class, EOLIAN_PROPERTY), itr2, fnid) |
668 | if (fnid && !strcmp(eolian_function_name_get(fnid), funcname)) in_prop = fnid; | 664 | if (fnid && !strcmp(eolian_function_name_get(fnid), funcname)) in_prop = fnid; |
669 | 665 | ||
670 | if (!in_meth && !in_prop) | 666 | if (!in_meth && !in_prop) |
671 | { | 667 | { |
672 | ERR ("Failed to generate implementation of %s:%s - missing form super class", impl_class, funcname); | 668 | ERR ("Failed to generate implementation of %s:%s - missing form super class", impl_classname, funcname); |
673 | goto end; | 669 | goto end; |
674 | } | 670 | } |
675 | 671 | ||
@@ -680,8 +676,8 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
680 | 676 | ||
681 | if (in_meth) | 677 | if (in_meth) |
682 | { | 678 | { |
683 | _template_fill(str_op, tmpl_impl_str, impl_class, funcname, EINA_FALSE); | 679 | _template_fill(str_op, tmpl_impl_str, impl_classname, funcname, EINA_FALSE); |
684 | eo_bind_func_generate(classname, in_meth, EOLIAN_UNRESOLVED, str_bodyf, impl_class); | 680 | eo_bind_func_generate(class, in_meth, EOLIAN_UNRESOLVED, str_bodyf, impl_classname); |
685 | continue; | 681 | continue; |
686 | } | 682 | } |
687 | 683 | ||
@@ -697,37 +693,37 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
697 | if (prop_write) | 693 | if (prop_write) |
698 | { | 694 | { |
699 | sprintf(tmpstr, "%s_set", funcname); | 695 | sprintf(tmpstr, "%s_set", funcname); |
700 | _template_fill(str_op, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE); | 696 | _template_fill(str_op, tmpl_impl_str, impl_classname, tmpstr, EINA_FALSE); |
701 | eo_bind_func_generate(classname, in_prop, EOLIAN_PROP_SET, str_bodyf, impl_class); | 697 | eo_bind_func_generate(class, in_prop, EOLIAN_PROP_SET, str_bodyf, impl_classname); |
702 | } | 698 | } |
703 | 699 | ||
704 | if (prop_read) | 700 | if (prop_read) |
705 | { | 701 | { |
706 | sprintf(tmpstr, "%s_get", funcname); | 702 | sprintf(tmpstr, "%s_get", funcname); |
707 | _template_fill(str_op, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE); | 703 | _template_fill(str_op, tmpl_impl_str, impl_classname, tmpstr, EINA_FALSE); |
708 | eo_bind_func_generate(classname, in_prop, EOLIAN_PROP_GET, str_bodyf, impl_class); | 704 | eo_bind_func_generate(class, in_prop, EOLIAN_PROP_GET, str_bodyf, impl_classname); |
709 | } | 705 | } |
710 | } | 706 | } |
711 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 707 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
712 | } | 708 | } |
713 | 709 | ||
714 | //Constructors | 710 | //Constructors |
715 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, EOLIAN_CTOR), itr, fn) | 711 | EINA_LIST_FOREACH(eolian_class_functions_list_get(class, EOLIAN_CTOR), itr, fn) |
716 | { | 712 | { |
717 | const char *funcname = eolian_function_name_get(fn); | 713 | const char *funcname = eolian_function_name_get(fn); |
718 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); | 714 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); |
719 | eo_op_desc_generate(classname, fn, EOLIAN_CTOR, desc, tmpbuf); | 715 | eo_op_desc_generate(class, fn, EOLIAN_CTOR, desc, tmpbuf); |
720 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 716 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
721 | free(desc); | 717 | free(desc); |
722 | 718 | ||
723 | eo_func_desc_generate(classname, NULL, funcname, tmpbuf); | 719 | eo_func_desc_generate(class, NULL, funcname, tmpbuf); |
724 | eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); | 720 | eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); |
725 | 721 | ||
726 | eo_bind_func_generate(classname, fn, EOLIAN_UNRESOLVED, str_bodyf, NULL); | 722 | eo_bind_func_generate(class, fn, EOLIAN_UNRESOLVED, str_bodyf, NULL); |
727 | } | 723 | } |
728 | 724 | ||
729 | //Properties | 725 | //Properties |
730 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, EOLIAN_PROPERTY), itr, fn) | 726 | EINA_LIST_FOREACH(eolian_class_functions_list_get(class, EOLIAN_PROPERTY), itr, fn) |
731 | { | 727 | { |
732 | const char *funcname = eolian_function_name_get(fn); | 728 | const char *funcname = eolian_function_name_get(fn); |
733 | const Eolian_Function_Type ftype = eolian_function_type_get(fn); | 729 | const Eolian_Function_Type ftype = eolian_function_type_get(fn); |
@@ -741,12 +737,12 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
741 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set")); | 737 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set")); |
742 | 738 | ||
743 | sprintf(tmpstr, "%s_set", funcname); | 739 | sprintf(tmpstr, "%s_set", funcname); |
744 | eo_op_desc_generate(classname, fn, EOLIAN_PROP_SET, desc, tmpbuf); | 740 | eo_op_desc_generate(class, fn, EOLIAN_PROP_SET, desc, tmpbuf); |
745 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 741 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
746 | free(desc); | 742 | free(desc); |
747 | 743 | ||
748 | if (!eolian_function_is_virtual_pure(fn, EOLIAN_PROP_SET)) | 744 | if (!eolian_function_is_virtual_pure(fn, EOLIAN_PROP_SET)) |
749 | eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf); | 745 | eo_func_desc_generate(class, NULL, tmpstr, tmpbuf); |
750 | else | 746 | else |
751 | eina_strbuf_reset(tmpbuf); | 747 | eina_strbuf_reset(tmpbuf); |
752 | eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); | 748 | eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); |
@@ -756,12 +752,12 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
756 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get")); | 752 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get")); |
757 | 753 | ||
758 | sprintf(tmpstr, "%s_get", funcname); | 754 | sprintf(tmpstr, "%s_get", funcname); |
759 | eo_op_desc_generate(classname, fn, EOLIAN_PROP_GET, desc, tmpbuf); | 755 | eo_op_desc_generate(class, fn, EOLIAN_PROP_GET, desc, tmpbuf); |
760 | free(desc); | 756 | free(desc); |
761 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 757 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
762 | 758 | ||
763 | if (!eolian_function_is_virtual_pure(fn, EOLIAN_PROP_GET)) | 759 | if (!eolian_function_is_virtual_pure(fn, EOLIAN_PROP_GET)) |
764 | eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf); | 760 | eo_func_desc_generate(class, NULL, tmpstr, tmpbuf); |
765 | else | 761 | else |
766 | eina_strbuf_reset(tmpbuf); | 762 | eina_strbuf_reset(tmpbuf); |
767 | eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); | 763 | eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); |
@@ -769,24 +765,24 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
769 | } | 765 | } |
770 | 766 | ||
771 | //Methods | 767 | //Methods |
772 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, EOLIAN_METHOD), itr, fn) | 768 | EINA_LIST_FOREACH(eolian_class_functions_list_get(class, EOLIAN_METHOD), itr, fn) |
773 | { | 769 | { |
774 | const char *funcname = eolian_function_name_get(fn); | 770 | const char *funcname = eolian_function_name_get(fn); |
775 | 771 | ||
776 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); | 772 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); |
777 | eo_op_desc_generate(classname, fn, EOLIAN_METHOD, desc, tmpbuf); | 773 | eo_op_desc_generate(class, fn, EOLIAN_METHOD, desc, tmpbuf); |
778 | free(desc); | 774 | free(desc); |
779 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 775 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
780 | 776 | ||
781 | if (!eolian_function_is_virtual_pure(fn, EOLIAN_METHOD)) | 777 | if (!eolian_function_is_virtual_pure(fn, EOLIAN_METHOD)) |
782 | eo_func_desc_generate(classname, NULL, funcname, tmpbuf); | 778 | eo_func_desc_generate(class, NULL, funcname, tmpbuf); |
783 | else | 779 | else |
784 | eina_strbuf_reset(tmpbuf); | 780 | eina_strbuf_reset(tmpbuf); |
785 | eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); | 781 | eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); |
786 | } | 782 | } |
787 | 783 | ||
788 | Eolian_Event event; | 784 | Eolian_Event event; |
789 | EINA_LIST_FOREACH(eolian_class_events_list_get(classname), itr, event) | 785 | EINA_LIST_FOREACH(eolian_class_events_list_get(class), itr, event) |
790 | { | 786 | { |
791 | const char *evname; | 787 | const char *evname; |
792 | 788 | ||
@@ -815,9 +811,10 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
815 | 811 | ||
816 | const char *inherit_name; | 812 | const char *inherit_name; |
817 | eina_strbuf_reset(tmpbuf); | 813 | eina_strbuf_reset(tmpbuf); |
818 | EINA_LIST_FOREACH(eolian_class_inherits_list_get(classname), itr, inherit_name) | 814 | EINA_LIST_FOREACH(eolian_class_inherits_list_get(class), itr, inherit_name) |
819 | { | 815 | { |
820 | const char *eo_prefix = eolian_class_eo_prefix_get(inherit_name); | 816 | Eolian_Class inherit_class = eolian_class_find_by_name(inherit_name); |
817 | const char *eo_prefix = eolian_class_eo_prefix_get(inherit_class); | ||
821 | if (!eo_prefix) eo_prefix = inherit_name; | 818 | if (!eo_prefix) eo_prefix = inherit_name; |
822 | _template_fill(tmpbuf, "@#EOPREFIX_CLASS, ", eo_prefix, "", EINA_FALSE); | 819 | _template_fill(tmpbuf, "@#EOPREFIX_CLASS, ", eo_prefix, "", EINA_FALSE); |
823 | eina_strbuf_replace_all(tmpbuf, "@#EOPREFIX", current_eo_prefix_upper); | 820 | eina_strbuf_replace_all(tmpbuf, "@#EOPREFIX", current_eo_prefix_upper); |
@@ -849,7 +846,7 @@ eo_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
849 | eina_strbuf_replace_all(str_end, "@#functions_body", eina_strbuf_string_get(str_bodyf)); | 846 | eina_strbuf_replace_all(str_end, "@#functions_body", eina_strbuf_string_get(str_bodyf)); |
850 | eina_strbuf_replace_all(str_end, "@#eo_class_desc_ops", eina_strbuf_string_get(tmpbuf)); | 847 | eina_strbuf_replace_all(str_end, "@#eo_class_desc_ops", eina_strbuf_string_get(tmpbuf)); |
851 | 848 | ||
852 | const char *data_type = eolian_class_data_type_get(classname); | 849 | const char *data_type = eolian_class_data_type_get(class); |
853 | if (data_type && !strcmp(data_type, "null")) | 850 | if (data_type && !strcmp(data_type, "null")) |
854 | eina_strbuf_replace_all(str_end, "@#SizeOfData", "0"); | 851 | eina_strbuf_replace_all(str_end, "@#SizeOfData", "0"); |
855 | else | 852 | else |
@@ -877,7 +874,7 @@ end: | |||
877 | } | 874 | } |
878 | 875 | ||
879 | Eina_Bool | 876 | Eina_Bool |
880 | eo_source_generate(const char *classname, Eina_Strbuf *buf) | 877 | eo_source_generate(const Eolian_Class class, Eina_Strbuf *buf) |
881 | { | 878 | { |
882 | Eina_Bool ret = EINA_FALSE; | 879 | Eina_Bool ret = EINA_FALSE; |
883 | const Eina_List *itr; | 880 | const Eina_List *itr; |
@@ -885,10 +882,10 @@ eo_source_generate(const char *classname, Eina_Strbuf *buf) | |||
885 | 882 | ||
886 | Eina_Strbuf *str_bodyf = eina_strbuf_new(); | 883 | Eina_Strbuf *str_bodyf = eina_strbuf_new(); |
887 | 884 | ||
888 | if (!eo_source_beginning_generate(classname, buf)) goto end; | 885 | if (!eo_source_beginning_generate(class, buf)) goto end; |
889 | 886 | ||
890 | //Properties | 887 | //Properties |
891 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, EOLIAN_PROPERTY), itr, fn) | 888 | EINA_LIST_FOREACH(eolian_class_functions_list_get(class, EOLIAN_PROPERTY), itr, fn) |
892 | { | 889 | { |
893 | const Eolian_Function_Type ftype = eolian_function_type_get(fn); | 890 | const Eolian_Function_Type ftype = eolian_function_type_get(fn); |
894 | 891 | ||
@@ -897,24 +894,24 @@ eo_source_generate(const char *classname, Eina_Strbuf *buf) | |||
897 | 894 | ||
898 | if (prop_write) | 895 | if (prop_write) |
899 | { | 896 | { |
900 | if (!eo_bind_func_generate(classname, fn, EOLIAN_PROP_SET, str_bodyf, NULL)) goto end; | 897 | if (!eo_bind_func_generate(class, fn, EOLIAN_PROP_SET, str_bodyf, NULL)) goto end; |
901 | } | 898 | } |
902 | if (prop_read) | 899 | if (prop_read) |
903 | { | 900 | { |
904 | if (!eo_bind_func_generate(classname, fn, EOLIAN_PROP_GET, str_bodyf, NULL)) goto end; | 901 | if (!eo_bind_func_generate(class, fn, EOLIAN_PROP_GET, str_bodyf, NULL)) goto end; |
905 | } | 902 | } |
906 | } | 903 | } |
907 | 904 | ||
908 | //Methods | 905 | //Methods |
909 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, EOLIAN_METHOD), itr, fn) | 906 | EINA_LIST_FOREACH(eolian_class_functions_list_get(class, EOLIAN_METHOD), itr, fn) |
910 | { | 907 | { |
911 | if (!eo_bind_func_generate(classname, fn, EOLIAN_UNRESOLVED, str_bodyf, NULL)) goto end; | 908 | if (!eo_bind_func_generate(class, fn, EOLIAN_UNRESOLVED, str_bodyf, NULL)) goto end; |
912 | } | 909 | } |
913 | 910 | ||
914 | eina_strbuf_append(buf, eina_strbuf_string_get(str_bodyf)); | 911 | eina_strbuf_append(buf, eina_strbuf_string_get(str_bodyf)); |
915 | eina_strbuf_reset(str_bodyf); | 912 | eina_strbuf_reset(str_bodyf); |
916 | 913 | ||
917 | if (!eo_source_end_generate(classname, buf)) goto end; | 914 | if (!eo_source_end_generate(class, buf)) goto end; |
918 | 915 | ||
919 | ret = EINA_TRUE; | 916 | ret = EINA_TRUE; |
920 | end: | 917 | end: |