cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=fcfa0f56a7e471c16cb901554d2ab2bc577ae837

commit fcfa0f56a7e471c16cb901554d2ab2bc577ae837
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Fri Feb 5 08:02:39 2016 +0100

    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: raster, jpeg
    
    Maniphest Tasks: T2513
    
    Differential Revision: https://phab.enlightenment.org/D3576
---
 src/bin/edje/edje_cc.h          |  1 -
 src/bin/edje/edje_cc_handlers.c | 12 ++----------
 src/bin/edje/edje_cc_out.c      | 32 ++++++++++++++++++++------------
 3 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index 84d8223..159d7ca 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -241,7 +241,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 2042064..09c2599 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -6030,16 +6030,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);
 }
 
 /**
@@ -6058,16 +6054,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 ea1c190..45eeb93 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -2596,7 +2596,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)
                {
@@ -2610,15 +2611,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;
@@ -2635,13 +2634,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;
@@ -2660,7 +2659,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;
@@ -2700,6 +2699,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);
+                    }
                }
           }
      }

-- 


Reply via email to