summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-09-22 11:25:35 +0300
committerYakov Goldberg <yakov.g@samsung.com>2014-10-02 10:06:33 +0300
commit9718fc75836d45d8dc334e63f278764a0785819d (patch)
treec27a21afbebb9f579452c476fcf1f22b09016a02
parent6796971cd1c372c128c4a59e69167ce53e6154b6 (diff)
Generator: modify lists data to contain ids instead of names.
-rw-r--r--src/lib/generator.c205
-rw-r--r--src/lib/gui_widget.c8
-rw-r--r--src/lib/gui_widget.h4
-rw-r--r--src/lib/json_generator.c18
4 files changed, 105 insertions, 130 deletions
diff --git a/src/lib/generator.c b/src/lib/generator.c
index 1056988..d15d83a 100644
--- a/src/lib/generator.c
+++ b/src/lib/generator.c
@@ -15,8 +15,8 @@ typedef struct
15{ 15{
16 const Gui_Context *ctx; /* Context with all data about widgets*/ 16 const Gui_Context *ctx; /* Context with all data about widgets*/
17 Eina_Strbuf *buf; /* buffer to print data into it */ 17 Eina_Strbuf *buf; /* buffer to print data into it */
18 Eina_List *global_names; /* widget's names, which must be global */ 18 Eina_List *global_entities; /* widgets ids which must be global */
19 Eina_List *public_names; /* widget's names, which must be public */ 19 Eina_List *public_entities; /* widgets ids which must be public */
20 Eina_List *public_main_wdgs; 20 Eina_List *public_main_wdgs;
21 char *formatted_project_name; 21 char *formatted_project_name;
22} Global_Gen_Context; 22} Global_Gen_Context;
@@ -39,7 +39,7 @@ typedef struct
39static Eina_Bool 39static Eina_Bool
40_c_generator_generator_interface_source_preamble_generate(const Gui_Context *ctx, Eina_Strbuf *buf); 40_c_generator_generator_interface_source_preamble_generate(const Gui_Context *ctx, Eina_Strbuf *buf);
41static Eina_Bool 41static Eina_Bool
42_c_generator_generator_interface_global_names_generate(const Eina_List *global_names, Eina_Strbuf *buf); 42_c_generator_generator_interface_global_names_generate(const Eina_List *global_entities, Eina_Strbuf *buf);
43static Eina_Bool 43static Eina_Bool
44_c_generator_generator_interface_resource_generate(const Gui_Resource *res, Eina_Strbuf *buf); 44_c_generator_generator_interface_resource_generate(const Gui_Resource *res, Eina_Strbuf *buf);
45static Eina_Bool 45static Eina_Bool
@@ -61,30 +61,7 @@ _c_generator_generator_interface_header_preamble_generate(const Gui_Context *ctx
61static Eina_Bool 61static Eina_Bool
62_c_generator_generator_interface_header_postscript_generate(const Gui_Context *ctx EINA_UNUSED, Eina_Strbuf *buf); 62_c_generator_generator_interface_header_postscript_generate(const Gui_Context *ctx EINA_UNUSED, Eina_Strbuf *buf);
63static Eina_Bool 63static Eina_Bool
64_c_generator_generator_interface_header_public_variables_generate(const Eina_List *public_names_list, Eina_Strbuf *buf); 64_c_generator_generator_interface_header_public_variables_generate(const Eina_List *public_entities_list, Eina_Strbuf *buf);
65
66typedef enum
67{
68 VAR_EO,
69 VAR_ITEM,
70 VAR_SEQUENCE
71} Variable_Type;
72
73/* Structure to save variable's names of widgets and items,
74 * which must be declared in the beginning of func or globally. */
75typedef struct
76{
77 char *var_name;
78 Variable_Type var_type;
79} Variable_Data;
80
81#define VAR_DATA_NEW(_var_type, _var_name) \
82 ({ \
83 Variable_Data *_vd = calloc(1, sizeof(Variable_Data));\
84 _vd->var_name = strdup(_var_name);\
85 _vd->var_type = _var_type;\
86 _vd;\
87 })
88 65
89/* Structure to hold data about widgets, which must be created with CREATE callbacks. */ 66/* Structure to hold data about widgets, which must be created with CREATE callbacks. */
90typedef struct 67typedef struct
@@ -94,18 +71,14 @@ typedef struct
94 const char *cb_name; 71 const char *cb_name;
95} Wdg_Cb_Pair; 72} Wdg_Cb_Pair;
96 73
97/* Check if current string is in list of Variable_Data* */ 74/* Check if current dep_id is in list of Dep_Ids */
98static Eina_Bool 75static Eina_Bool
99_is_in_list(Eina_List *lst, const char *str) 76_is_in_list(Eina_List *lst, Dep_Id *dep_id)
100{ 77{
101 Variable_Data *vd;
102 Eina_List *itr; 78 Eina_List *itr;
103 79 Dep_Id *dep_id_itr;
104 EINA_LIST_FOREACH(lst, itr, vd) 80 EINA_LIST_FOREACH(lst, itr, dep_id_itr)
105 { 81 if (dep_id_itr == dep_id) return EINA_TRUE;
106 if (!strcmp(str, vd->var_name))
107 return EINA_TRUE;
108 }
109 return EINA_FALSE; 82 return EINA_FALSE;
110} 83}
111 84
@@ -282,6 +255,7 @@ _item_iterate(Gui_Session *session, Widget_Context *wdg_ctx, const Gui_Widget *w
282 const Gui_Widget_Property *prop = item_container_item_prop_get(wit); 255 const Gui_Widget_Property *prop = item_container_item_prop_get(wit);
283 const Op_Desc *op_desc; 256 const Op_Desc *op_desc;
284 Eina_List *itr; 257 Eina_List *itr;
258 Dep_Id *wit_id = item_container_item_dep_id_get(wit);
285 259
286 Eina_Stringshare *class_id = wdg_class_name_get(wdg); 260 Eina_Stringshare *class_id = wdg_class_name_get(wdg);
287 if (!class_id) 261 if (!class_id)
@@ -298,21 +272,16 @@ _item_iterate(Gui_Session *session, Widget_Context *wdg_ctx, const Gui_Widget *w
298 272
299 /* Check if item is public or has subitems. 273 /* Check if item is public or has subitems.
300 * If TRUE, variable need to be declared and assigned. */ 274 * If TRUE, variable need to be declared and assigned. */
301 const char *wit_name = NULL;
302 if (item_container_item_subitems_get(wit) || item_container_item_public_get(wit)) 275 if (item_container_item_subitems_get(wit) || item_container_item_public_get(wit))
303 { 276 {
304 Dep_Id *dep_id = item_container_item_dep_id_get(wit); 277 wdg_ctx->declarations = eina_list_append(wdg_ctx->declarations, wit_id);
305 wit_name = dep_name_get(dep_id);
306 Variable_Data *item_vd = VAR_DATA_NEW(VAR_ITEM, wit_name);
307 wdg_ctx->declarations = eina_list_append(wdg_ctx->declarations, item_vd);
308 } 278 }
309 279
310 _c_generator_generator_interface_widget_item_add(wdg, wit, wit_name, wdg_ctx->body); 280 _c_generator_generator_interface_widget_item_add(wdg, wit, dep_name_get(wit_id), wdg_ctx->body);
311 281
312 if (item_container_item_public_get(wit)) 282 if (item_container_item_public_get(wit))
313 { 283 {
314 Variable_Data *item_vd = VAR_DATA_NEW(VAR_ITEM, wit_name); 284 wdg_ctx->gl_ctx->public_entities = eina_list_append(wdg_ctx->gl_ctx->public_entities, wit_id);
315 wdg_ctx->gl_ctx->public_names = eina_list_append(wdg_ctx->gl_ctx->public_names, item_vd);
316 } 285 }
317 286
318 Dep_Id *dep_id_itr; 287 Dep_Id *dep_id_itr;
@@ -356,8 +325,7 @@ _wdg_add_generate(Gui_Session *session, const Gui_Widget *wdg, void *data)
356 session_wdg_existence_set(session, wdg, EINA_TRUE); 325 session_wdg_existence_set(session, wdg, EINA_TRUE);
357 if (wdg_public_get(wdg)) 326 if (wdg_public_get(wdg))
358 { 327 {
359 Variable_Data *vd = VAR_DATA_NEW(VAR_EO, wdg_name_get(wdg)); 328 wdg_ctx->gl_ctx->public_entities = eina_list_append(wdg_ctx->gl_ctx->public_entities, wdg_dep_id_get(wdg));
360 wdg_ctx->gl_ctx->public_names = eina_list_append(wdg_ctx->gl_ctx->public_names, vd);
361 } 329 }
362 } 330 }
363 331
@@ -371,9 +339,8 @@ static void
371_iter_widget(Gui_Session *session, Global_Gen_Context *gl_ctx, Widget_Context *wdg_ctx, Gui_Widget *wdg) 339_iter_widget(Gui_Session *session, Global_Gen_Context *gl_ctx, Widget_Context *wdg_ctx, Gui_Widget *wdg)
372{ 340{
373 if (session_wdg_exists(session, wdg)) return; 341 if (session_wdg_exists(session, wdg)) return;
374 /* Add widget's name into the list of valiable declarations. */ 342 /* Add widget's name into the list of variable declarations. */
375 Variable_Data *vd = VAR_DATA_NEW(VAR_EO, wdg_name_get(wdg)); 343 wdg_ctx->declarations = eina_list_append(wdg_ctx->declarations, wdg_dep_id_get(wdg));
376 wdg_ctx->declarations = eina_list_append(wdg_ctx->declarations, vd);
377 344
378 if (manager_widget_create(session, wdg, MODE_GENERATOR, wdg_ctx)) 345 if (manager_widget_create(session, wdg, MODE_GENERATOR, wdg_ctx))
379 { 346 {
@@ -403,7 +370,7 @@ _wdg_creation_function_generate(Gui_Session *session, Gui_Widget *wdg, Widget_Co
403 const char *wdg_name = wdg_name_get(wdg); 370 const char *wdg_name = wdg_name_get(wdg);
404 if (session_wdg_exists(session, wdg)) return; 371 if (session_wdg_exists(session, wdg)) return;
405 372
406 gl_ctx->public_main_wdgs = eina_list_append(gl_ctx->public_main_wdgs, wdg_name); 373 gl_ctx->public_main_wdgs = eina_list_append(gl_ctx->public_main_wdgs, wdg_dep_id_get(wdg));
407 374
408 wdg_ctx->body = eina_strbuf_new(); 375 wdg_ctx->body = eina_strbuf_new();
409 _iter_widget(session, gl_ctx, wdg_ctx, wdg); 376 _iter_widget(session, gl_ctx, wdg_ctx, wdg);
@@ -411,24 +378,27 @@ _wdg_creation_function_generate(Gui_Session *session, Gui_Widget *wdg, Widget_Co
411 eina_strbuf_append_printf(wdg_ctx->buf, "void\n%s_create()\n{\n", wdg_name); 378 eina_strbuf_append_printf(wdg_ctx->buf, "void\n%s_create()\n{\n", wdg_name);
412 379
413 /* Add definitions of variables */ 380 /* Add definitions of variables */
414 Variable_Data *vd; 381 Dep_Id *dep_id;
415 EINA_LIST_FREE(wdg_ctx->declarations, vd) 382 EINA_LIST_FREE(wdg_ctx->declarations, dep_id)
416 { 383 {
417 if (vd->var_type == VAR_EO) 384 if (_is_in_list(gl_ctx->global_entities, dep_id)) continue;
418 { 385 switch(dep_type_get(dep_id))
419 if (_is_in_list(gl_ctx->global_names, vd->var_name))
420 {
421 continue;
422 }
423 eina_strbuf_append_printf(wdg_ctx->buf, " Eo *%s;\n", vd->var_name);
424 free(vd->var_name);
425 free(vd);
426 }
427 else if (vd->var_type == VAR_ITEM)
428 { 386 {
429 eina_strbuf_append_printf(wdg_ctx->buf, " Elm_Object_Item *%s;\n", vd->var_name); 387 case DEP_TYPE_WIDGET:
430 free(vd->var_name); 388 {
431 free(vd); 389 Gui_Widget *w = wdg_get(dep_id);
390 if (w) eina_strbuf_append_printf(wdg_ctx->buf, " Eo *%s;\n", wdg_name_get(w));
391 break;
392 }
393 case DEP_TYPE_ITEM:
394 {
395 Item_Container_Item *it = item_container_item_get(dep_id);
396 if (it) eina_strbuf_append_printf(wdg_ctx->buf, " Elm_Object_Item *%s;\n",
397 dep_name_get(dep_id));
398 break;
399 }
400 default:
401 break;
432 } 402 }
433 } 403 }
434 eina_strbuf_append_printf(wdg_ctx->buf, "\n%s", eina_strbuf_string_get(wdg_ctx->body)); 404 eina_strbuf_append_printf(wdg_ctx->buf, "\n%s", eina_strbuf_string_get(wdg_ctx->body));
@@ -442,7 +412,6 @@ _sequence_generate(Gui_Session *session, Gui_Sequence *seq, Sequence_Context *se
442 Eina_List *itr; 412 Eina_List *itr;
443 Gui_Action *action; 413 Gui_Action *action;
444 Global_Gen_Context *gl_ctx = seq_ctx->gl_ctx; 414 Global_Gen_Context *gl_ctx = seq_ctx->gl_ctx;
445 const Gui_Context *ctx = gl_ctx->ctx;
446 415
447 const char *seq_name = sequence_name_get(seq); 416 const char *seq_name = sequence_name_get(seq);
448 printf("Generate %s\n", seq_name); 417 printf("Generate %s\n", seq_name);
@@ -454,8 +423,7 @@ _sequence_generate(Gui_Session *session, Gui_Sequence *seq, Sequence_Context *se
454 /* if sequence is public, need to declare it in header. */ 423 /* if sequence is public, need to declare it in header. */
455 if (sequence_public_get(seq)) 424 if (sequence_public_get(seq))
456 { 425 {
457 Variable_Data *item_vd = VAR_DATA_NEW(VAR_SEQUENCE, seq_name); 426 seq_ctx->gl_ctx->public_entities = eina_list_append(seq_ctx->gl_ctx->public_entities, sequence_dep_id_get(seq));
458 seq_ctx->gl_ctx->public_names = eina_list_append(seq_ctx->gl_ctx->public_names, item_vd);
459 } 427 }
460 EINA_LIST_FOREACH(sequence_actions_list_get(seq), itr, action) 428 EINA_LIST_FOREACH(sequence_actions_list_get(seq), itr, action)
461 { 429 {
@@ -476,7 +444,6 @@ _sequence_generate(Gui_Session *session, Gui_Sequence *seq, Sequence_Context *se
476 case MODIF_ACTION: 444 case MODIF_ACTION:
477 { 445 {
478 Dep_Id *wdg_id = action_widget_id_get(action); 446 Dep_Id *wdg_id = action_widget_id_get(action);
479 const char *wdg_name = dep_name_get(wdg_id);
480 Gui_Widget *wdg = wdg_get(wdg_id); 447 Gui_Widget *wdg = wdg_get(wdg_id);
481 Gui_Widget_Property *prop = action_property_get(action); 448 Gui_Widget_Property *prop = action_property_get(action);
482 449
@@ -490,21 +457,18 @@ _sequence_generate(Gui_Session *session, Gui_Sequence *seq, Sequence_Context *se
490 if (gui_value_type_get(gui_value) == GUI_TYPE_OBJECT) 457 if (gui_value_type_get(gui_value) == GUI_TYPE_OBJECT)
491 { 458 {
492 Dep_Id *dep_id = DEP_ID_GET(gui_value); 459 Dep_Id *dep_id = DEP_ID_GET(gui_value);
493 const char *wdg_par_name = dep_name_get(dep_id); 460 if (!_is_in_list(gl_ctx->global_entities, dep_id))
494 if (!_is_in_list(gl_ctx->global_names, wdg_par_name))
495 { 461 {
496 Variable_Data *vd = VAR_DATA_NEW(VAR_EO, wdg_par_name); 462 gl_ctx->global_entities = eina_list_append(gl_ctx->global_entities, dep_id);
497 gl_ctx->global_names = eina_list_append(gl_ctx->global_names, vd);
498 } 463 }
499 } 464 }
500 } 465 }
501 } 466 }
502 467
503 /* Object being modified must be declared as global. */ 468 /* Object being modified must be declared as global. */
504 if (!_is_in_list(gl_ctx->global_names, wdg_name)) 469 if (!_is_in_list(gl_ctx->global_entities, wdg_id))
505 { 470 {
506 Variable_Data *vd = VAR_DATA_NEW(VAR_EO, wdg_name); 471 gl_ctx->global_entities = eina_list_append(gl_ctx->global_entities, wdg_id);
507 gl_ctx->global_names = eina_list_append(gl_ctx->global_names, vd);
508 } 472 }
509 Widget_Context wdg_ctx; 473 Widget_Context wdg_ctx;
510 wdg_ctx.body = eina_strbuf_new(); 474 wdg_ctx.body = eina_strbuf_new();
@@ -583,7 +547,6 @@ _ctx_to_file_save(const Gui_Context *ctx)
583 char *filename_c = NULL; 547 char *filename_c = NULL;
584 char *filename_h = NULL; 548 char *filename_h = NULL;
585 FILE *fp_c = NULL, *fp_h = NULL; 549 FILE *fp_c = NULL, *fp_h = NULL;
586 Variable_Data *vd;
587 const Eina_List *itr; 550 const Eina_List *itr;
588 551
589 /* If code must be generated, create C and H files*/ 552 /* If code must be generated, create C and H files*/
@@ -611,8 +574,8 @@ _ctx_to_file_save(const Gui_Context *ctx)
611 Global_Gen_Context gl_gen_ctx; 574 Global_Gen_Context gl_gen_ctx;
612 gl_gen_ctx.ctx = ctx; 575 gl_gen_ctx.ctx = ctx;
613 gl_gen_ctx.buf = eina_strbuf_new(); 576 gl_gen_ctx.buf = eina_strbuf_new();
614 gl_gen_ctx.global_names = NULL; 577 gl_gen_ctx.global_entities = NULL;
615 gl_gen_ctx.public_names = NULL; 578 gl_gen_ctx.public_entities = NULL;
616 gl_gen_ctx.public_main_wdgs = NULL; 579 gl_gen_ctx.public_main_wdgs = NULL;
617 gl_gen_ctx.formatted_project_name = _project_name_format((char *) gui_context_project_name_get(ctx)); 580 gl_gen_ctx.formatted_project_name = _project_name_format((char *) gui_context_project_name_get(ctx));
618 581
@@ -704,10 +667,10 @@ _ctx_to_file_save(const Gui_Context *ctx)
704 } 667 }
705 } 668 }
706 669
707 Eina_Strbuf *global_names_buf = eina_strbuf_new(); 670 Eina_Strbuf *global_entities_buf = eina_strbuf_new();
708 _c_generator_generator_interface_global_names_generate(gl_gen_ctx.global_names, global_names_buf); 671 _c_generator_generator_interface_global_names_generate(gl_gen_ctx.global_entities, global_entities_buf);
709 eina_strbuf_replace_first(gl_gen_ctx.buf, "__GLOBAL_NAMES__", eina_strbuf_string_get(global_names_buf)); 672 eina_strbuf_replace_first(gl_gen_ctx.buf, "__GLOBAL_NAMES__", eina_strbuf_string_get(global_entities_buf));
710 eina_strbuf_free(global_names_buf); 673 eina_strbuf_free(global_entities_buf);
711 674
712 _c_generator_generator_interface_main_function_generate(ctx, gl_gen_ctx.buf); 675 _c_generator_generator_interface_main_function_generate(ctx, gl_gen_ctx.buf);
713 676
@@ -718,19 +681,19 @@ _ctx_to_file_save(const Gui_Context *ctx)
718 eina_strbuf_reset(gl_gen_ctx.buf); 681 eina_strbuf_reset(gl_gen_ctx.buf);
719 _c_generator_generator_interface_header_preamble_generate(ctx, gl_gen_ctx.buf); 682 _c_generator_generator_interface_header_preamble_generate(ctx, gl_gen_ctx.buf);
720 683
721 _c_generator_generator_interface_header_public_variables_generate(gl_gen_ctx.public_names, gl_gen_ctx.buf); 684 _c_generator_generator_interface_header_public_variables_generate(gl_gen_ctx.public_entities, gl_gen_ctx.buf);
722 EINA_LIST_FOREACH(gl_gen_ctx.public_names, itr, vd) 685 EINA_LIST_FOREACH(gl_gen_ctx.public_entities, itr, seq_id)
723 { 686 {
724 if (vd->var_type == VAR_SEQUENCE) 687 if (dep_type_get(seq_id) == DEP_TYPE_RESOURCE)
725 { 688 {
726 _c_generator_generator_interface_header_sequence_generate(vd->var_name, &gl_gen_ctx); 689 const Gui_Sequence *seq = sequence_get(seq_id);
690 if (seq) _c_generator_generator_interface_header_sequence_generate(sequence_name_get(seq), &gl_gen_ctx);
727 } 691 }
728 } 692 }
729 693
730 const char *wdg_name; 694 EINA_LIST_FREE(gl_gen_ctx.public_main_wdgs, wdg_id)
731 EINA_LIST_FREE(gl_gen_ctx.public_main_wdgs, wdg_name)
732 { 695 {
733 eina_strbuf_append_printf(gl_gen_ctx.buf, "void\n%s_create();\n\n", wdg_name); 696 eina_strbuf_append_printf(gl_gen_ctx.buf, "void\n%s_create();\n\n", dep_name_get(wdg_id));
734 } 697 }
735 698
736 _c_generator_generator_interface_header_main_function_generate(ctx, gl_gen_ctx.buf); 699 _c_generator_generator_interface_header_main_function_generate(ctx, gl_gen_ctx.buf);
@@ -738,16 +701,8 @@ _ctx_to_file_save(const Gui_Context *ctx)
738 fprintf(fp_h, "%s", eina_strbuf_string_get(gl_gen_ctx.buf)); 701 fprintf(fp_h, "%s", eina_strbuf_string_get(gl_gen_ctx.buf));
739 702
740 eina_strbuf_free(gl_gen_ctx.buf); 703 eina_strbuf_free(gl_gen_ctx.buf);
741 EINA_LIST_FREE(gl_gen_ctx.public_names, vd) 704 eina_list_free(gl_gen_ctx.public_entities);
742 { 705 eina_list_free(gl_gen_ctx.global_entities);
743 free(vd->var_name);
744 free(vd);
745 }
746 EINA_LIST_FREE(gl_gen_ctx.global_names, vd)
747 {
748 free(vd->var_name);
749 free(vd);
750 }
751 free(gl_gen_ctx.formatted_project_name); 706 free(gl_gen_ctx.formatted_project_name);
752 707
753 session_del(session); 708 session_del(session);
@@ -794,22 +749,30 @@ _c_generator_generator_interface_source_preamble_generate(const Gui_Context *ctx
794} 749}
795 750
796static Eina_Bool 751static Eina_Bool
797_c_generator_generator_interface_global_names_generate(const Eina_List *global_names, Eina_Strbuf *buf) 752_c_generator_generator_interface_global_names_generate(const Eina_List *global_entities, Eina_Strbuf *buf)
798{ 753{
799 /* Append global widgets names */ 754 /* Append global widgets names */
800 Variable_Data *vd;
801 const Eina_List *itr; 755 const Eina_List *itr;
802 EINA_LIST_FOREACH(global_names, itr, vd) 756 Dep_Id *dep_id;
757 EINA_LIST_FOREACH(global_entities, itr, dep_id)
803 { 758 {
804 if (vd->var_type == VAR_EO) 759 switch (dep_type_get(dep_id))
805 {
806 eina_strbuf_append_printf(buf,
807 "static Eo *%s;\n", vd->var_name);
808 }
809 else if (vd->var_type == VAR_ITEM)
810 { 760 {
811 eina_strbuf_append_printf(buf, 761 case DEP_TYPE_WIDGET:
812 "static Elm_Object_Item *%s;\n", vd->var_name); 762 {
763 Gui_Widget *w = wdg_get(dep_id);
764 if (w) eina_strbuf_append_printf(buf, "static Eo *%s;\n", wdg_name_get(w));
765 break;
766 }
767 case DEP_TYPE_ITEM:
768 {
769 Item_Container_Item *it = item_container_item_get(dep_id);
770 if (it) eina_strbuf_append_printf(buf, "static Elm_Object_Item *%s;\n",
771 dep_name_get(dep_id));
772 break;
773 }
774 default:
775 break;
813 } 776 }
814 } 777 }
815 778
@@ -1072,22 +1035,22 @@ _c_generator_generator_interface_header_postscript_generate(const Gui_Context *c
1072} 1035}
1073 1036
1074static Eina_Bool 1037static Eina_Bool
1075_c_generator_generator_interface_header_public_variables_generate(const Eina_List *public_names_list, Eina_Strbuf *buf) 1038_c_generator_generator_interface_header_public_variables_generate(const Eina_List *public_entities_list, Eina_Strbuf *buf)
1076{ 1039{
1077 Variable_Data *vd;
1078 const Eina_List *itr; 1040 const Eina_List *itr;
1041 Dep_Id *dep_id;
1079 eina_strbuf_append_printf(buf, "typedef struct\n{\n"); 1042 eina_strbuf_append_printf(buf, "typedef struct\n{\n");
1080 EINA_LIST_FOREACH(public_names_list, itr, vd) 1043 EINA_LIST_FOREACH(public_entities_list, itr, dep_id)
1081 { 1044 {
1082 switch (vd->var_type) 1045 switch (dep_type_get(dep_id))
1083 { 1046 {
1084 case VAR_EO: 1047 case DEP_TYPE_WIDGET:
1085 eina_strbuf_append_printf(buf, " Eo *%s;\n", vd->var_name); 1048 eina_strbuf_append_printf(buf, " Eo *%s;\n", dep_name_get(dep_id));
1086 break; 1049 break;
1087 case VAR_ITEM: 1050 case DEP_TYPE_ITEM:
1088 eina_strbuf_append_printf(buf, " Elm_Object_Item *%s;\n", vd->var_name); 1051 eina_strbuf_append_printf(buf, " Elm_Object_Item *%s;\n", dep_name_get(dep_id));
1089 break; 1052 break;
1090 case VAR_SEQUENCE: break; 1053 case DEP_TYPE_RESOURCE: break;
1091 default: return EINA_FALSE; 1054 default: return EINA_FALSE;
1092 } 1055 }
1093 } 1056 }
diff --git a/src/lib/gui_widget.c b/src/lib/gui_widget.c
index 9c16252..cddd11a 100644
--- a/src/lib/gui_widget.c
+++ b/src/lib/gui_widget.c
@@ -775,6 +775,14 @@ gui_context_dep_data_active_set(const Gui_Context *ctx, Dep_Id *dep_id, Eina_Boo
775 dep_data->active = state; 775 dep_data->active = state;
776} 776}
777 777
778Dep_Type
779dep_type_get(Dep_Id *dep_id)
780{
781 Dep_Data *dep = gui_context_dep_data_get(dep_id);
782 if (!dep) return DEP_TYPE_UNKNOWN;
783 return dep->type;
784}
785
778Eina_Bool 786Eina_Bool
779gui_context_dep_exists(const Gui_Context *ctx, Dep_Id *dep_id) 787gui_context_dep_exists(const Gui_Context *ctx, Dep_Id *dep_id)
780{ 788{
diff --git a/src/lib/gui_widget.h b/src/lib/gui_widget.h
index eee22b9..be9ae7a 100644
--- a/src/lib/gui_widget.h
+++ b/src/lib/gui_widget.h
@@ -57,6 +57,7 @@ typedef void (*Dep_Observer_Cb)(void *data, Dep_Id *subject_id);
57 57
58typedef enum 58typedef enum
59{ 59{
60 DEP_TYPE_UNKNOWN,
60 DEP_TYPE_WIDGET, 61 DEP_TYPE_WIDGET,
61 DEP_TYPE_RESOURCE, 62 DEP_TYPE_RESOURCE,
62 DEP_TYPE_ITEM, 63 DEP_TYPE_ITEM,
@@ -167,6 +168,9 @@ dep_name_get(Dep_Id *dep_id);
167void 168void
168gui_context_dep_data_active_set(const Gui_Context *ctx, Dep_Id *dep_id, Eina_Bool state); 169gui_context_dep_data_active_set(const Gui_Context *ctx, Dep_Id *dep_id, Eina_Bool state);
169 170
171Dep_Type
172dep_type_get(Dep_Id *dep_id);
173
170Dep_Id * 174Dep_Id *
171gui_context_dep_id_by_name_get(const Gui_Context *ctx, const char *name); 175gui_context_dep_id_by_name_get(const Gui_Context *ctx, const char *name);
172 176
diff --git a/src/lib/json_generator.c b/src/lib/json_generator.c
index 8194ed8..024679f 100644
--- a/src/lib/json_generator.c
+++ b/src/lib/json_generator.c
@@ -52,7 +52,7 @@ _gui_value_json_get(const Gui_Context *ctx, Gui_Value *gui_value)
52 } 52 }
53 else 53 else
54 { 54 {
55 jsncur = eina_json_string_new(gui_context_dep_data_name_get(ctx, dep_id)); 55 jsncur = eina_json_string_new(dep_name_get(dep_id));
56 } 56 }
57 break; 57 break;
58 } 58 }
@@ -258,7 +258,7 @@ _item_json_generate(const Gui_Widget *wdg, const Item_Container_Item *wit)
258 if (!subobjs) subobjs = eina_json_object_new(); 258 if (!subobjs) subobjs = eina_json_object_new();
259 const Item_Container_Item *it = item_container_item_get(dep_id); 259 const Item_Container_Item *it = item_container_item_get(dep_id);
260 Eina_Json_Value *subobj = _item_json_generate(wdg, it); 260 Eina_Json_Value *subobj = _item_json_generate(wdg, it);
261 eina_json_object_append(subobjs, gui_context_dep_data_name_get(ctx, dep_id), subobj); 261 eina_json_object_append(subobjs, dep_name_get(dep_id), subobj);
262 } 262 }
263 /* ... and put this object into 'Items' section of current object.*/ 263 /* ... and put this object into 'Items' section of current object.*/
264 if (subobjs) eina_json_object_append(obj, "Items", subobjs); 264 if (subobjs) eina_json_object_append(obj, "Items", subobjs);
@@ -317,7 +317,7 @@ _widget_json_generate(Gui_Widget *wdg)
317 if ((cb_type) && (gui_context_dep_exists(wdg_context_get(wdg), dep_id))) 317 if ((cb_type) && (gui_context_dep_exists(wdg_context_get(wdg), dep_id)))
318 { 318 {
319 if (!cbs_obj) cbs_obj = eina_json_object_new(); 319 if (!cbs_obj) cbs_obj = eina_json_object_new();
320 const char *seq_name = gui_context_dep_data_name_get(wdg_context_get(wdg), dep_id); 320 const char *seq_name = dep_name_get(dep_id);
321 eina_json_object_append(cbs_obj, cb_type, eina_json_string_new(seq_name)); 321 eina_json_object_append(cbs_obj, cb_type, eina_json_string_new(seq_name));
322 } 322 }
323 } 323 }
@@ -373,7 +373,7 @@ _widget_json_generate(Gui_Widget *wdg)
373 Dep_Id *dep_id = DEP_ID_GET(val); 373 Dep_Id *dep_id = DEP_ID_GET(val);
374 if (dep_id) 374 if (dep_id)
375 { 375 {
376 item_name = gui_context_dep_data_name_get(ctx, dep_id); 376 item_name = dep_name_get(dep_id);
377 } 377 }
378 else 378 else
379 { 379 {
@@ -411,7 +411,7 @@ _widget_json_generate(Gui_Widget *wdg)
411 Dep_Id *dep_id = DEP_ID_GET(val); 411 Dep_Id *dep_id = DEP_ID_GET(val);
412 if (dep_id) 412 if (dep_id)
413 { 413 {
414 const char *item_name = gui_context_dep_data_name_get(ctx, dep_id); 414 const char *item_name = dep_name_get(dep_id);
415 if (item_name) 415 if (item_name)
416 { 416 {
417 val = eina_list_nth(values_lst, 0); 417 val = eina_list_nth(values_lst, 0);
@@ -442,7 +442,7 @@ _widget_json_generate(Gui_Widget *wdg)
442 if (!subobjs) subobjs = eina_json_object_new(); 442 if (!subobjs) subobjs = eina_json_object_new();
443 const Item_Container_Item *it = item_container_item_get(dep_id); 443 const Item_Container_Item *it = item_container_item_get(dep_id);
444 Eina_Json_Value *subobj = _item_json_generate(wdg, it); 444 Eina_Json_Value *subobj = _item_json_generate(wdg, it);
445 eina_json_object_append(subobjs, gui_context_dep_data_name_get(ctx, dep_id), subobj); 445 eina_json_object_append(subobjs, dep_name_get(dep_id), subobj);
446 } 446 }
447 /* ... and put this object into 'Items' section of current object.*/ 447 /* ... and put this object into 'Items' section of current object.*/
448 if (subobjs) eina_json_object_append(obj, "Items", subobjs); 448 if (subobjs) eina_json_object_append(obj, "Items", subobjs);
@@ -500,7 +500,7 @@ _sequence_json_generate(const Gui_Sequence *seq)
500 case CREATION_ACTION: 500 case CREATION_ACTION:
501 { 501 {
502 Dep_Id *wdg_id = action_widget_id_get(action); 502 Dep_Id *wdg_id = action_widget_id_get(action);
503 const char *wdg_name = gui_context_dep_data_name_get(ctx, wdg_id); 503 const char *wdg_name = dep_name_get(wdg_id);
504 if (wdg_name) 504 if (wdg_name)
505 { 505 {
506 eina_json_object_append(actions_obj, "Creation", eina_json_string_new(wdg_name)); 506 eina_json_object_append(actions_obj, "Creation", eina_json_string_new(wdg_name));
@@ -510,7 +510,7 @@ _sequence_json_generate(const Gui_Sequence *seq)
510 case MODIF_ACTION: 510 case MODIF_ACTION:
511 { 511 {
512 Dep_Id *wdg_id = action_widget_id_get(action); 512 Dep_Id *wdg_id = action_widget_id_get(action);
513 const char *wdg_name = gui_context_dep_data_name_get(ctx, wdg_id); 513 const char *wdg_name = dep_name_get(wdg_id);
514 514
515 if (wdg_name) 515 if (wdg_name)
516 { 516 {
@@ -525,7 +525,7 @@ _sequence_json_generate(const Gui_Sequence *seq)
525 } 525 }
526 case USER_ACTION: 526 case USER_ACTION:
527 { 527 {
528 const char *user_func = gui_context_dep_data_name_get(ctx, action_user_dep_id_get(action)); 528 const char *user_func = dep_name_get(action_user_dep_id_get(action));
529 const char *user_data = action_user_data_get(action); 529 const char *user_data = action_user_data_get(action);
530 530
531 if (user_func) 531 if (user_func)