summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackDanielZ <daniel.zaoui@yahoo.com>2014-09-23 23:39:13 +0300
committerYakov Goldberg <yakov.g@samsung.com>2014-10-02 15:24:00 +0300
commit2680924fa59e6d797194239d1e1ff8a9b9082b3b (patch)
treed6d1cee21246b377b2816a707903086f53d5338b
parent1c18e897d17c527b3829e5f2e56f4b2afeacf8bd (diff)
Main Widgets: generation of the structures specific to the main widgets
-rw-r--r--src/lib/generator.c200
1 files changed, 131 insertions, 69 deletions
diff --git a/src/lib/generator.c b/src/lib/generator.c
index 6c0171c..1735aba 100644
--- a/src/lib/generator.c
+++ b/src/lib/generator.c
@@ -1,3 +1,4 @@
1#include <ctype.h>
1 2
2#include "egui_log.h" 3#include "egui_log.h"
3 4
@@ -17,9 +18,9 @@ typedef struct
17 Eina_Strbuf *c_buf; /* buffer for source */ 18 Eina_Strbuf *c_buf; /* buffer for source */
18 Eina_Strbuf *h_buf; /* buffer for headers */ 19 Eina_Strbuf *h_buf; /* buffer for headers */
19 Eina_List *global_entities; /* widgets ids which must be global */ 20 Eina_List *global_entities; /* widgets ids which must be global */
20 Eina_List *public_entities; /* widgets ids which must be public */
21 Eina_List *public_main_wdgs; 21 Eina_List *public_main_wdgs;
22 char *formatted_project_name; 22 char *formatted_project_name;
23 char *Formatted_Project_Name;
23 Gui_Session *session; 24 Gui_Session *session;
24} Global_Gen_Context; 25} Global_Gen_Context;
25 26
@@ -27,6 +28,8 @@ typedef struct
27{ 28{
28 Global_Gen_Context *gl_ctx; 29 Global_Gen_Context *gl_ctx;
29 Eina_Strbuf *buf; 30 Eina_Strbuf *buf;
31 Eina_Strbuf *main_widgets_declaration;
32 Dep_Id *id;
30} Sequence_Context; 33} Sequence_Context;
31 34
32/* Structure to hold data about func being generated for a main widget. */ 35/* Structure to hold data about func being generated for a main widget. */
@@ -34,7 +37,11 @@ typedef struct
34{ 37{
35 Global_Gen_Context *gl_ctx; 38 Global_Gen_Context *gl_ctx;
36 Eina_List *declarations; /* List of the variables declared inside the function. */ 39 Eina_List *declarations; /* List of the variables declared inside the function. */
40 Eina_Strbuf *pub_widgets_buf;
41 Eina_Strbuf *full_function_name;
42 Eina_Strbuf *Full_Function_Name;
37 Eina_Strbuf *buf; 43 Eina_Strbuf *buf;
44 Dep_Id *id;
38} Widget_Context; 45} Widget_Context;
39 46
40/* Check if current dep_id is in list of Dep_Ids */ 47/* Check if current dep_id is in list of Dep_Ids */
@@ -57,7 +64,7 @@ _project_name_format(const char *in_str)
57 eina_strbuf_append_printf(buf, "%s", in_str); 64 eina_strbuf_append_printf(buf, "%s", in_str);
58 eina_strbuf_replace_all(buf, " ", "_"); 65 eina_strbuf_replace_all(buf, " ", "_");
59 eina_strbuf_replace_all(buf, "-", "_"); 66 eina_strbuf_replace_all(buf, "-", "_");
60 char *ret = strdup((char *) eina_strbuf_string_get(buf)); 67 char *ret = eina_strbuf_string_steal(buf);
61 eina_str_tolower(&ret); 68 eina_str_tolower(&ret);
62 eina_strbuf_free(buf); 69 eina_strbuf_free(buf);
63 return ret; 70 return ret;
@@ -326,8 +333,8 @@ _item_iterate(Gui_Session *session, Widget_Context *wdg_ctx, const Gui_Widget *w
326 333
327 if (item_container_item_public_get(wit)) 334 if (item_container_item_public_get(wit))
328 { 335 {
329 eina_strbuf_append_printf(wdg_ctx->buf, " %s.%s = %s;\n", PUB_WIDGETS, item_name, item_name); 336 eina_strbuf_append_printf(wdg_ctx->buf, " %s->%s = %s;\n", PUB_WIDGETS, item_name, item_name);
330 wdg_ctx->gl_ctx->public_entities = eina_list_append(wdg_ctx->gl_ctx->public_entities, wit_id); 337 eina_strbuf_append_printf(wdg_ctx->pub_widgets_buf, " Elm_Object_Item *%s;\n", item_name);
331 } 338 }
332 339
333 Dep_Id *dep_id_itr; 340 Dep_Id *dep_id_itr;
@@ -369,7 +376,7 @@ _wdg_add_generate(Gui_Session *session, const Gui_Widget *wdg, void *data)
369 const char *parent_id = wdg_parent_name_get(wdg); 376 const char *parent_id = wdg_parent_name_get(wdg);
370 Eina_Stringshare *class_id; 377 Eina_Stringshare *class_id;
371 378
372 if (!parent_id) parent_id = "NULL"; 379 if (!parent_id) parent_id = "__main_parent";
373 380
374 class_id = wdg_class_name_get(wdg); 381 class_id = wdg_class_name_get(wdg);
375 if (!class_id) 382 if (!class_id)
@@ -416,8 +423,8 @@ _wdg_add_generate(Gui_Session *session, const Gui_Widget *wdg, void *data)
416 } 423 }
417 if (wdg_public_get(wdg)) 424 if (wdg_public_get(wdg))
418 { 425 {
419 eina_strbuf_append_printf(wdg_ctx->buf, " %s.%s = %s;\n", PUB_WIDGETS, wdg_name_get(wdg), wdg_name_get(wdg)); 426 eina_strbuf_append_printf(wdg_ctx->buf, " %s->%s = %s;\n", PUB_WIDGETS, wdg_name_get(wdg), wdg_name_get(wdg));
420 wdg_ctx->gl_ctx->public_entities = eina_list_append(wdg_ctx->gl_ctx->public_entities, wdg_dep_id_get(wdg)); 427 eina_strbuf_append_printf(wdg_ctx->pub_widgets_buf, " Eo *%s;\n", wdg_name_get(wdg));
421 } 428 }
422 429
423 session_wdg_existence_set(session, wdg, EINA_TRUE); 430 session_wdg_existence_set(session, wdg, EINA_TRUE);
@@ -463,10 +470,24 @@ _wdg_creation_function_generate(Gui_Session *session, Gui_Widget *wdg, Widget_Co
463 470
464 gl_ctx->public_main_wdgs = eina_list_append(gl_ctx->public_main_wdgs, wdg_dep_id_get(wdg)); 471 gl_ctx->public_main_wdgs = eina_list_append(gl_ctx->public_main_wdgs, wdg_dep_id_get(wdg));
465 472
466 _iter_widget(session, gl_ctx, wdg_ctx, wdg); 473 eina_strbuf_append_printf(wdg_ctx->full_function_name, "%s_%s",
474 gl_ctx->formatted_project_name, wdg_name);
475 eina_strbuf_append_printf(wdg_ctx->Full_Function_Name, "%s_%s",
476 gl_ctx->formatted_project_name, wdg_name);
477 char *tmp = (char *)eina_strbuf_string_get(wdg_ctx->Full_Function_Name);
478 *tmp = toupper(*tmp);
479 while (*tmp) if (*tmp++ == '_') *tmp = toupper(*tmp);
467 480
468 Eina_Strbuf *head = eina_strbuf_new(); 481 Eina_Strbuf *head = eina_strbuf_new();
469 eina_strbuf_append_printf(head, "void\n%s_create()\n{\n", wdg_name); 482 eina_strbuf_append_printf(head, "%s_Widgets *\n%s_create(Eo *__main_parent)\n{\n",
483 eina_strbuf_string_get(wdg_ctx->Full_Function_Name),
484 eina_strbuf_string_get(wdg_ctx->full_function_name));
485 eina_strbuf_append_printf(head, " %s_Widgets *pub_widgets = calloc(1, sizeof(*pub_widgets));\n\n",
486 eina_strbuf_string_get(wdg_ctx->Full_Function_Name));
487
488 eina_strbuf_append_printf(wdg_ctx->pub_widgets_buf, "typedef struct\n{\n");
489
490 _iter_widget(session, gl_ctx, wdg_ctx, wdg);
470 491
471 /* Add definitions of variables */ 492 /* Add definitions of variables */
472 Dep_Id *dep_id; 493 Dep_Id *dep_id;
@@ -493,8 +514,11 @@ _wdg_creation_function_generate(Gui_Session *session, Gui_Widget *wdg, Widget_Co
493 } 514 }
494 } 515 }
495 eina_strbuf_prepend_printf(wdg_ctx->buf, "%s\n", eina_strbuf_string_get(head)); 516 eina_strbuf_prepend_printf(wdg_ctx->buf, "%s\n", eina_strbuf_string_get(head));
496 eina_strbuf_free(head); 517 eina_strbuf_append_printf(wdg_ctx->pub_widgets_buf, "} %s_Widgets;\n\n", eina_strbuf_string_get(wdg_ctx->Full_Function_Name));
518 eina_strbuf_append_printf(wdg_ctx->buf, "\n return pub_widgets;\n");
497 eina_strbuf_append_printf(wdg_ctx->buf, "}\n\n"); 519 eina_strbuf_append_printf(wdg_ctx->buf, "}\n\n");
520
521 eina_strbuf_free(head);
498} 522}
499 523
500static void 524static void
@@ -508,14 +532,9 @@ _sequence_generate(Gui_Session *session, Gui_Sequence *seq, Sequence_Context *se
508 printf("Generate %s\n", seq_name); 532 printf("Generate %s\n", seq_name);
509 533
510 eina_strbuf_append_printf(seq_ctx->buf, 534 eina_strbuf_append_printf(seq_ctx->buf,
511 "%sEina_Bool\n%s_%s(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)\n{\n", 535 "Eina_Bool\n%s_%s(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)\n{\n",
512 sequence_public_get(seq) ? "" : "static ", seq_ctx->gl_ctx->formatted_project_name, seq_name); 536 seq_ctx->gl_ctx->formatted_project_name, seq_name);
513 537
514 /* if sequence is public, need to declare it in header. */
515 if (sequence_public_get(seq))
516 {
517 seq_ctx->gl_ctx->public_entities = eina_list_append(seq_ctx->gl_ctx->public_entities, sequence_dep_id_get(seq));
518 }
519 EINA_LIST_FOREACH(sequence_actions_list_get(seq), itr, action) 538 EINA_LIST_FOREACH(sequence_actions_list_get(seq), itr, action)
520 { 539 {
521 switch (action_type_get(action)) 540 switch (action_type_get(action))
@@ -529,7 +548,22 @@ _sequence_generate(Gui_Session *session, Gui_Sequence *seq, Sequence_Context *se
529 ERR("Failed to find \"%p\" widget.", wdg_id); 548 ERR("Failed to find \"%p\" widget.", wdg_id);
530 continue; 549 continue;
531 } 550 }
532 eina_strbuf_append_printf(seq_ctx->buf, " %s_create();\n\n", wdg_name_get(w)); 551 eina_strbuf_append_printf(seq_ctx->buf,
552 " if (g_%s.%s) free(g_%s.%s);\n",
553 PUB_WIDGETS, wdg_name_get(w),
554 PUB_WIDGETS, wdg_name_get(w));
555 eina_strbuf_append_printf(seq_ctx->buf,
556 " g_%s.%s = %s_%s_create(NULL);\n\n",
557 PUB_WIDGETS, wdg_name_get(w),
558 gl_ctx->formatted_project_name, wdg_name_get(w));
559 char *wdg_name = strdup(wdg_name_get(w)), *tmp = wdg_name;
560 *tmp = toupper(*tmp);
561 while (*tmp) if (*tmp++ == '_') *tmp = toupper(*tmp);
562 eina_strbuf_append_printf(seq_ctx->main_widgets_declaration,
563 " %s_%s_Widgets *%s;\n",
564 gl_ctx->Formatted_Project_Name, wdg_name,
565 wdg_name_get(w));
566 free(wdg_name);
533 break; 567 break;
534 } 568 }
535 case MODIF_ACTION: 569 case MODIF_ACTION:
@@ -637,14 +671,13 @@ _ctx_generate(Global_Gen_Context *gl_ctx)
637 const Gui_Context *ctx = gl_ctx->ctx; 671 const Gui_Context *ctx = gl_ctx->ctx;
638 const char *filename = gui_context_export_filename_get(ctx); 672 const char *filename = gui_context_export_filename_get(ctx);
639 const Eina_List *itr; 673 const Eina_List *itr;
674 Eina_List *seq_ctxs = NULL, *wdg_ctxs = NULL;
675 Sequence_Context *seq_ctx;
676 Widget_Context *wdg_ctx;
640 Dep_Id *dep_id; 677 Dep_Id *dep_id;
641 678
642 Eina_Strbuf *resources_buf = eina_strbuf_new(); 679 Eina_Strbuf *resources_buf = eina_strbuf_new();
643 680
644 Sequence_Context seq_ctx;
645 seq_ctx.gl_ctx = gl_ctx;
646 seq_ctx.buf = eina_strbuf_new();
647
648 /* Add declaration of image paths. 681 /* Add declaration of image paths.
649 * Two cases are generated: 682 * Two cases are generated:
650 * - if data prefix variable is not defined, image's initial path is inserted. 683 * - if data prefix variable is not defined, image's initial path is inserted.
@@ -693,37 +726,44 @@ _ctx_generate(Global_Gen_Context *gl_ctx)
693 resource_value_get(res)); 726 resource_value_get(res));
694 } 727 }
695 } 728 }
729 eina_strbuf_append_printf(resources_buf, "\n");
696 } 730 }
697 731
698 /* Generate sequences */ 732 /* Generate sequences */
699 const Eina_List* seqs_list = gui_context_seq_list_get(ctx); 733 const Eina_List* seqs_list = gui_context_seq_list_get(ctx);
700 EINA_LIST_FOREACH(seqs_list, itr, dep_id) 734 EINA_LIST_FOREACH(seqs_list, itr, dep_id)
701 { 735 {
736 seq_ctx = calloc(1, sizeof(*seq_ctx));
737 seq_ctx->gl_ctx = gl_ctx;
738 seq_ctx->buf = eina_strbuf_new();
739 seq_ctx->main_widgets_declaration = eina_strbuf_new();
740 seq_ctx->id = dep_id;
741 seq_ctxs = eina_list_append(seq_ctxs, seq_ctx);
702 Gui_Sequence *seq = sequence_get(dep_id); 742 Gui_Sequence *seq = sequence_get(dep_id);
703 if (seq) _sequence_generate(gl_ctx->session, seq, &seq_ctx); 743 if (seq) _sequence_generate(gl_ctx->session, seq, seq_ctx);
704 } 744 }
705 745
706 const Eina_List* wdgs_list = gui_context_wdg_list_get(ctx); 746 EINA_LIST_FOREACH(gui_context_main_widgets_get(ctx), itr, dep_id)
707 Eina_Strbuf *wdgs_buf = eina_strbuf_new();
708 Widget_Context wdg_ctx;
709 wdg_ctx.gl_ctx = gl_ctx;
710 wdg_ctx.buf = eina_strbuf_new();
711 EINA_LIST_FOREACH(wdgs_list, itr, dep_id)
712 { 747 {
713 Gui_Widget *wdg = wdg_get(dep_id); 748 Gui_Widget *wdg = wdg_get(dep_id);
714 if (wdg) 749 if (wdg)
715 { 750 {
716 if (!session_wdg_exists(gl_ctx->session, wdg)) 751 if (!session_wdg_exists(gl_ctx->session, wdg))
717 { 752 {
718 wdg_ctx.declarations = NULL; 753 wdg_ctx = calloc(1, sizeof(*wdg_ctx));
754 wdg_ctx->gl_ctx = gl_ctx;
755 wdg_ctx->buf = eina_strbuf_new();
756 wdg_ctx->pub_widgets_buf = eina_strbuf_new();
757 wdg_ctx->full_function_name = eina_strbuf_new();
758 wdg_ctx->Full_Function_Name = eina_strbuf_new();
759 wdg_ctx->declarations = NULL;
760 wdg_ctx->id = dep_id;
761 wdg_ctxs = eina_list_append(wdg_ctxs, wdg_ctx);
719 printf("Generate %s\n", wdg_name_get(wdg)); 762 printf("Generate %s\n", wdg_name_get(wdg));
720 _wdg_creation_function_generate(gl_ctx->session, wdg, &wdg_ctx); 763 _wdg_creation_function_generate(gl_ctx->session, wdg, wdg_ctx);
721 eina_strbuf_append(wdgs_buf, eina_strbuf_string_get(wdg_ctx.buf));
722 eina_strbuf_reset(wdg_ctx.buf);
723 } 764 }
724 } 765 }
725 } 766 }
726 eina_strbuf_free(wdg_ctx.buf);
727 767
728 eina_strbuf_append_printf(gl_ctx->c_buf, 768 eina_strbuf_append_printf(gl_ctx->c_buf,
729 "#include <Elementary.h>\n" 769 "#include <Elementary.h>\n"
@@ -732,7 +772,8 @@ _ctx_generate(Global_Gen_Context *gl_ctx)
732 "#include \"%s.h\"\n\n", filename); 772 "#include \"%s.h\"\n\n", filename);
733 773
734 eina_strbuf_append_printf(gl_ctx->c_buf, 774 eina_strbuf_append_printf(gl_ctx->c_buf,
735 "static GUI %s;\n\n", PUB_WIDGETS); 775 "static %s_Widgets g_%s;\n\n",
776 gl_ctx->Formatted_Project_Name, PUB_WIDGETS);
736 777
737 /* Append global widgets names */ 778 /* Append global widgets names */
738 EINA_LIST_FOREACH(gl_ctx->global_entities, itr, dep_id) 779 EINA_LIST_FOREACH(gl_ctx->global_entities, itr, dep_id)
@@ -758,22 +799,29 @@ _ctx_generate(Global_Gen_Context *gl_ctx)
758 } 799 }
759 800
760 eina_strbuf_append_printf(gl_ctx->c_buf,"%s", eina_strbuf_string_get(resources_buf)); 801 eina_strbuf_append_printf(gl_ctx->c_buf,"%s", eina_strbuf_string_get(resources_buf));
761 eina_strbuf_append_printf(gl_ctx->c_buf,"%s", eina_strbuf_string_get(seq_ctx.buf)); 802 EINA_LIST_FOREACH((const Eina_List *)seq_ctxs, itr, seq_ctx)
762 eina_strbuf_append_printf(gl_ctx->c_buf,"%s", eina_strbuf_string_get(wdgs_buf)); 803 {
804 eina_strbuf_append_printf(gl_ctx->c_buf,"%s", eina_strbuf_string_get(seq_ctx->buf));
805 }
806 EINA_LIST_FOREACH((const Eina_List *)wdg_ctxs, itr, wdg_ctx)
807 {
808 eina_strbuf_append_printf(gl_ctx->c_buf,"%s", eina_strbuf_string_get(wdg_ctx->buf));
809 }
763 810
764 dep_id = gui_context_dep_id_by_name_get(ctx, BIGBANG_STR); 811 dep_id = gui_context_dep_id_by_name_get(ctx, BIGBANG_STR);
765 const Gui_Resource *res = gui_context_resource_get(dep_id); 812 const Gui_Resource *res = gui_context_resource_get(dep_id);
766 if (!res) return; 813 if (!res) return;
767 const char *func_name = resource_name_get(res); 814 const char *func_name = resource_name_get(res);
768 eina_strbuf_append_printf(gl_ctx->c_buf, 815 eina_strbuf_append_printf(gl_ctx->c_buf,
769 "GUI *%s_gui_get()\n{\n" 816 "%s_Widgets *%s_gui_get()\n{\n"
770 " static Eina_Bool initialized = EINA_FALSE;\n" 817 " static Eina_Bool initialized = EINA_FALSE;\n"
771 " if (!initialized)\n" 818 " if (!initialized)\n"
772 " {\n" 819 " {\n"
773 " %s_%s(NULL, NULL, NULL, NULL);\n" 820 " %s_%s(NULL, NULL, NULL, NULL);\n"
774 " initialized = EINA_TRUE;\n" 821 " initialized = EINA_TRUE;\n"
775 " }\n" 822 " }\n"
776 " return &%s;\n}", 823 " return &g_%s;\n}",
824 gl_ctx->Formatted_Project_Name,
777 gl_ctx->formatted_project_name, 825 gl_ctx->formatted_project_name,
778 gl_ctx->formatted_project_name, func_name, 826 gl_ctx->formatted_project_name, func_name,
779 PUB_WIDGETS); 827 PUB_WIDGETS);
@@ -786,44 +834,55 @@ _ctx_generate(Global_Gen_Context *gl_ctx)
786 "#include <Eo.h>\n" 834 "#include <Eo.h>\n"
787 "#include <Elementary.h>\n\n"); 835 "#include <Elementary.h>\n\n");
788 836
789 eina_strbuf_append_printf(gl_ctx->h_buf, "typedef struct\n{\n"); 837 EINA_LIST_FOREACH((const Eina_List *)wdg_ctxs, itr, wdg_ctx)
790 EINA_LIST_FOREACH(gl_ctx->public_entities, itr, dep_id)
791 { 838 {
792 switch (dep_type_get(dep_id)) 839 eina_strbuf_append_printf(gl_ctx->h_buf, "%s\n",
793 { 840 eina_strbuf_string_get(wdg_ctx->pub_widgets_buf));
794 case DEP_TYPE_WIDGET:
795 eina_strbuf_append_printf(gl_ctx->h_buf, " Eo *%s;\n", dep_name_get(dep_id));
796 break;
797 case DEP_TYPE_ITEM:
798 eina_strbuf_append_printf(gl_ctx->h_buf, " Elm_Object_Item *%s;\n", dep_name_get(dep_id));
799 break;
800 default: break;
801 }
802 } 841 }
803 eina_strbuf_append_printf(gl_ctx->h_buf, "} GUI;\n\n"); 842 eina_strbuf_append_printf(gl_ctx->h_buf, "typedef struct {\n");
804 EINA_LIST_FOREACH(gl_ctx->public_entities, itr, dep_id) 843 EINA_LIST_FOREACH((const Eina_List *)seq_ctxs, itr, seq_ctx)
805 { 844 {
806 if (dep_type_get(dep_id) == DEP_TYPE_RESOURCE) 845 if (eina_strbuf_length_get(seq_ctx->main_widgets_declaration))
807 { 846 eina_strbuf_append_printf(gl_ctx->h_buf, "%s",
808 const Gui_Sequence *seq = sequence_get(dep_id); 847 eina_strbuf_string_get(seq_ctx->main_widgets_declaration));
809 if (seq) 848 }
810 eina_strbuf_append_printf(gl_ctx->h_buf, 849 eina_strbuf_append_printf(gl_ctx->h_buf, "} %s_Widgets;\n\n",
811 "Eina_Bool\n%s_%s(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);\n\n", 850 gl_ctx->Formatted_Project_Name);
812 gl_ctx->formatted_project_name, sequence_name_get(seq)); 851 EINA_LIST_FOREACH((const Eina_List *)wdg_ctxs, itr, wdg_ctx)
813 } 852 {
853 eina_strbuf_append_printf(gl_ctx->h_buf, "%s_Widgets *%s_create(Eo *parent);\n\n",
854 eina_strbuf_string_get(wdg_ctx->Full_Function_Name),
855 eina_strbuf_string_get(wdg_ctx->full_function_name));
814 } 856 }
815 857
816 EINA_LIST_FREE(gl_ctx->public_main_wdgs, dep_id) 858 EINA_LIST_FOREACH((const Eina_List *)seq_ctxs, itr, seq_ctx)
817 { 859 {
818 eina_strbuf_append_printf(gl_ctx->h_buf, "void\n%s_create();\n\n", dep_name_get(dep_id)); 860 eina_strbuf_append_printf(gl_ctx->h_buf,
861 "Eina_Bool %s_%s(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);\n",
862 gl_ctx->formatted_project_name, dep_name_get(seq_ctx->id));
819 } 863 }
820 864
821 eina_strbuf_append_printf(gl_ctx->h_buf, "GUI *%s_gui_get();\n", gl_ctx->formatted_project_name); 865 eina_strbuf_append_printf(gl_ctx->h_buf, "%s_Widgets *%s_gui_get();\n",
866 gl_ctx->Formatted_Project_Name,
867 gl_ctx->formatted_project_name);
822 868
823 eina_strbuf_append_printf(gl_ctx->h_buf, "#endif\n"); 869 eina_strbuf_append_printf(gl_ctx->h_buf, "#endif\n");
824 870
825 eina_strbuf_free(seq_ctx.buf); 871 EINA_LIST_FREE(seq_ctxs, seq_ctx)
826 eina_strbuf_free(wdgs_buf); 872 {
873 eina_strbuf_free(seq_ctx->buf);
874 eina_strbuf_free(seq_ctx->main_widgets_declaration);
875 free(seq_ctx);
876 }
877
878 EINA_LIST_FREE(wdg_ctxs, wdg_ctx)
879 {
880 eina_strbuf_free(wdg_ctx->pub_widgets_buf);
881 eina_strbuf_free(wdg_ctx->full_function_name);
882 eina_strbuf_free(wdg_ctx->Full_Function_Name);
883 eina_strbuf_free(wdg_ctx->buf);
884 free(wdg_ctx);
885 }
827 eina_strbuf_free(resources_buf); 886 eina_strbuf_free(resources_buf);
828} 887}
829 888
@@ -840,10 +899,13 @@ _ctx_to_file_save(const Gui_Context *ctx)
840 gl_gen_ctx.c_buf = eina_strbuf_new(); 899 gl_gen_ctx.c_buf = eina_strbuf_new();
841 gl_gen_ctx.h_buf = eina_strbuf_new(); 900 gl_gen_ctx.h_buf = eina_strbuf_new();
842 gl_gen_ctx.global_entities = NULL; 901 gl_gen_ctx.global_entities = NULL;
843 gl_gen_ctx.public_entities = NULL;
844 gl_gen_ctx.public_main_wdgs = NULL; 902 gl_gen_ctx.public_main_wdgs = NULL;
845 gl_gen_ctx.formatted_project_name = _project_name_format(gui_context_project_name_get(ctx));
846 gl_gen_ctx.session = session_new(); 903 gl_gen_ctx.session = session_new();
904 gl_gen_ctx.formatted_project_name = _project_name_format(gui_context_project_name_get(ctx));
905 gl_gen_ctx.Formatted_Project_Name = strdup(gl_gen_ctx.formatted_project_name);
906 char *tmp = gl_gen_ctx.Formatted_Project_Name;
907 *tmp = toupper(*tmp);
908 while (*tmp) if (*tmp++ == '_') *tmp = toupper(*tmp);
847 909
848 _ctx_generate(&gl_gen_ctx); 910 _ctx_generate(&gl_gen_ctx);
849 911
@@ -875,8 +937,8 @@ _ctx_to_file_save(const Gui_Context *ctx)
875end: 937end:
876 eina_strbuf_free(gl_gen_ctx.c_buf); 938 eina_strbuf_free(gl_gen_ctx.c_buf);
877 eina_strbuf_free(gl_gen_ctx.h_buf); 939 eina_strbuf_free(gl_gen_ctx.h_buf);
878 eina_list_free(gl_gen_ctx.public_entities);
879 eina_list_free(gl_gen_ctx.global_entities); 940 eina_list_free(gl_gen_ctx.global_entities);
941 free(gl_gen_ctx.Formatted_Project_Name);
880 free(gl_gen_ctx.formatted_project_name); 942 free(gl_gen_ctx.formatted_project_name);
881 session_del(gl_gen_ctx.session); 943 session_del(gl_gen_ctx.session);
882 944