aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/edje/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/edje/src/bin')
-rw-r--r--libraries/edje/src/bin/Makefile.in2
-rw-r--r--libraries/edje/src/bin/edje_cc.h2
-rw-r--r--libraries/edje/src/bin/edje_cc_handlers.c251
-rw-r--r--libraries/edje/src/bin/edje_cc_mem.c10
-rw-r--r--libraries/edje/src/bin/edje_cc_out.c168
-rw-r--r--libraries/edje/src/bin/edje_inspector.c10
-rw-r--r--libraries/edje/src/bin/edje_player.c8
-rw-r--r--libraries/edje/src/bin/epp/Makefile.in2
8 files changed, 372 insertions, 81 deletions
diff --git a/libraries/edje/src/bin/Makefile.in b/libraries/edje/src/bin/Makefile.in
index 07bf025..877bcb2 100644
--- a/libraries/edje/src/bin/Makefile.in
+++ b/libraries/edje/src/bin/Makefile.in
@@ -291,6 +291,8 @@ PACKAGE_URL = @PACKAGE_URL@
291PACKAGE_VERSION = @PACKAGE_VERSION@ 291PACKAGE_VERSION = @PACKAGE_VERSION@
292PATH_SEPARATOR = @PATH_SEPARATOR@ 292PATH_SEPARATOR = @PATH_SEPARATOR@
293PKG_CONFIG = @PKG_CONFIG@ 293PKG_CONFIG = @PKG_CONFIG@
294PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
295PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
294PYTHON = @PYTHON@ 296PYTHON = @PYTHON@
295PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ 297PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
296PYTHON_PLATFORM = @PYTHON_PLATFORM@ 298PYTHON_PLATFORM = @PYTHON_PLATFORM@
diff --git a/libraries/edje/src/bin/edje_cc.h b/libraries/edje/src/bin/edje_cc.h
index d0c6d22..0291f29 100644
--- a/libraries/edje/src/bin/edje_cc.h
+++ b/libraries/edje/src/bin/edje_cc.h
@@ -147,6 +147,7 @@ void data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program *ep,
147void data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest); 147void data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest);
148void data_queue_image_lookup(char *name, int *dest, Eina_Bool *set); 148void data_queue_image_lookup(char *name, int *dest, Eina_Bool *set);
149void data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set); 149void data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set);
150void data_queue_image_remove(int *dest, Eina_Bool *set);
150void data_queue_part_slave_lookup(int *master, int *slave); 151void data_queue_part_slave_lookup(int *master, int *slave);
151void data_queue_image_slave_lookup(int *master, int *slave); 152void data_queue_image_slave_lookup(int *master, int *slave);
152void data_queue_spectrum_lookup(char *name, int *dest); 153void data_queue_spectrum_lookup(char *name, int *dest);
@@ -155,6 +156,7 @@ void data_process_lookups(void);
155void data_process_scripts(void); 156void data_process_scripts(void);
156void data_process_script_lookups(void); 157void data_process_script_lookups(void);
157 158
159void part_description_image_cleanup(Edje_Part *ep);
158 160
159int is_verbatim(void); 161int is_verbatim(void);
160void track_verbatim(int on); 162void track_verbatim(int on);
diff --git a/libraries/edje/src/bin/edje_cc_handlers.c b/libraries/edje/src/bin/edje_cc_handlers.c
index f74fa12..14ac0b7 100644
--- a/libraries/edje/src/bin/edje_cc_handlers.c
+++ b/libraries/edje/src/bin/edje_cc_handlers.c
@@ -106,6 +106,7 @@ static void st_collections_group_script_only(void);
106static void st_collections_group_alias(void); 106static void st_collections_group_alias(void);
107static void st_collections_group_min(void); 107static void st_collections_group_min(void);
108static void st_collections_group_max(void); 108static void st_collections_group_max(void);
109static void st_collections_group_broadcast_signal(void);
109static void st_collections_group_data_item(void); 110static void st_collections_group_data_item(void);
110static void st_collections_group_orientation(void); 111static void st_collections_group_orientation(void);
111 112
@@ -317,6 +318,7 @@ New_Statement_Handler statement_handlers[] =
317 {"collections.group.alias", st_collections_group_alias}, 318 {"collections.group.alias", st_collections_group_alias},
318 {"collections.group.min", st_collections_group_min}, 319 {"collections.group.min", st_collections_group_min},
319 {"collections.group.max", st_collections_group_max}, 320 {"collections.group.max", st_collections_group_max},
321 {"collections.group.broadcast_signal", st_collections_group_broadcast_signal},
320 {"collections.group.orientation", st_collections_group_orientation}, 322 {"collections.group.orientation", st_collections_group_orientation},
321 {"collections.group.data.item", st_collections_group_data_item}, 323 {"collections.group.data.item", st_collections_group_data_item},
322 {"collections.group.limits.horizontal", st_collections_group_limits_horizontal}, 324 {"collections.group.limits.horizontal", st_collections_group_limits_horizontal},
@@ -833,6 +835,39 @@ _edje_part_description_fill(Edje_Part_Description_Spec_Fill *fill)
833 fill->type = EDJE_FILL_TYPE_SCALE; 835 fill->type = EDJE_FILL_TYPE_SCALE;
834} 836}
835 837
838static void
839_edje_part_description_image_remove(Edje_Part_Description_Image *ed)
840{
841 unsigned int j;
842
843 if (!ed) return;
844
845 data_queue_image_remove(&(ed->image.id), &(ed->image.set));
846
847 for (j = 0; j < ed->image.tweens_count; ++j)
848 data_queue_image_remove(&(ed->image.tweens[j]->id),
849 &(ed->image.tweens[j]->set));
850}
851
852void
853part_description_image_cleanup(Edje_Part *ep)
854{
855 Edje_Part_Description_Image *ed;
856 unsigned int j;
857
858 if (ep->type != EDJE_PART_TYPE_IMAGE)
859 return ;
860
861 ed = (Edje_Part_Description_Image*) ep->default_desc;
862 _edje_part_description_image_remove(ed);
863
864 for (j = 0; j < ep->other.desc_count; j++)
865 {
866 ed = (Edje_Part_Description_Image*) ep->other.desc[j];
867 _edje_part_description_image_remove(ed);
868 }
869}
870
836static Edje_Part_Description_Common * 871static Edje_Part_Description_Common *
837_edje_part_description_alloc(unsigned char type, const char *collection, const char *part) 872_edje_part_description_alloc(unsigned char type, const char *collection, const char *part)
838{ 873{
@@ -2118,6 +2153,7 @@ ob_collections_group(void)
2118 pc = mem_alloc(SZ(Edje_Part_Collection)); 2153 pc = mem_alloc(SZ(Edje_Part_Collection));
2119 edje_collections = eina_list_append(edje_collections, pc); 2154 edje_collections = eina_list_append(edje_collections, pc);
2120 pc->id = current_de->id; 2155 pc->id = current_de->id;
2156 pc->broadcast_signal = EINA_TRUE; /* This was the behaviour by default in Edje 1.1 */
2121 2157
2122 cd = mem_alloc(SZ(Code)); 2158 cd = mem_alloc(SZ(Code));
2123 codes = eina_list_append(codes, cd); 2159 codes = eina_list_append(codes, cd);
@@ -2139,8 +2175,10 @@ ob_collections_group(void)
2139static void 2175static void
2140st_collections_group_name(void) 2176st_collections_group_name(void)
2141{ 2177{
2178 Edje_Part_Collection_Directory_Entry *alias;
2142 Edje_Part_Collection_Directory_Entry *older; 2179 Edje_Part_Collection_Directory_Entry *older;
2143 Edje_Part_Collection *current_pc; 2180 Edje_Part_Collection *current_pc;
2181 Eina_List *l = NULL;
2144 2182
2145 check_arg_count(1); 2183 check_arg_count(1);
2146 2184
@@ -2150,31 +2188,24 @@ st_collections_group_name(void)
2150 current_pc->part = current_de->entry; 2188 current_pc->part = current_de->entry;
2151 2189
2152 older = eina_hash_find(edje_file->collection, current_de->entry); 2190 older = eina_hash_find(edje_file->collection, current_de->entry);
2191 if (older) eina_hash_del(edje_file->collection, current_de->entry, older);
2192 eina_hash_direct_add(edje_file->collection, current_de->entry, current_de);
2193 if (!older) return;
2153 2194
2154 if (older) 2195 EINA_LIST_FOREACH(aliases, l, alias)
2155 { 2196 if (strcmp(alias->entry, current_de->entry) == 0)
2156 Edje_Part_Collection *pc; 2197 {
2157 Eina_List *l; 2198 Edje_Part_Collection *pc;
2158 Code *cd; 2199
2159 int i = 0; 2200 pc = eina_list_nth(edje_collections, older->id);
2160 2201 INF("overriding alias ('%s' => '%s') by group '%s'",
2161 pc = eina_list_nth(edje_collections, older->id); 2202 alias->entry, pc->part,
2162 cd = eina_list_nth(codes, older->id); 2203 current_de->entry);
2163 2204 aliases = eina_list_remove_list(aliases, l);
2164 eina_hash_del(edje_file->collection, current_de->entry, older); 2205 free(alias);
2165 edje_collections = eina_list_remove(edje_collections, pc); 2206 break;
2166 codes = eina_list_remove(codes, cd); 2207 }
2167
2168 EINA_LIST_FOREACH(edje_collections, l, pc)
2169 {
2170 older = eina_hash_find(edje_file->collection, pc->part);
2171
2172 pc->id = i++;
2173 if (older) older->id = pc->id;
2174 }
2175 }
2176 2208
2177 eina_hash_direct_add(edje_file->collection, current_de->entry, current_de);
2178} 2209}
2179 2210
2180typedef struct _Edje_List_Foreach_Data Edje_List_Foreach_Data; 2211typedef struct _Edje_List_Foreach_Data Edje_List_Foreach_Data;
@@ -2242,6 +2273,14 @@ st_collections_group_inherit(void)
2242 progname, file_in, line - 1, parent_name); 2273 progname, file_in, line - 1, parent_name);
2243 exit(-1); 2274 exit(-1);
2244 } 2275 }
2276 if (pc2 == pc)
2277 {
2278 ERR("%s: Error. parse error %s:%i. You are trying to inherit '%s' from itself. That's not possible."
2279 "If there is another group of the same name, you want to inherit from that group and have the"
2280 "same name as that group, there is a trick ! Just put the inherit before the directive that set"
2281 "the name !", progname, file_in, line - 1, parent_name);
2282 exit(-1);
2283 }
2245 2284
2246 if (pc2->data) 2285 if (pc2->data)
2247 { 2286 {
@@ -2463,6 +2502,8 @@ static void
2463st_collections_group_alias(void) 2502st_collections_group_alias(void)
2464{ 2503{
2465 Edje_Part_Collection_Directory_Entry *alias; 2504 Edje_Part_Collection_Directory_Entry *alias;
2505 Edje_Part_Collection_Directory_Entry *tmp;
2506 Eina_List *l;
2466 2507
2467 check_arg_count(1); 2508 check_arg_count(1);
2468 2509
@@ -2470,6 +2511,20 @@ st_collections_group_alias(void)
2470 alias->id = current_de->id; 2511 alias->id = current_de->id;
2471 alias->entry = parse_str(0); 2512 alias->entry = parse_str(0);
2472 2513
2514 EINA_LIST_FOREACH(aliases, l, tmp)
2515 if (strcmp(alias->entry, tmp->entry) == 0)
2516 {
2517 Edje_Part_Collection *pc;
2518
2519 pc = eina_list_nth(edje_collections, tmp->id);
2520 INF("overriding alias ('%s' => '%s') to ('%s' => '%s')",
2521 tmp->entry, pc->part,
2522 alias->entry, current_de->entry);
2523 aliases = eina_list_remove_list(aliases, l);
2524 free(tmp);
2525 break;
2526 }
2527
2473 aliases = eina_list_append(aliases, alias); 2528 aliases = eina_list_append(aliases, alias);
2474} 2529}
2475 2530
@@ -2520,6 +2575,28 @@ st_collections_group_max(void)
2520} 2575}
2521 2576
2522/** 2577/**
2578 @page edcref
2579 @property
2580 broadcast_signal
2581 @parameters
2582 [broadcast]
2583 @effect
2584 Signal got automatically broadcasted to all sub group part. Default to
2585 true since 1.1.
2586 @endproperty
2587*/
2588static void
2589st_collections_group_broadcast_signal(void)
2590{
2591 Edje_Part_Collection *pc;
2592
2593 check_arg_count(1);
2594
2595 pc = eina_list_data_get(eina_list_last(edje_collections));
2596 pc->broadcast_signal = parse_bool(0);
2597}
2598
2599/**
2523 @page edcref 2600 @page edcref
2524 @block 2601 @block
2525 script 2602 script
@@ -2947,21 +3024,57 @@ st_collections_group_parts_part_name(void)
2947static void 3024static void
2948st_collections_group_parts_part_type(void) 3025st_collections_group_parts_part_type(void)
2949{ 3026{
3027 unsigned int type;
3028
2950 check_arg_count(1); 3029 check_arg_count(1);
2951 3030
2952 current_part->type = parse_enum(0, 3031 type = parse_enum(0,
2953 "NONE", EDJE_PART_TYPE_NONE, 3032 "NONE", EDJE_PART_TYPE_NONE,
2954 "RECT", EDJE_PART_TYPE_RECTANGLE, 3033 "RECT", EDJE_PART_TYPE_RECTANGLE,
2955 "TEXT", EDJE_PART_TYPE_TEXT, 3034 "TEXT", EDJE_PART_TYPE_TEXT,
2956 "IMAGE", EDJE_PART_TYPE_IMAGE, 3035 "IMAGE", EDJE_PART_TYPE_IMAGE,
2957 "SWALLOW", EDJE_PART_TYPE_SWALLOW, 3036 "SWALLOW", EDJE_PART_TYPE_SWALLOW,
2958 "TEXTBLOCK", EDJE_PART_TYPE_TEXTBLOCK, 3037 "TEXTBLOCK", EDJE_PART_TYPE_TEXTBLOCK,
2959 "GROUP", EDJE_PART_TYPE_GROUP, 3038 "GROUP", EDJE_PART_TYPE_GROUP,
2960 "BOX", EDJE_PART_TYPE_BOX, 3039 "BOX", EDJE_PART_TYPE_BOX,
2961 "TABLE", EDJE_PART_TYPE_TABLE, 3040 "TABLE", EDJE_PART_TYPE_TABLE,
2962 "EXTERNAL", EDJE_PART_TYPE_EXTERNAL, 3041 "EXTERNAL", EDJE_PART_TYPE_EXTERNAL,
2963 "PROXY", EDJE_PART_TYPE_PROXY, 3042 "PROXY", EDJE_PART_TYPE_PROXY,
2964 NULL); 3043 NULL);
3044
3045 /* handle type change of inherited part */
3046 if (type != current_part->type)
3047 {
3048 Edje_Part_Description_Common *new, *previous;
3049 Edje_Part_Collection *pc;
3050 Edje_Part *ep;
3051 unsigned int i;
3052
3053 /* we don't free old part as we don't remove all reference to them */
3054 part_description_image_cleanup(current_part);
3055
3056 pc = eina_list_data_get(eina_list_last(edje_collections));
3057 ep = current_part;
3058
3059 previous = ep->default_desc;
3060 if (previous)
3061 {
3062 new = _edje_part_description_alloc(type, pc->part, ep->name);
3063 memcpy(new, previous, sizeof (Edje_Part_Description_Common));
3064
3065 ep->default_desc = new;
3066 }
3067
3068 for (i = 0; i < ep->other.desc_count; i++)
3069 {
3070 previous = ep->other.desc[i];
3071 new = _edje_part_description_alloc(type, pc->part, ep->name);
3072 memcpy(new, previous, sizeof (Edje_Part_Description_Common));
3073 ep->other.desc[i] = new;
3074 }
3075 }
3076
3077 current_part->type = type;
2965} 3078}
2966 3079
2967/** 3080/**
@@ -4292,6 +4405,7 @@ st_collections_group_parts_part_description_inherit(void)
4292 4405
4293 ied->image = iparent->image; 4406 ied->image = iparent->image;
4294 4407
4408 data_queue_image_remove(&ied->image.id, &ied->image.set);
4295 data_queue_copied_image_lookup(&iparent->image.id, &ied->image.id, &ied->image.set); 4409 data_queue_copied_image_lookup(&iparent->image.id, &ied->image.id, &ied->image.set);
4296 4410
4297 ied->image.tweens = calloc(iparent->image.tweens_count, 4411 ied->image.tweens = calloc(iparent->image.tweens_count,
@@ -4303,6 +4417,7 @@ st_collections_group_parts_part_description_inherit(void)
4303 iid = iparent->image.tweens[i]; 4417 iid = iparent->image.tweens[i];
4304 4418
4305 iid_new = mem_alloc(SZ(Edje_Part_Image_Id)); 4419 iid_new = mem_alloc(SZ(Edje_Part_Image_Id));
4420 data_queue_image_remove(&ied->image.id, &ied->image.set);
4306 data_queue_copied_image_lookup(&(iid->id), &(iid_new->id), &(iid_new->set)); 4421 data_queue_copied_image_lookup(&(iid->id), &(iid_new->id), &(iid_new->set));
4307 ied->image.tweens[i] = iid_new; 4422 ied->image.tweens[i] = iid_new;
4308 } 4423 }
@@ -4445,6 +4560,9 @@ st_collections_group_parts_part_description_state(void)
4445 if ((ep->default_desc->state.name && !strcmp(s, ep->default_desc->state.name) && ed->state.value == ep->default_desc->state.value) || 4560 if ((ep->default_desc->state.name && !strcmp(s, ep->default_desc->state.name) && ed->state.value == ep->default_desc->state.value) ||
4446 (!ep->default_desc->state.name && !strcmp(s, "default") && ed->state.value == ep->default_desc->state.value)) 4561 (!ep->default_desc->state.name && !strcmp(s, "default") && ed->state.value == ep->default_desc->state.value))
4447 { 4562 {
4563 if (ep->type == EDJE_PART_TYPE_IMAGE)
4564 _edje_part_description_image_remove((Edje_Part_Description_Image*) ed);
4565
4448 free(ed); 4566 free(ed);
4449 ep->other.desc_count--; 4567 ep->other.desc_count--;
4450 ep->other.desc = realloc(ep->other.desc, 4568 ep->other.desc = realloc(ep->other.desc,
@@ -4458,6 +4576,9 @@ st_collections_group_parts_part_description_state(void)
4458 { 4576 {
4459 if (!strcmp(s, ep->other.desc[i]->state.name) && ed->state.value == ep->other.desc[i]->state.value) 4577 if (!strcmp(s, ep->other.desc[i]->state.name) && ed->state.value == ep->other.desc[i]->state.value)
4460 { 4578 {
4579 if (ep->type == EDJE_PART_TYPE_IMAGE)
4580 _edje_part_description_image_remove((Edje_Part_Description_Image*) ed);
4581
4461 free(ed); 4582 free(ed);
4462 ep->other.desc_count--; 4583 ep->other.desc_count--;
4463 ep->other.desc = realloc(ep->other.desc, 4584 ep->other.desc = realloc(ep->other.desc,
@@ -4538,18 +4659,38 @@ st_collections_group_parts_part_description_fixed(void)
4538 @property 4659 @property
4539 min 4660 min
4540 @parameters 4661 @parameters
4541 [width] [height] 4662 [width] [height] or SOURCE
4542 @effect 4663 @effect
4543 The minimum size of the state. 4664 The minimum size of the state.
4665
4666 When min is defined to SOURCE, it will look at the original
4667 image size and enforce it minimal size to match at least the
4668 original one. The part must be an IMAGE or a GROUP part.
4544 @endproperty 4669 @endproperty
4545*/ 4670*/
4546static void 4671static void
4547st_collections_group_parts_part_description_min(void) 4672st_collections_group_parts_part_description_min(void)
4548{ 4673{
4549 check_arg_count(2); 4674 check_min_arg_count(1);
4675
4676 if (is_param(1)) {
4677 current_desc->min.w = parse_float_range(0, 0, 0x7fffffff);
4678 current_desc->min.h = parse_float_range(1, 0, 0x7fffffff);
4679 } else {
4680 char *tmp;
4681
4682 tmp = parse_str(0);
4683 if ((current_part->type != EDJE_PART_TYPE_IMAGE && current_part->type != EDJE_PART_TYPE_GROUP) ||
4684 !tmp || strcmp(tmp, "SOURCE") != 0)
4685 {
4686 ERR("%s: Error. parse error %s:%i. "
4687 "Only IMAGE and GROUP part can have a min: SOURCE; defined",
4688 progname, file_in, line - 1);
4689 exit(-1);
4690 }
4550 4691
4551 current_desc->min.w = parse_float_range(0, 0, 0x7fffffff); 4692 current_desc->min.limit = EINA_TRUE;
4552 current_desc->min.h = parse_float_range(1, 0, 0x7fffffff); 4693 }
4553} 4694}
4554 4695
4555/** 4696/**
@@ -4578,18 +4719,38 @@ st_collections_group_parts_part_description_minmul(void)
4578 @property 4719 @property
4579 max 4720 max
4580 @parameters 4721 @parameters
4581 [width] [height] 4722 [width] [height] or SOURCE
4582 @effect 4723 @effect
4583 The maximum size of the state. A size of -1.0 means that it will be ignored in one direction. 4724 The maximum size of the state. A size of -1.0 means that it will be ignored in one direction.
4725
4726 When max is set to SOURCE, edje will enforce the part to be
4727 not more than the original image size. The part must be an
4728 IMAGE part.
4584 @endproperty 4729 @endproperty
4585*/ 4730*/
4586static void 4731static void
4587st_collections_group_parts_part_description_max(void) 4732st_collections_group_parts_part_description_max(void)
4588{ 4733{
4589 check_arg_count(2); 4734 check_min_arg_count(1);
4735
4736 if (is_param(1)) {
4737 current_desc->max.w = parse_float_range(0, -1.0, 0x7fffffff);
4738 current_desc->max.h = parse_float_range(1, -1.0, 0x7fffffff);
4739 } else {
4740 char *tmp;
4590 4741
4591 current_desc->max.w = parse_float_range(0, -1.0, 0x7fffffff); 4742 tmp = parse_str(0);
4592 current_desc->max.h = parse_float_range(1, -1.0, 0x7fffffff); 4743 if (current_part->type != EDJE_PART_TYPE_IMAGE ||
4744 !tmp || strcmp(tmp, "SOURCE") != 0)
4745 {
4746 ERR("%s: Error. parse error %s:%i. "
4747 "Only IMAGE part can have a max: SOURCE; defined",
4748 progname, file_in, line - 1);
4749 exit(-1);
4750 }
4751
4752 current_desc->max.limit = EINA_TRUE;
4753 }
4593} 4754}
4594 4755
4595/** 4756/**
@@ -5039,6 +5200,7 @@ st_collections_group_parts_part_description_image_normal(void)
5039 char *name; 5200 char *name;
5040 5201
5041 name = parse_str(0); 5202 name = parse_str(0);
5203 data_queue_image_remove(&(ed->image.id), &(ed->image.set));
5042 data_queue_image_lookup(name, &(ed->image.id), &(ed->image.set)); 5204 data_queue_image_lookup(name, &(ed->image.id), &(ed->image.set));
5043 free(name); 5205 free(name);
5044 } 5206 }
@@ -5083,6 +5245,7 @@ st_collections_group_parts_part_description_image_tween(void)
5083 sizeof (Edje_Part_Image_Id*) * ed->image.tweens_count); 5245 sizeof (Edje_Part_Image_Id*) * ed->image.tweens_count);
5084 ed->image.tweens[ed->image.tweens_count - 1] = iid; 5246 ed->image.tweens[ed->image.tweens_count - 1] = iid;
5085 name = parse_str(0); 5247 name = parse_str(0);
5248 data_queue_image_remove(&(iid->id), &(iid->set));
5086 data_queue_image_lookup(name, &(iid->id), &(iid->set)); 5249 data_queue_image_lookup(name, &(iid->id), &(iid->set));
5087 free(name); 5250 free(name);
5088 } 5251 }
diff --git a/libraries/edje/src/bin/edje_cc_mem.c b/libraries/edje/src/bin/edje_cc_mem.c
index 7c1a5c9..d2d4ae0 100644
--- a/libraries/edje/src/bin/edje_cc_mem.c
+++ b/libraries/edje/src/bin/edje_cc_mem.c
@@ -7,12 +7,6 @@
7 7
8#include "edje_cc.h" 8#include "edje_cc.h"
9 9
10#ifdef _WIN32
11# define FMT_SIZE_T "%Iu"
12#else
13# define FMT_SIZE_T "%zu"
14#endif
15
16void * 10void *
17mem_alloc(size_t size) 11mem_alloc(size_t size)
18{ 12{
@@ -20,7 +14,7 @@ mem_alloc(size_t size)
20 14
21 mem = calloc(1, size); 15 mem = calloc(1, size);
22 if (mem) return mem; 16 if (mem) return mem;
23 ERR("%s: Error. %s:%i memory allocation of " FMT_SIZE_T " bytes failed. %s", 17 ERR("%s: Error. %s:%i memory allocation of %zu bytes failed. %s",
24 progname, file_in, line, size, strerror(errno)); 18 progname, file_in, line, size, strerror(errno));
25 exit(-1); 19 exit(-1);
26 return NULL; 20 return NULL;
@@ -33,7 +27,7 @@ mem_strdup(const char *s)
33 27
34 str = strdup(s); 28 str = strdup(s);
35 if (str) return str; 29 if (str) return str;
36 ERR("%s: Error. %s:%i memory allocation of " FMT_SIZE_T " bytes failed. %s. string being duplicated: \"%s\"", 30 ERR("%s: Error. %s:%i memory allocation of %zu bytes failed. %s. string being duplicated: \"%s\"",
37 progname, file_in, line, strlen(s) + 1, strerror(errno), s); 31 progname, file_in, line, strlen(s) + 1, strerror(errno), s);
38 exit(-1); 32 exit(-1);
39 return NULL; 33 return NULL;
diff --git a/libraries/edje/src/bin/edje_cc_out.c b/libraries/edje/src/bin/edje_cc_out.c
index 5050ad4..b4c541c 100644
--- a/libraries/edje/src/bin/edje_cc_out.c
+++ b/libraries/edje/src/bin/edje_cc_out.c
@@ -2,21 +2,30 @@
2# include "config.h" 2# include "config.h"
3#endif 3#endif
4 4
5#ifdef STDC_HEADERS
6# include <stdlib.h>
7# include <stddef.h>
8#else
9# ifdef HAVE_STDLIB_H
10# include <stdlib.h>
11# endif
12#endif
5#ifdef HAVE_ALLOCA_H 13#ifdef HAVE_ALLOCA_H
6# include <alloca.h> 14# include <alloca.h>
7#elif defined __GNUC__ 15#elif !defined alloca
8# define alloca __builtin_alloca 16# ifdef __GNUC__
9#elif defined _AIX 17# define alloca __builtin_alloca
10# define alloca __alloca 18# elif defined _AIX
11#elif defined _MSC_VER 19# define alloca __alloca
12# include <malloc.h> 20# elif defined _MSC_VER
13# define alloca _alloca 21# include <malloc.h>
14#else 22# define alloca _alloca
15# include <stddef.h> 23# elif !defined HAVE_ALLOCA
16# ifdef __cplusplus 24# ifdef __cplusplus
17extern "C" 25extern "C"
18# endif 26# endif
19void *alloca (size_t); 27void *alloca (size_t);
28# endif
20#endif 29#endif
21 30
22#include <string.h> 31#include <string.h>
@@ -102,7 +111,7 @@ struct _Code_Lookup
102 Eina_Bool set; 111 Eina_Bool set;
103}; 112};
104 113
105static void data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char *ptr, int len)); 114static void data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char* ptr, int len));
106 115
107Edje_File *edje_file = NULL; 116Edje_File *edje_file = NULL;
108Eina_List *edje_collections = NULL; 117Eina_List *edje_collections = NULL;
@@ -500,7 +509,8 @@ data_write_images(Eet_File *ef, int *image_num, int *input_bytes, int *input_raw
500 { 509 {
501 img = &edje_file->image_dir->entries[i]; 510 img = &edje_file->image_dir->entries[i];
502 511
503 if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) 512 if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL
513 || img->entry == NULL)
504 { 514 {
505 } 515 }
506 else 516 else
@@ -1550,6 +1560,23 @@ data_queue_image_lookup(char *name, int *dest, Eina_Bool *set)
1550} 1560}
1551 1561
1552void 1562void
1563data_queue_image_remove(int *dest, Eina_Bool *set)
1564{
1565 Eina_List *l;
1566 Image_Lookup *il;
1567
1568 EINA_LIST_FOREACH(image_lookups, l, il)
1569 {
1570 if (il->dest == dest && il->set == set)
1571 {
1572 image_lookups = eina_list_remove_list(image_lookups, l);
1573 free(il);
1574 return ;
1575 }
1576 }
1577 }
1578
1579void
1553data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set) 1580data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set)
1554{ 1581{
1555 Eina_List *l; 1582 Eina_List *l;
@@ -1602,14 +1629,64 @@ data_process_lookups(void)
1602 Program_Lookup *program; 1629 Program_Lookup *program;
1603 Group_Lookup *group; 1630 Group_Lookup *group;
1604 Image_Lookup *image; 1631 Image_Lookup *image;
1632 Eina_List *l2;
1605 Eina_List *l; 1633 Eina_List *l;
1634 Eina_Hash *images_in_use;
1606 void *data; 1635 void *data;
1636 Eina_Bool is_lua = EINA_FALSE;
1637
1638 /* remove all unreferenced Edje_Part_Collection */
1639 EINA_LIST_FOREACH_SAFE(edje_collections, l, l2, pc)
1640 {
1641 Edje_Part_Collection_Directory_Entry *alias;
1642 Edje_Part_Collection_Directory_Entry *find;
1643 Eina_List *l3;
1644 unsigned int id = 0;
1645 unsigned int i;
1646
1647 find = eina_hash_find(edje_file->collection, pc->part);
1648 if (find && find->id == pc->id)
1649 continue ;
1650
1651 EINA_LIST_FOREACH(aliases, l3, alias)
1652 if (alias->id == pc->id)
1653 continue ;
1654
1655 /* This Edje_Part_Collection is not used at all */
1656 edje_collections = eina_list_remove_list(edje_collections, l);
1657 l3 = eina_list_nth_list(codes, pc->id);
1658 codes = eina_list_remove_list(codes, l3);
1659
1660 /* Unref all image used by that group */
1661 for (i = 0; i < pc->parts_count; ++i)
1662 part_description_image_cleanup(pc->parts[i]);
1663
1664 /* Correct all id */
1665 EINA_LIST_FOREACH(edje_collections, l3, pc)
1666 {
1667 Eina_List *l4;
1668
1669 /* Some group could be removed from the collection, but still be referenced by alias */
1670 find = eina_hash_find(edje_file->collection, pc->part);
1671 if (pc->id != find->id) find = NULL;
1672
1673 /* Update all matching alias */
1674 EINA_LIST_FOREACH(aliases, l4, alias)
1675 if (pc->id == alias->id)
1676 alias->id = id;
1677
1678 pc->id = id++;
1679 if (find) find->id = pc->id;
1680 }
1681 }
1607 1682
1608 EINA_LIST_FOREACH(edje_collections, l, pc) 1683 EINA_LIST_FOREACH(edje_collections, l, pc)
1609 { 1684 {
1610 unsigned int count = 0; 1685 unsigned int count = 0;
1611 unsigned int i; 1686 unsigned int i;
1612 1687
1688 if (pc->lua_script_only)
1689 is_lua = EINA_TRUE;
1613#define PROGRAM_ID_SET(Type, Pc, It, Count) \ 1690#define PROGRAM_ID_SET(Type, Pc, It, Count) \
1614 for (It = 0; It < Pc->programs.Type ## _count; ++It) \ 1691 for (It = 0; It < Pc->programs.Type ## _count; ++It) \
1615 { \ 1692 { \
@@ -1738,13 +1815,15 @@ data_process_lookups(void)
1738 free(group); 1815 free(group);
1739 } 1816 }
1740 1817
1818 images_in_use = eina_hash_string_superfast_new(NULL);
1819
1741 EINA_LIST_FREE(image_lookups, image) 1820 EINA_LIST_FREE(image_lookups, image)
1742 { 1821 {
1743 Edje_Image_Directory_Entry *de;
1744 Eina_Bool find = EINA_FALSE; 1822 Eina_Bool find = EINA_FALSE;
1745 1823
1746 if (edje_file->image_dir) 1824 if (edje_file->image_dir)
1747 { 1825 {
1826 Edje_Image_Directory_Entry *de;
1748 unsigned int i; 1827 unsigned int i;
1749 1828
1750 for (i = 0; i < edje_file->image_dir->entries_count; ++i) 1829 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
@@ -1760,6 +1839,9 @@ data_process_lookups(void)
1760 *(image->dest) = de->id; 1839 *(image->dest) = de->id;
1761 *(image->set) = EINA_FALSE; 1840 *(image->set) = EINA_FALSE;
1762 find = EINA_TRUE; 1841 find = EINA_TRUE;
1842
1843 if (!eina_hash_find(images_in_use, image->name))
1844 eina_hash_direct_add(images_in_use, de->entry, de);
1763 break; 1845 break;
1764 } 1846 }
1765 } 1847 }
@@ -1774,10 +1856,20 @@ data_process_lookups(void)
1774 1856
1775 if ((set->name) && (!strcmp(set->name, image->name))) 1857 if ((set->name) && (!strcmp(set->name, image->name)))
1776 { 1858 {
1859 Edje_Image_Directory_Set_Entry *child;
1860 Eina_List *lc;
1861
1777 handle_slave_lookup(image_slave_lookups, image->dest, set->id); 1862 handle_slave_lookup(image_slave_lookups, image->dest, set->id);
1778 *(image->dest) = set->id; 1863 *(image->dest) = set->id;
1779 *(image->set) = EINA_TRUE; 1864 *(image->set) = EINA_TRUE;
1780 find = EINA_TRUE; 1865 find = EINA_TRUE;
1866
1867 EINA_LIST_FOREACH(set->entries, lc, child)
1868 if (!eina_hash_find(images_in_use, child->name))
1869 eina_hash_direct_add(images_in_use, child->name, child);
1870
1871 if (!eina_hash_find(images_in_use, image->name))
1872 eina_hash_direct_add(images_in_use, set->name, set);
1781 break; 1873 break;
1782 } 1874 }
1783 } 1875 }
@@ -1795,6 +1887,54 @@ data_process_lookups(void)
1795 free(image); 1887 free(image);
1796 } 1888 }
1797 1889
1890 if (edje_file->image_dir && !is_lua)
1891 {
1892 Edje_Image_Directory_Entry *de;
1893 Edje_Image_Directory_Set *set;
1894 unsigned int i;
1895
1896 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
1897 {
1898 de = edje_file->image_dir->entries + i;
1899
1900 if (de->entry && eina_hash_find(images_in_use, de->entry))
1901 continue ;
1902
1903 if (verbose)
1904 {
1905 printf("%s: Image '%s' in ressource 'edje/image/%i' will not be included as it is unused.\n", progname, de->entry, de->id);
1906 }
1907 else
1908 {
1909 INF("Image '%s' in ressource 'edje/image/%i' will not be included as it is unused.", de->entry, de->id);
1910 }
1911
1912 de->entry = NULL;
1913 }
1914
1915 for (i = 0; i < edje_file->image_dir->sets_count; ++i)
1916 {
1917 set = edje_file->image_dir->sets + i;
1918
1919 if (set->name && eina_hash_find(images_in_use, set->name))
1920 continue ;
1921
1922 if (verbose)
1923 {
1924 printf("%s: Set '%s' will not be included as it is unused.\n", progname, set->name);
1925 }
1926 else
1927 {
1928 INF("Set '%s' will not be included as it is unused.", set->name);
1929 }
1930
1931 set->name = NULL;
1932 set->entries = NULL;
1933 }
1934 }
1935
1936 eina_hash_free(images_in_use);
1937
1798 EINA_LIST_FREE(part_slave_lookups, data) 1938 EINA_LIST_FREE(part_slave_lookups, data)
1799 free(data); 1939 free(data);
1800 1940
diff --git a/libraries/edje/src/bin/edje_inspector.c b/libraries/edje/src/bin/edje_inspector.c
index 093de86..676c829 100644
--- a/libraries/edje/src/bin/edje_inspector.c
+++ b/libraries/edje/src/bin/edje_inspector.c
@@ -31,12 +31,6 @@ static int _log_dom;
31#define FLOAT_PRECISION 0.0001 31#define FLOAT_PRECISION 0.0001
32#define FDIFF(a, b) (fabs((a) - (b)) > FLOAT_PRECISION) 32#define FDIFF(a, b) (fabs((a) - (b)) > FLOAT_PRECISION)
33 33
34#ifdef _WIN32
35# define FMT_UCHAR "%c"
36#else
37# define FMT_UCHAR "%hhu"
38#endif
39
40/* context */ 34/* context */
41static Eina_List *groups; 35static Eina_List *groups;
42static Ecore_Evas *ee; 36static Ecore_Evas *ee;
@@ -1588,8 +1582,8 @@ main(int argc, char **argv)
1588 goto error_getopt; 1582 goto error_getopt;
1589 } 1583 }
1590 1584
1591 DBG("mode=%s, detail=%d(%s), group=%s, part=%s, program=%s, api-only=" FMT_UCHAR 1585 DBG("mode=%s, detail=%d(%s), group=%s, part=%s, program=%s, api-only=%hhu"
1592 ", api-fix=" FMT_UCHAR ", machine=" FMT_UCHAR ", file=%s", 1586 ", api-fix=%hhu, machine=%hhu, file=%s",
1593 mode, detail, detail_name, 1587 mode, detail, detail_name,
1594 group ? group : "", 1588 group ? group : "",
1595 part ? part : "", 1589 part ? part : "",
diff --git a/libraries/edje/src/bin/edje_player.c b/libraries/edje/src/bin/edje_player.c
index 4d0c0a3..208fbb4 100644
--- a/libraries/edje/src/bin/edje_player.c
+++ b/libraries/edje/src/bin/edje_player.c
@@ -20,12 +20,6 @@
20#include <Ecore_Evas.h> 20#include <Ecore_Evas.h>
21#include <Edje.h> 21#include <Edje.h>
22 22
23#ifdef _WIN32
24# define FMT_UCHAR "%c"
25#else
26# define FMT_UCHAR "%hhu"
27#endif
28
29struct opts { 23struct opts {
30 char *file; 24 char *file;
31 char *group; 25 char *group;
@@ -554,7 +548,7 @@ static unsigned char _parse_color(__UNUSED__ const Ecore_Getopt *parser, __UNUSE
554{ 548{
555 unsigned char *color = (unsigned char *)storage->ptrp; 549 unsigned char *color = (unsigned char *)storage->ptrp;
556 550
557 if (sscanf(str, FMT_UCHAR "," FMT_UCHAR "," FMT_UCHAR, color, color + 1, color + 2) != 3) 551 if (sscanf(str, "%hhu,%hhu,%hhu", color, color + 1, color + 2) != 3)
558 { 552 {
559 fprintf(stderr, "ERROR: incorrect color value '%s'\n", str); 553 fprintf(stderr, "ERROR: incorrect color value '%s'\n", str);
560 return 0; 554 return 0;
diff --git a/libraries/edje/src/bin/epp/Makefile.in b/libraries/edje/src/bin/epp/Makefile.in
index c1a8ee5..2ef2e56 100644
--- a/libraries/edje/src/bin/epp/Makefile.in
+++ b/libraries/edje/src/bin/epp/Makefile.in
@@ -225,6 +225,8 @@ PACKAGE_URL = @PACKAGE_URL@
225PACKAGE_VERSION = @PACKAGE_VERSION@ 225PACKAGE_VERSION = @PACKAGE_VERSION@
226PATH_SEPARATOR = @PATH_SEPARATOR@ 226PATH_SEPARATOR = @PATH_SEPARATOR@
227PKG_CONFIG = @PKG_CONFIG@ 227PKG_CONFIG = @PKG_CONFIG@
228PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
229PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
228PYTHON = @PYTHON@ 230PYTHON = @PYTHON@
229PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ 231PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
230PYTHON_PLATFORM = @PYTHON_PLATFORM@ 232PYTHON_PLATFORM = @PYTHON_PLATFORM@