diff options
author | Jee-Yong Um <conr2d@gmail.com> | 2016-01-20 11:42:53 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-01-20 11:45:34 +0900 |
commit | 2ca99b8b68bd52ce187c2da54944144f12afb0b6 (patch) | |
tree | 399db69cfa163bcd0f22472e1b980b4f494a7beb /src/bin | |
parent | 7f4f215cd0beb7c8a46150dbe9c4a6e47c860ad1 (diff) | |
download | efl-2ca99b8b68bd52ce187c2da54944144f12afb0b6.tar.gz |
edje_cc: fix detecting missing part for insert_before/after
Summary:
Detecting missing part for insert_before/after is broken.
This patch makes the feature work and clarifies error message,
and removes redundant internal function.
Reviewers: cedric, jpeg
Subscribers: jpeg
Maniphest Tasks: T2513
Differential Revision: https://phab.enlightenment.org/D3576
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/edje/edje_cc.h | 1 | ||||
-rw-r--r-- | src/bin/edje/edje_cc_handlers.c | 12 | ||||
-rw-r--r-- | src/bin/edje/edje_cc_out.c | 58 |
3 files changed, 22 insertions, 49 deletions
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h index aa49caa8a4..b4da941806 100644 --- a/src/bin/edje/edje_cc.h +++ b/src/bin/edje/edje_cc.h @@ -240,7 +240,6 @@ char *mem_strdup(const char *s); #define SZ sizeof void using_file(const char *filename, const char type); -Eina_Bool needed_part_exists(Edje_Part_Collection *pc, const char *name); void error_and_abort(Eet_File *ef, const char *fmt, ...); diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 9b348f35f3..5e31e85271 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -5982,16 +5982,12 @@ st_collections_group_parts_part_physics_body(void) static void st_collections_group_parts_part_insert_before(void) { - /* Edje_Part_Collection *pc; */ Edje_Part_Parser *epp; - char *name; check_arg_count(1); - /* pc = eina_list_data_get(eina_list_last(edje_collections)); */ - name = parse_str(0); epp = (Edje_Part_Parser *)current_part; - epp->reorder.insert_before = name; + epp->reorder.insert_before = parse_str(0); } /** @@ -6010,16 +6006,12 @@ st_collections_group_parts_part_insert_before(void) static void st_collections_group_parts_part_insert_after(void) { - /* Edje_Part_Collection *pc; */ Edje_Part_Parser *epp; - char *name; check_arg_count(1); - /* pc = eina_list_data_get(eina_list_last(edje_collections)); */ - name = parse_str(0); epp = (Edje_Part_Parser *)current_part; - epp->reorder.insert_after = name; + epp->reorder.insert_after = parse_str(0); } /** diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index cc11fad5e0..50238629f5 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -2595,7 +2595,8 @@ reorder_parts(void) { ep = (Edje_Part_Parser *)pc->parts[i]; if (ep->reorder.insert_before && ep->reorder.insert_after) - ERR("Unable to use together insert_before and insert_after in part \"%s\".", pc->parts[i]->name); + error_and_abort(NULL, "In group \"%s\": Unable to use together insert_before and insert_after in part \"%s\".", + pc->part, pc->parts[i]->name); if (ep->reorder.done) { @@ -2609,15 +2610,13 @@ reorder_parts(void) if (ep->reorder.insert_before && !strcmp(ep->reorder.insert_before, pc->parts[j]->name)) { - needed_part_exists(pc, ep->reorder.insert_before); - ep2 = (Edje_Part_Parser *)pc->parts[j]; if (ep2->reorder.after) - ERR("The part \"%s\" is ambiguous ordered part.", - pc->parts[i]->name); + error_and_abort(NULL, "In group \"%s\": The part \"%s\" is ambiguous ordered part.", + pc->part, pc->parts[i]->name); if (ep2->reorder.linked_prev) - ERR("Unable to insert two or more parts in same part \"%s\".", - pc->parts[j]->name); + error_and_abort(NULL, "In group \"%s\": Unable to insert two or more parts in same part \"%s\".", + pc->part, pc->parts[j]->name); /* Need it to be able to insert an element before the first */ if (j == 0) k = 0; else k = j - 1; @@ -2634,13 +2633,13 @@ reorder_parts(void) else if (ep->reorder.insert_after && !strcmp(ep->reorder.insert_after, pc->parts[j]->name)) { - needed_part_exists(pc, ep->reorder.insert_after); - ep2 = (Edje_Part_Parser *)pc->parts[j]; if (ep2->reorder.before) - ERR("The part \"%s\" is ambiguous ordered part.", pc->parts[i]->name); + error_and_abort(NULL, "In group \"%s\": The part \"%s\" is ambiguous ordered part.", + pc->part, pc->parts[i]->name); if (ep2->reorder.linked_next) - ERR("Unable to insert two or more parts in same part \"%s\".", pc->parts[j]->name); + error_and_abort(NULL, "In group \"%s\": Unable to insert two or more parts in same part \"%s\".", + pc->part, pc->parts[j]->name); k = j; found = EINA_TRUE; ep2->reorder.linked_next += ep->reorder.linked_next + 1; @@ -2659,7 +2658,7 @@ reorder_parts(void) if (((i > k) && ((i - ep->reorder.linked_prev) <= k)) || ((i < k) && ((i + ep->reorder.linked_next) >= k))) - ERR("The part order is wrong. It has circular dependency."); + error_and_abort(NULL, "In group \"%s\": The part order is wrong. It has circular dependency.", pc->part); amount = ep->reorder.linked_prev + ep->reorder.linked_next + 1; linked = i - ep->reorder.linked_prev; @@ -2699,6 +2698,15 @@ reorder_parts(void) ep->reorder.done = EINA_TRUE; free(parts); } + else + { + if (ep->reorder.insert_before) + error_and_abort(NULL, "In group \"%s\": Unable to find part \"%s\" for insert_before in part \"%s\".", + pc->part, ep->reorder.insert_before, pc->parts[i]->name); + else + error_and_abort(NULL, "In group \"%s\": Unable to find part \"%s\" for insert_after in part \"%s\".", + pc->part, ep->reorder.insert_after, pc->parts[i]->name); + } } } } @@ -4113,29 +4121,3 @@ using_file(const char *filename, const char type) fclose(f); } } - -Eina_Bool -needed_part_exists(Edje_Part_Collection *pc, const char *name) -{ - Eina_Bool found; - unsigned int i; - - found = EINA_FALSE; - - for (i = 0; i < pc->parts_count; i++) - { - if (!strcmp(pc->parts[i]->name, name)) - { - found = EINA_TRUE; - break; - } - } - - if (!found) - { - ERR("Unable to find part name \"%s\" needed in group \"%s\".", - name, pc->part); - exit(-1); - } - return found; -} |