12
#include <Ecore_Getopt.h>
15
#include "edje_private.h"
17
#define EDJE_PICK_HELP_STRING \
18
"\nEdje Pick - the \"edj\" merging tool.\n\
19
===================================\n\n\
20
Use Edje Pick to compose a single edj file \
21
by selecting groups from edj files.\n\n\
22
Use Edje Pick as follows:\n\
23
Include files with \'--include\' file-name\n\
24
Follow the included file-name by names of selected groups from this file.\n\
25
To select a group use: \'--group\' group-name.\n\n\
26
You must specify merged file name with \'--output\' file-name.\n\
27
Use '--verbose' switch to get detailed log.\n\n\
28
To produce 3rd file \'out.edj\' that composed of:\n\
29
Group \'test\' from \'ex1.edj\' and \'test2\', \'test3\', from \'ex2.edj\'\n\
30
edje_pick -i ex1.edj -g test -i ex2.edj -g test2 -g test3 -o out.edj\n\n\
31
By using \'--append\' whole file content is selected.\n\
32
No need to specify selected groups with this switch.\n\
33
Note that selected group with will override group with the same name\n\
34
from appended-file when using \'--append\' switch.\n\n\
35
Example, the command:\n\
36
edje_pick -a theme1.edj -i default.edj -g elm/button/base/default \
37
-g elm/check/base/default -o hybrid.edj\n\n\
38
will produce a 3rd theme file \'hybrid.edj\',\n\
39
composed of all theme1.edj components.\n\
40
Replacing the button and check with widgets taken from default theme.\n\
41
(Given that theme1.edj button, check group-name are as in default.edj)\n"
49
typedef struct _Edje_Pick_Id Edje_Pick_Id;
51
struct _Edje_Pick_File_Params
59
Eina_List *scriptlist;
60
Eina_List *luascriptlist;
62
Eina_List *imagesetlist;
63
Eina_List *vectorlist;
64
Eina_List *samplelist;
66
Eina_List *vibrationlist;
69
typedef struct _Edje_Pick_File_Params Edje_Pick_File_Params;
80
typedef struct _Edje_Pick_Data Edje_Pick_Data;
84
Edje_Sound_Tone *tone;
87
typedef struct _Edje_Pick_Tone Edje_Pick_Tone;
97
typedef struct _Edje_Pick_Font Edje_Pick_Font;
102
Edje_Pick_File_Params *current_file;
104
typedef struct _Edje_Pick Edje_Pick;
106
static Edje_Pick context = { EINA_FALSE, NULL };
108
#define VERBOSE(COMMAND) if (context.v) { COMMAND; }
110
enum _Edje_Pick_Status
113
EDJE_PICK_OUT_FILENAME_MISSING,
114
EDJE_PICK_FAILED_OPEN_INP,
115
EDJE_PICK_FAILED_READ_INP,
116
EDJE_PICK_GROUP_NOT_FOUND,
117
EDJE_PICK_IMAGE_NOT_FOUND,
118
EDJE_PICK_SAMPLE_NOT_FOUND,
119
EDJE_PICK_INCLUDE_MISSING,
120
EDJE_PICK_GROUP_MISSING,
121
EDJE_PICK_PARSE_FAILED,
122
EDJE_PICK_HELP_SHOWN,
125
typedef enum _Edje_Pick_Status Edje_Pick_Status;
128
_edje_pick_args_show(Eina_List *ifs, char *out)
130
Edje_Pick_File_Params *p;
134
EINA_LOG_INFO("Got args for <%d> input files.\n", eina_list_count(ifs));
136
EINA_LIST_FOREACH(ifs, l, p)
141
printf("\nFile name: %s\n\tGroups: ALL (append mode)\n", p->name);
144
printf("\nFile name: %s\n\tGroups:\n", p->name);
145
EINA_LIST_FOREACH(p->groups, ll, g)
146
printf("\t\t%s\n", g);
150
EINA_LOG_INFO("\nOutput file name was <%s>\n", out);
154
_edje_pick_data_free(Eina_List *l)
158
EINA_LIST_FREE(l, ep)
160
if (ep->filename) eina_stringshare_del(ep->filename);
167
_edje_pick_out_file_free(Edje_File *out_file)
173
eet_close(out_file->ef);
175
if (out_file->external_dir)
177
if (out_file->external_dir->entries)
178
free(out_file->external_dir->entries);
180
free(out_file->external_dir);
183
if (out_file->image_dir)
185
if (out_file->image_dir->entries)
186
free(out_file->image_dir->entries);
188
free(out_file->image_dir);
191
if (out_file->sound_dir)
193
if (out_file->sound_dir->samples)
194
free(out_file->sound_dir->samples);
196
if (out_file->sound_dir->tones)
197
free(out_file->sound_dir->tones);
199
free(out_file->sound_dir);
201
if (out_file->vibration_dir)
203
if (out_file->vibration_dir->samples)
204
free(out_file->vibration_dir->samples);
206
free(out_file->vibration_dir);
209
eina_list_free(out_file->color_classes);
210
eina_hash_free_cb_set(out_file->collection, free);
211
eina_hash_free(out_file->collection);
212
eina_stringshare_del(out_file->compiler);
219
_edje_pick_cleanup(Eina_List *ifs, Edje_File *out_file, Edje_Pick_Status s)
221
Edje_Pick_File_Params *p;
225
_edje_pick_out_file_free(out_file);
227
EINA_LIST_FREE(ifs, p)
229
EINA_LIST_FREE(p->groups, n)
230
eina_stringshare_del(n);
232
_edje_pick_data_free(p->scriptlist);
233
p->scriptlist = NULL;
235
_edje_pick_data_free(p->luascriptlist);
236
p->luascriptlist = NULL;
238
_edje_pick_data_free(p->imagelist);
241
_edje_pick_data_free(p->vectorlist);
242
p->vectorlist = NULL;
244
_edje_pick_data_free(p->imagesetlist);
245
p->imagesetlist = NULL;
247
_edje_pick_data_free(p->samplelist);
249
EINA_LIST_FREE(p->tonelist, n)
253
_edje_cache_file_unref(p->edf);
255
EINA_LIST_FREE(p->fontlist, ft)
257
Edje_Font *st = ft->f;
259
eina_stringshare_del(st->name);
260
eina_stringshare_del(st->file);
271
case EDJE_PICK_OUT_FILENAME_MISSING:
272
EINA_LOG_ERR("Output file name missing.\n");
275
case EDJE_PICK_FAILED_OPEN_INP:
276
EINA_LOG_ERR("Failed to open input file.\n");
279
case EDJE_PICK_FAILED_READ_INP:
280
EINA_LOG_ERR("Failed to read input file.\n");
283
case EDJE_PICK_DUP_GROUP:
284
EINA_LOG_ERR("Can't fetch groups with identical name from various files.\n");
287
case EDJE_PICK_INCLUDE_MISSING:
288
EINA_LOG_ERR("Cannot select groups when no input file included.\n");
291
case EDJE_PICK_GROUP_MISSING:
292
EINA_LOG_ERR("Group name missing for include file.\n");
295
case EDJE_PICK_PARSE_FAILED:
296
EINA_LOG_ERR("Command parsing failed.\n");
303
_edje_edd_shutdown();
310
_group_name_in_other_file(Eina_List *inp_files, void *d1, void *d2)
312
Edje_Pick_File_Params *inp_file = d1;
315
Edje_Pick_File_Params *current_file;
317
EINA_LIST_FOREACH(inp_files, f, current_file)
318
if (inp_file != current_file)
319
if (eina_list_search_unsorted(current_file->groups,
320
(Eina_Compare_Cb)strcmp,
328
_edje_pick_command_line_parse(int argc, char **argv,
329
Eina_List **ifs, char **ofn)
331
Eina_List *gpf = NULL;
332
Eina_List *a_files = NULL;
333
Eina_List *i_files = NULL;
337
Eina_List *groups = NULL;
338
char *output_filename = NULL;
339
Edje_Pick_File_Params *current_inp = NULL;
340
Eina_List *files = NULL;
344
Eina_Bool show_help = EINA_FALSE;
347
#define IS_GROUP(x) ((!strcmp(x, "-g")) || (!strcmp(x, "--group")))
348
#define IS_INCLUDE(x) ((!strcmp(x, "-i")) || (!strcmp(x, "--include")))
349
#define IS_HELP(x) ((!strcmp(x, "-h")) || (!strcmp(x, "--help")))
350
static const Ecore_Getopt optdesc = {
354
"(C) 2012 Enlightenment",
356
"Edje Pick - the \"edj\" merging tool.",
360
ECORE_GETOPT_STORE_TRUE('v', "verbose", "Verbose"),
361
ECORE_GETOPT_STORE('o', "output", "Output File",
362
ECORE_GETOPT_TYPE_STR),
363
ECORE_GETOPT_APPEND_METAVAR('a', "append", "Append File",
364
"STRING", ECORE_GETOPT_TYPE_STR),
365
ECORE_GETOPT_APPEND_METAVAR('i', "include", "Include File",
366
"STRING", ECORE_GETOPT_TYPE_STR),
367
ECORE_GETOPT_APPEND_METAVAR('g', "group", "Add Group",
368
"STRING", ECORE_GETOPT_TYPE_STR),
369
ECORE_GETOPT_HELP('h', "help"),
370
ECORE_GETOPT_SENTINEL
374
Ecore_Getopt_Value values[] = {
375
ECORE_GETOPT_VALUE_BOOL(context.v),
376
ECORE_GETOPT_VALUE_STR(output_filename),
377
ECORE_GETOPT_VALUE_LIST(a_files),
378
ECORE_GETOPT_VALUE_LIST(i_files),
379
ECORE_GETOPT_VALUE_LIST(groups),
380
ECORE_GETOPT_VALUE_NONE
385
for (k = 1; k < argc; k++)
387
if (IS_GROUP(argv[k]))
390
return _edje_pick_cleanup(files, NULL,
391
EDJE_PICK_INCLUDE_MISSING);
397
if (IS_INCLUDE(argv[k]))
399
c = calloc(1, sizeof(int));
400
gpf = eina_list_append(gpf, c);
404
show_help |= IS_HELP(argv[k]);
408
puts(EDJE_PICK_HELP_STRING);
410
if (ecore_getopt_parse(&optdesc, values, argc, argv) < 0)
412
EINA_LIST_FREE(gpf, c)
415
return _edje_pick_cleanup(files, NULL, EDJE_PICK_PARSE_FAILED);
420
EINA_LIST_FREE(gpf, c)
423
ecore_getopt_list_free(i_files);
424
ecore_getopt_list_free(groups);
425
return _edje_pick_cleanup(files, NULL, EDJE_PICK_HELP_SHOWN);
429
eina_log_level_set(EINA_LOG_LEVEL_INFO);
431
EINA_LIST_FOREACH(a_files, l, str)
433
current_inp = calloc(1, sizeof(*current_inp));
434
current_inp->append = EINA_TRUE;
435
current_inp->name = eina_stringshare_add(str);
436
files = eina_list_append(files, current_inp);
438
ecore_getopt_list_free(a_files);
442
EINA_LIST_FOREACH(i_files, l, str)
444
current_inp = calloc(1, sizeof(*current_inp));
445
current_inp->name = eina_stringshare_add(str);
446
files = eina_list_append(files, current_inp);
447
c = eina_list_data_get(ll);
455
EINA_LIST_FREE(gpf, c)
458
ecore_getopt_list_free(i_files);
459
ecore_getopt_list_free(groups);
460
return _edje_pick_cleanup(files, NULL,
461
EDJE_PICK_GROUP_MISSING);
464
g_name = eina_list_data_get(cg);
465
if (_group_name_in_other_file(files, current_inp, g_name))
466
return _edje_pick_cleanup(files, NULL, EDJE_PICK_DUP_GROUP);
468
if (!eina_list_search_unsorted(current_inp->groups,
469
(Eina_Compare_Cb)strcmp, g_name))
470
current_inp->groups = eina_list_append(
471
current_inp->groups, eina_stringshare_add(g_name));
473
cg = eina_list_next(cg);
477
ll = eina_list_next(ll);
480
EINA_LIST_FREE(gpf, c)
483
ecore_getopt_list_free(i_files);
484
ecore_getopt_list_free(groups);
486
if (!output_filename)
487
return _edje_pick_cleanup(files, NULL, EDJE_PICK_OUT_FILENAME_MISSING);
492
*ofn = output_filename;
493
return EDJE_PICK_NO_ERROR;
497
_edje_pick_external_dir_update(Edje_File *o, Edje_File *edf)
499
if (edf->external_dir && edf->external_dir->entries_count)
502
unsigned int total = 0;
503
unsigned int base = 0;
504
Edje_External_Directory_Entry *entries;
507
base = total = o->external_dir->entries_count;
509
o->external_dir = calloc(1, sizeof(*(o->external_dir)));
511
total += edf->external_dir->entries_count;
513
entries = realloc(o->external_dir->entries,
514
total * sizeof(Edje_External_Directory_Entry));
517
EINA_LOG_ERR("Out of memory in realloc()");
520
o->external_dir->entries = entries;
522
memcpy(&o->external_dir->entries[base], edf->external_dir->entries,
523
edf->external_dir->entries_count *
524
sizeof(Edje_External_Directory_Entry));
526
o->external_dir->entries_count = total;
531
_edje_pick_output_prepare(Edje_File *o, Edje_File *edf, char *name)
536
o = calloc(1, sizeof(Edje_File));
537
o->compiler = eina_stringshare_add("edje_cc");
538
o->version = edf->version;
539
o->minor = edf->minor;
540
o->feature_ver = edf->feature_ver;
541
o->base_scale = edf->base_scale;
542
o->collection = eina_hash_string_small_new(NULL);
543
o->data = eina_hash_string_small_new(NULL);
544
o->fonts = eina_hash_string_small_new(NULL);
547
o->ef = eet_open(name, EET_FILE_MODE_WRITE);
551
if (o->version != edf->version)
553
EINA_LOG_WARN("Warning: Merging files of various version.\n");
554
if (o->version < edf->version)
555
o->version = edf->version;
558
if (o->minor != edf->minor)
560
EINA_LOG_WARN("Warning: Merging files of various minor.\n");
561
if (o->minor < edf->minor)
562
o->minor = edf->minor;
565
if (o->feature_ver != edf->feature_ver)
567
EINA_LOG_WARN("Warning: Merging files of various feature_ver.\n");
568
if (o->feature_ver < edf->feature_ver)
569
o->feature_ver = edf->feature_ver;
571
if (NEQ(o->base_scale, edf->base_scale))
573
EINA_LOG_ERR("Error: Merging files of various base scale. Base scale of the files should be same.\n");
579
_edje_pick_external_dir_update(o, edf);
584
_edje_pick_header_alias_parent_add(Edje_File *out_file, Edje_File *edf, Edje_Part_Collection_Directory_Entry *ce, Edje_Part_Collection_Directory_Entry *ce_out)
586
Edje_Part_Collection_Directory_Entry *ce_cor, *ce_new, *ce_f;
589
if (!ce->group_alias) return;
591
i = eina_hash_iterator_data_new(edf->collection);
592
EINA_ITERATOR_FOREACH(i, ce_cor)
595
if ((ce->id == ce_cor->id) && (!ce_cor->group_alias))
597
ce_f = eina_hash_find(out_file->collection, ce_cor->entry);
600
ce_new = malloc(sizeof(*ce_new));
601
memcpy(ce_new, ce_cor, sizeof(*ce_new));
602
ce_new->id = ce_out->id;
603
eina_hash_direct_add(out_file->collection, ce_new->entry, ce_new);
607
ce_out->id = ce_f->id;
611
eina_iterator_free(i);
615
_edje_pick_header_dependencies_check(Edje_File *out_file, Edje_File *edf, Eina_List *groups, Edje_Part_Collection_Directory_Entry *ce, int *current_id)
618
Edje_Part_Collection *edc;
621
Edje_Pack_Element *item;
622
Eina_List *dep_list = NULL, *dep_list_inner = NULL;
624
edje_cache_emp_alloc(ce);
626
snprintf(buf, sizeof(buf), "edje/collections/%i", ce->id);
627
EINA_LOG_INFO("Trying to read group <%s>\n", buf);
628
edc = eet_data_read(edf->ef, _edje_edd_edje_part_collection, buf);
631
EINA_LOG_ERR("Failed to read group <%s> id <%d>\n", ce->entry, ce->id);
634
#define GROUP_CHECK_AND_ADD(NAME) \
637
Edje_Part_Collection_Directory_Entry *ce_cor; \
638
if (eina_list_search_unsorted(groups, (void *)strcmp, NAME)) goto exit; \
639
ce_cor = eina_hash_find(edf->collection, NAME); \
640
if (!eina_hash_find(out_file->collection, ce_cor->entry)) \
642
dep_list_inner = _edje_pick_header_dependencies_check(out_file, edf, groups, ce_cor, current_id); \
643
dep_list = eina_list_merge(dep_list, dep_list_inner); \
645
if ((ce_cor) && (!eina_hash_find(out_file->collection, NAME))) \
647
Edje_Part_Collection_Directory_Entry *ce_out; \
648
ce_out = malloc(sizeof(*ce_out)); \
649
memcpy(ce_out, ce_cor, sizeof(*ce_out)); \
650
ce_out->id = *current_id; \
651
if (ce_out->group_alias) \
652
_edje_pick_header_alias_parent_add(out_file, edf, ce, ce_out); \
653
EINA_LOG_INFO("Changing ID of group <%d> to <%d>\n", ce->id, ce_out->id); \
654
eina_hash_direct_add(out_file->collection, ce_out->entry, ce_out); \
656
dep_list = eina_list_append(dep_list, eina_stringshare_add(ce_out->entry)); \
660
for (i = 0; i < edc->parts_count; i++)
662
part = edc->parts[i];
663
GROUP_CHECK_AND_ADD(part->source);
664
GROUP_CHECK_AND_ADD(part->source2);
665
GROUP_CHECK_AND_ADD(part->source3);
666
GROUP_CHECK_AND_ADD(part->source4);
667
GROUP_CHECK_AND_ADD(part->source5);
668
GROUP_CHECK_AND_ADD(part->source6);
669
for (j = 0; j < part->items_count; j++)
671
item = part->items[j];
672
GROUP_CHECK_AND_ADD(item->source);
677
edje_cache_emp_free(ce);
679
#undef GROUP_CHECK_AND_ADD
683
_edje_pick_data_update(Edje_File *out_file, Edje_File *edf)
685
Eina_Bool status = EDJE_PICK_NO_ERROR;
687
Eina_Stringshare *key, *value;
689
i = eina_hash_iterator_key_new(edf->data);
690
EINA_ITERATOR_FOREACH(i, key)
692
if (eina_hash_find(out_file->data, key)) continue;
693
value = eina_hash_find(edf->data, key);
694
eina_hash_direct_add(out_file->data, key, value);
701
_edje_pick_header_make(Edje_File *out_file, Edje_File *edf, Eina_List *ifs)
703
static int current_group_id = 0;
704
Edje_Part_Collection_Directory_Entry *ce;
705
Eina_Bool status = EDJE_PICK_NO_ERROR;
706
Eina_List *l, *alist = NULL;
708
Eina_List *deps = NULL, *dep_list = NULL;
712
if (context.current_file->append)
714
i = eina_hash_iterator_key_new(edf->collection);
715
EINA_ITERATOR_FOREACH(i, name1)
717
Edje_Part_Collection_Directory_Entry *ce_out;
724
if (_group_name_in_other_file(ifs, context.current_file, name1))
727
ce = eina_hash_find(edf->collection, name1);
728
ce_out = malloc(sizeof(*ce_out));
729
memcpy(ce_out, ce, sizeof(*ce_out));
730
if (ce_out->group_alias)
731
alist = eina_list_append(alist, eina_stringshare_add(name1));
733
ce_out->id = current_group_id;
736
eina_hash_direct_add(out_file->collection, ce_out->entry, ce_out);
739
context.current_file->groups = eina_list_append(
740
context.current_file->groups, eina_stringshare_add(name1));
743
eina_iterator_free(i);
744
EINA_LIST_FOREACH(alist, l, name1)
746
Edje_Part_Collection_Directory_Entry *ce_cor;
748
ce = eina_hash_find(edf->collection, name1);
749
i = eina_hash_iterator_data_new(edf->collection);
750
EINA_ITERATOR_FOREACH(i, ce_cor)
752
if ((ce->id == ce_cor->id) && (!ce_cor->group_alias))
755
ce = eina_hash_find(out_file->collection, ce_cor->entry);
756
ce_cor = eina_hash_find(out_file->collection, name1);
758
eina_iterator_free(i);
760
EINA_LIST_FREE(alist, name1)
761
eina_stringshare_del(name1);
765
EINA_LIST_FOREACH(context.current_file->groups, l, name1)
768
ce = eina_hash_find(edf->collection, name1);
772
EINA_LOG_ERR("Group <%s> was not found in <%s> file.\n",
773
name1, context.current_file->name);
774
status = EDJE_PICK_GROUP_NOT_FOUND;
778
Edje_Part_Collection_Directory_Entry *ce_out;
781
ce_out = malloc(sizeof(*ce_out));
783
memcpy(ce_out, ce, sizeof(*ce_out));
784
ce_out->id = current_group_id;
785
if (ce_out->group_alias)
786
_edje_pick_header_alias_parent_add(out_file, edf, ce, ce_out);
787
EINA_LOG_INFO("Changing ID of group <%d> to <%d>\n", ce->id, ce_out->id);
790
eina_hash_direct_add(out_file->collection, ce_out->entry,
792
dep_list = _edje_pick_header_dependencies_check(out_file, edf, context.current_file->groups, ce, ¤t_group_id);
793
if (!deps) deps = dep_list;
794
else deps = eina_list_merge(deps, dep_list);
797
EINA_LIST_FREE(deps, name1)
798
context.current_file->groups = eina_list_append(context.current_file->groups, name1);
805
_old_id_cmp(const void *d1, const void *d2)
808
return ((Edje_Pick_Data *)d1)->id.old_id - ((intptr_t)d2);
812
_new_id_cmp(const void *d1, const void *d2)
815
return ((Edje_Pick_Data *)d1)->id.new_id - ((intptr_t)d2);
819
_edje_pick_new_id_get(Eina_List *id_list, int id, Eina_Bool set_used)
823
Edje_Pick_Data *p_id = eina_list_search_unsorted(id_list,
825
(void *)(intptr_t)id);
830
p_id->id.used = EINA_TRUE;
832
return p_id->id.new_id;
840
_edje_pick_image_new_id_get(Eina_List *id_list, int id)
844
Edje_Pick_Data *p_id = eina_list_search_unsorted(id_list,
846
(void *)(intptr_t)id);
847
if (p_id) return p_id->id.new_id;
854
_edje_pick_image_old_id_get(Eina_List *id_list, int id)
858
Edje_Pick_Data *p_id = eina_list_search_unsorted(id_list,
860
(void *)(intptr_t)id);
861
if (p_id) return p_id->id.old_id;
868
_edje_pick_images_copy(Edje_File *edf, Edje_File *o)
871
Eina_Bool status = EDJE_PICK_NO_ERROR;
873
Edje_Pick_Data *image, *set, *vector;
877
if (edf->image_dir->entries)
879
Edje_Image_Directory_Entry *entries = NULL;
881
EINA_LIST_FOREACH(context.current_file->imagelist, l, image)
885
o->image_dir->entries_count += 1;
888
entries = realloc(o->image_dir->entries,
889
o->image_dir->entries_count *
890
sizeof(Edje_Image_Directory_Entry));
893
EINA_LOG_ERR("Out of memory in realloc()");
894
return EDJE_PICK_IMAGE_NOT_FOUND;
896
o->image_dir->entries = entries;
898
old_id = _edje_pick_image_old_id_get(
899
context.current_file->imagelist, o->image_dir->entries_count - 1);
901
memcpy(&o->image_dir->entries[o->image_dir->entries_count - 1],
902
&edf->image_dir->entries[old_id],
903
sizeof(Edje_Image_Directory_Entry));
904
o->image_dir->entries[o->image_dir->entries_count - 1].id = image->id.new_id;
909
if (edf->image_dir->sets)
911
Edje_Image_Directory_Set *sets;
913
EINA_LIST_FOREACH(context.current_file->imagesetlist, l, set)
917
Edje_Image_Directory_Set_Entry *e;
919
o->image_dir->sets_count += 1;
921
sets = realloc(o->image_dir->sets,
922
o->image_dir->sets_count *
923
sizeof(Edje_Image_Directory_Set));
926
EINA_LOG_ERR("Out of memory in realloc()");
927
return EDJE_PICK_IMAGE_NOT_FOUND;
929
o->image_dir->sets = sets;
931
old_id = _edje_pick_image_old_id_get(
932
context.current_file->imagesetlist, o->image_dir->sets_count - 1);
934
memcpy(&o->image_dir->sets[o->image_dir->sets_count - 1],
935
&edf->image_dir->sets[old_id],
936
sizeof(Edje_Image_Directory_Set));
937
o->image_dir->sets[o->image_dir->sets_count - 1].id = set->id.new_id;
939
EINA_LIST_FOREACH(o->image_dir->sets[o->image_dir->sets_count - 1].entries, l1, e)
940
e->id = _edje_pick_image_new_id_get(
941
context.current_file->imagelist,
947
if (edf->image_dir->vectors)
949
Edje_Vector_Directory_Entry *vectors = NULL;
951
EINA_LIST_FOREACH(context.current_file->vectorlist, l, vector)
955
o->image_dir->vectors_count += 1;
958
vectors = realloc(o->image_dir->vectors,
959
o->image_dir->vectors_count *
960
sizeof(Edje_Vector_Directory_Entry));
963
EINA_LOG_ERR("Out of memory in realloc()");
964
return EDJE_PICK_IMAGE_NOT_FOUND;
966
o->image_dir->vectors = vectors;
968
old_id = _edje_pick_image_old_id_get(
969
context.current_file->vectorlist, o->image_dir->vectors_count - 1);
971
memcpy(&o->image_dir->vectors[o->image_dir->vectors_count - 1],
972
&edf->image_dir->vectors[old_id],
973
sizeof(Edje_Vector_Directory_Entry));
974
o->image_dir->vectors[o->image_dir->vectors_count - 1].id = vector->id.new_id;
984
_edje_pick_sounds_add(Edje_File *edf)
989
Eina_Bool status = EDJE_PICK_NO_ERROR;
990
static int current_sample_id = 0;
994
for (k = 0; k < (int)edf->sound_dir->samples_count; k++)
996
Edje_Sound_Sample *sample = &edf->sound_dir->samples[k];
998
snprintf(buf, sizeof(buf), "edje/sounds/%i", sample->id);
999
VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", sample->snd_src));
1001
data = eet_read(edf->ef, buf, &size);
1004
Edje_Pick_Data *smpl = malloc(sizeof(*smpl));
1005
smpl->filename = eina_stringshare_add(sample->snd_src);
1008
smpl->entry = (void *)sample;
1009
smpl->id.old_id = sample->id;
1010
sample->id = smpl->id.new_id = current_sample_id;
1011
smpl->id.used = EINA_FALSE;
1013
VERBOSE(EINA_LOG_INFO("Read <%s> sample data <%p> size <%d>\n",
1014
buf, smpl->data, smpl->size));
1016
current_sample_id++;
1017
context.current_file->samplelist =
1018
eina_list_append(context.current_file->samplelist, smpl);
1022
EINA_LOG_ERR("Sample <%s> was not found in <%s> file.\n",
1023
sample->name, context.current_file->name);
1024
status = EDJE_PICK_SAMPLE_NOT_FOUND;
1030
for (k = 0; k < (int)edf->sound_dir->tones_count; k++)
1033
Edje_Pick_Tone *t = malloc(sizeof(*t));
1035
t->tone = &edf->sound_dir->tones[k];
1037
t->tone->id = _edje_pick_new_id_get(context.current_file->samplelist,
1038
t->tone->id, EINA_FALSE);
1040
t->used = EINA_FALSE;
1041
context.current_file->tonelist = eina_list_append(context.current_file->tonelist, t);
1049
_edje_pick_vibrations_add(Edje_File *edf)
1054
Eina_Bool status = EDJE_PICK_NO_ERROR;
1055
static int current_sample_id = 0;
1057
if (edf->vibration_dir)
1059
for (k = 0; k < (int)edf->vibration_dir->samples_count; k++)
1061
Edje_Vibration_Sample *sample = &edf->vibration_dir->samples[k];
1063
snprintf(buf, sizeof(buf), "edje/vibrations/%i", sample->id);
1064
VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", sample->name));
1066
data = eet_read(edf->ef, buf, &size);
1069
Edje_Pick_Data *smpl = malloc(sizeof(*smpl));
1070
smpl->filename = eina_stringshare_add(sample->name);
1073
smpl->entry = (void *)sample;
1074
smpl->id.old_id = sample->id;
1075
sample->id = smpl->id.new_id = current_sample_id;
1076
smpl->id.used = EINA_FALSE;
1078
VERBOSE(EINA_LOG_INFO("Read <%s> sample data <%p> size <%d>\n",
1079
buf, smpl->data, smpl->size));
1081
current_sample_id++;
1082
context.current_file->vibrationlist =
1083
eina_list_append(context.current_file->vibrationlist, smpl);
1087
EINA_LOG_ERR("Sample <%s> was not found in <%s> file.\n",
1088
sample->name, context.current_file->name);
1089
status = EDJE_PICK_SAMPLE_NOT_FOUND;
1100
_font_cmp(const void *d1, const void *d2)
1102
const Edje_Font *f1 = d1;
1103
const Edje_Font *f2 = d2;
1106
return strcmp(f1->name, f2->name) |
1107
strcmp(f1->file, f2->file);
1111
_Edje_Pick_Fonts_add(Edje_File *out_file, Edje_File *edf)
1117
if (!edf->fonts) return -1;
1119
it = eina_hash_iterator_data_new(edf->fonts);
1122
EINA_ITERATOR_FOREACH(it, f)
1124
if (!eina_list_search_unsorted(context.current_file->fontlist, _font_cmp, f))
1127
Edje_Pick_Font *ft = malloc(sizeof(*ft));
1128
Edje_Font *st = malloc(sizeof(*st));
1131
st->name = (char *)eina_stringshare_add(f->name);
1132
st->file = (char *)eina_stringshare_add(f->file);
1134
snprintf(buf, sizeof(buf), "edje/fonts/%s", f->name);
1135
VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", f->name));
1136
ft->data = eet_read(edf->ef, buf, &ft->size);
1139
eina_stringshare_del(st->name);
1140
eina_stringshare_del(st->file);
1143
VERBOSE(EINA_LOG_INFO("Enable to read <%s>. Skip.\n", f->name));
1148
ft->used = EINA_TRUE;
1149
context.current_file->fontlist = eina_list_append(context.current_file->fontlist, ft);
1150
eina_hash_direct_add(out_file->fonts, st->name, st);
1153
eina_iterator_free(it);
1155
return EDJE_PICK_NO_ERROR;
1159
_edje_pick_scripts_add(Edje_File *edf, int id, int new_id)
1166
snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i", id);
1167
data = eet_read(edf->ef, buf, &size);
1170
Edje_Pick_Data *s = calloc(1, sizeof(*s));
1175
s->id.new_id = new_id;
1176
s->id.used = EINA_TRUE;
1178
VERBOSE(EINA_LOG_INFO("Read embryo script <%s> data <%p> size <%d>\n",
1179
buf, s->data, s->size));
1180
context.current_file->scriptlist = eina_list_append(context.current_file->scriptlist, s);
1188
return EDJE_PICK_NO_ERROR;
1192
_edje_pick_lua_scripts_add(Edje_File *edf, int id, int new_id)
1199
snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", id);
1200
data = eet_read(edf->ef, buf, &size);
1203
Edje_Pick_Data *s = calloc(1, sizeof(*s));
1208
s->id.new_id = new_id;
1209
s->id.used = EINA_TRUE;
1211
VERBOSE(EINA_LOG_INFO("Read lua script <%s> data <%p> size <%d>\n",
1212
buf, s->data, s->size));
1213
context.current_file->luascriptlist = eina_list_append(context.current_file->luascriptlist, s);
1221
return EDJE_PICK_NO_ERROR;
1225
_edje_pick_image_entry_add(int id, Edje_File *edf, Edje_File *o)
1230
static int current_img_id = -1;
1232
int new_id = _edje_pick_image_new_id_get(context.current_file->imagelist, id);
1233
if (new_id >= 0) return new_id;
1238
o->image_dir = calloc(1, sizeof(*(o->image_dir)));
1240
if (edf->image_dir->entries)
1242
Edje_Image_Directory_Entry *img = &edf->image_dir->entries[id];
1244
snprintf(buf, sizeof(buf), "edje/images/%i", img->id);
1245
VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", img->entry));
1246
data = eet_read(edf->ef, buf, &size);
1250
Edje_Pick_Data *image = malloc(sizeof(*image));
1252
image->filename = eina_stringshare_add(img->entry);
1255
image->entry = (void *)img;
1256
image->id.old_id = img->id;
1257
img->id = image->id.new_id = current_img_id;
1258
image->id.used = EINA_TRUE;
1260
VERBOSE(EINA_LOG_INFO("Read image <%s> data <%p> size <%d>, new_id : %d\n",
1261
buf, image->data, image->size, image->id.new_id));
1263
context.current_file->imagelist = eina_list_append(
1264
context.current_file->imagelist, image);
1270
EINA_LOG_ERR("Image <%s> was not found in <%s> file.\n",
1271
img->entry, context.current_file->name);
1275
EINA_LOG_ERR("Image entry <%s> was not found in <%s> file.\n", buf, context.current_file->name);
1283
return current_img_id;
1287
_edje_pick_image_set_add(int id, Edje_File *edf, Edje_File *o)
1289
static int current_set_id = -1;
1290
Edje_Image_Directory_Set_Entry *ent;
1293
int new_id = _edje_pick_image_new_id_get(context.current_file->imagesetlist, id);
1294
if (new_id >= 0) return new_id;
1299
o->image_dir = calloc(1, sizeof(*(o->image_dir)));
1301
if (edf->image_dir->sets)
1304
Edje_Pick_Data *set = calloc(1, sizeof(*set));
1305
set->id.old_id = edf->image_dir->sets[id].id;
1306
set->id.new_id = current_set_id;
1307
set->id.used = EINA_TRUE;
1310
context.current_file->imagesetlist = eina_list_append(
1311
context.current_file->imagesetlist, set);
1312
EINA_LIST_FOREACH(edf->image_dir->sets[id].entries, l, ent)
1314
_edje_pick_image_entry_add(ent->id, edf, o);
1319
return current_set_id;
1323
_edje_pick_vector_entry_add(int id, Edje_File *edf, Edje_File *o)
1328
static int current_vg_id = -1;
1330
int new_id = _edje_pick_image_new_id_get(context.current_file->vectorlist, id);
1331
if (new_id >= 0) return new_id;
1336
o->image_dir = calloc(1, sizeof(*(o->image_dir)));
1338
if (edf->image_dir->vectors)
1340
Edje_Vector_Directory_Entry *vg = &edf->image_dir->vectors[id];
1342
snprintf(buf, sizeof(buf), "edje/vectors/%i", vg->id);
1343
VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", vg->entry));
1344
data = eet_read(edf->ef, buf, &size);
1348
Edje_Pick_Data *vector = malloc(sizeof(*vector));
1350
vector->filename = eina_stringshare_add(vg->entry);
1351
vector->data = data;
1352
vector->size = size;
1353
vector->entry = (void *)vg;
1354
vector->id.old_id = vg->id;
1355
vg->id = vector->id.new_id = current_vg_id;
1356
vector->id.used = EINA_TRUE;
1358
VERBOSE(EINA_LOG_INFO("Read vector <%s> data <%p> size <%d>, new_id : %d\n",
1359
buf, vector->data, vector->size, vector->id.new_id));
1361
context.current_file->vectorlist = eina_list_append(
1362
context.current_file->vectorlist, vector);
1368
EINA_LOG_ERR("Vector <%s> was not found in <%s> file.\n",
1369
vg->entry, context.current_file->name);
1373
EINA_LOG_ERR("Vector entry <%s> was not found in <%s> file.\n", buf, context.current_file->name);
1381
return current_vg_id;
1385
_edje_pick_images_desc_update(Edje_Part_Description_Image *desc, Edje_File *edf, Edje_File *o)
1391
int new_id = (desc->image.set) ?
1392
_edje_pick_image_set_add(desc->image.id, edf, o) :
1393
_edje_pick_image_entry_add(desc->image.id, edf, o);
1395
desc->image.id = new_id;
1397
for (k = 0; k < desc->image.tweens_count; k++)
1399
new_id = (desc->image.set) ?
1400
_edje_pick_image_set_add(desc->image.tweens[k]->id, edf, o) :
1401
_edje_pick_image_entry_add(desc->image.tweens[k]->id, edf, o);
1403
desc->image.tweens[k]->id = new_id;
1409
_edje_pick_vectors_desc_update(Edje_Part_Description_Vector *desc, Edje_File *edf, Edje_File *o)
1414
int new_id = _edje_pick_vector_entry_add(desc->vg.id, edf, o);
1416
desc->vg.id = new_id;
1421
_edje_pick_styles_desc_update(Edje_Part_Description_Text *desc, Edje_File *edf, Edje_File *o)
1429
style = desc->text.style.str;
1433
EINA_LIST_FOREACH(edf->styles, l, stl)
1434
if ((stl->name) && (!strcmp(stl->name, style)))
1435
o->styles = eina_list_append(o->styles, stl);
1441
_edje_pick_color_class_desc_update(Edje_Part_Description_Common *desc, Edje_File *edf, Edje_File *o)
1444
Edje_Color_Class *cc;
1445
const char *color_class;
1449
color_class = desc->color_class;
1453
EINA_LIST_FOREACH(edf->color_classes, l, cc)
1454
if ((cc->name) && (!strcmp(cc->name, color_class)))
1455
o->color_classes = eina_list_append(o->color_classes, cc);
1461
_edje_pick_resources_process(Edje_Part_Collection *edc, Edje_File *edf, Edje_File *o)
1467
for (i = 0; i < edc->parts_count; i++)
1470
Edje_Part *part = edc->parts[i];
1473
_edje_pick_color_class_desc_update((Edje_Part_Description_Common *)part->default_desc, edf, o);
1475
for (k = 0; k < part->other.desc_count; k++)
1476
_edje_pick_color_class_desc_update((Edje_Part_Description_Common *)part->other.desc[k], edf, o);
1478
if (part->type == EDJE_PART_TYPE_IMAGE)
1481
_edje_pick_images_desc_update((Edje_Part_Description_Image *)part->default_desc, edf, o);
1483
for (k = 0; k < part->other.desc_count; k++)
1484
_edje_pick_images_desc_update((Edje_Part_Description_Image *)part->other.desc[k], edf, o);
1486
else if (part->type == EDJE_PART_TYPE_VECTOR)
1489
_edje_pick_vectors_desc_update((Edje_Part_Description_Vector *)part->default_desc, edf, o);
1491
for (k = 0; k < part->other.desc_count; k++)
1492
_edje_pick_vectors_desc_update((Edje_Part_Description_Vector *)part->other.desc[k], edf, o);
1494
else if (part->type == EDJE_PART_TYPE_TEXT || part->type == EDJE_PART_TYPE_TEXTBLOCK)
1497
_edje_pick_styles_desc_update((Edje_Part_Description_Text *)part->default_desc, edf, o);
1499
for (k = 0; k < part->other.desc_count; k++)
1500
_edje_pick_styles_desc_update((Edje_Part_Description_Text *)part->other.desc[k], edf, o);
1506
_sample_cmp(const void *d1, const void *d2)
1511
Edje_Sound_Sample *sample = ((Edje_Pick_Data *)d1)->entry;
1513
return strcmp(sample->name, d2);
1520
_tone_cmp(const void *d1, const void *d2)
1525
Edje_Sound_Tone *tone = ((Edje_Pick_Tone *)d1)->tone;
1527
return strcmp(tone->name, d2);
1534
_edje_pick_program_update(Edje_Program *prog)
1540
p = eina_list_search_unsorted(context.current_file->samplelist,
1541
(Eina_Compare_Cb)_sample_cmp,
1546
p->id.used = EINA_TRUE;
1549
t = eina_list_search_unsorted(context.current_file->tonelist,
1550
(Eina_Compare_Cb)_tone_cmp,
1555
t->used = EINA_TRUE;
1559
_edje_pick_programs_process(Edje_Part_Collection *edc)
1564
for (i = 0; i < edc->programs.fnmatch_count; i++)
1565
_edje_pick_program_update(edc->programs.fnmatch[i]);
1567
for (i = 0; i < edc->programs.strcmp_count; i++)
1568
_edje_pick_program_update(edc->programs.strcmp[i]);
1570
for (i = 0; i < edc->programs.strncmp_count; i++)
1571
_edje_pick_program_update(edc->programs.strncmp[i]);
1573
for (i = 0; i < edc->programs.strrncmp_count; i++)
1574
_edje_pick_program_update(edc->programs.strrncmp[i]);
1576
for (i = 0; i < edc->programs.nocmp_count; i++)
1577
_edje_pick_program_update(edc->programs.nocmp[i]);
1579
return EDJE_PICK_NO_ERROR;
1583
_edje_pick_collection_process(Edje_Part_Collection *edc, Edje_File *edf, Edje_File *o)
1586
Edje_Part_Collection_Directory_Entry *ce;
1588
ce = eina_hash_find(o->collection, edc->part);
1591
_edje_pick_resources_process(edc, edf, o);
1592
_edje_pick_programs_process(edc);
1594
return EDJE_PICK_NO_ERROR;
1598
_edje_pick_sound_dir_compose(Eina_List *samples, Eina_List *tones, Edje_File *o)
1602
Edje_Sound_Sample *sample;
1603
Edje_Sound_Sample *p;
1606
o->sound_dir = calloc(1, sizeof(*(o->sound_dir)));
1607
o->sound_dir->samples = malloc(eina_list_count(samples) *
1608
sizeof(Edje_Sound_Sample));
1610
p = o->sound_dir->samples;
1611
EINA_LIST_FOREACH(samples, l, sample)
1613
memcpy(p, sample, sizeof(Edje_Sound_Sample));
1617
o->sound_dir->samples_count = eina_list_count(samples);
1621
Edje_Sound_Tone *tone;
1624
o->sound_dir->tones = malloc(eina_list_count(tones) *
1625
sizeof(Edje_Sound_Tone));
1627
t = o->sound_dir->tones;
1628
EINA_LIST_FOREACH(tones, l, tone)
1630
memcpy(t, tone, sizeof(Edje_Sound_Tone));
1634
o->sound_dir->tones_count = eina_list_count(tones);
1640
_edje_pick_vibration_dir_compose(Eina_List *vibrations, Edje_File *o)
1644
Edje_Vibration_Sample *sample;
1645
Edje_Vibration_Sample *p;
1648
o->vibration_dir = calloc(1, sizeof(*(o->vibration_dir)));
1649
o->vibration_dir->samples = malloc(eina_list_count(vibrations) *
1650
sizeof(Edje_Vibration_Sample));
1652
p = o->vibration_dir->samples;
1653
EINA_LIST_FOREACH(vibrations, l, sample)
1655
memcpy(p, sample, sizeof(Edje_Vibration_Sample));
1659
o->vibration_dir->samples_count = eina_list_count(vibrations);
1664
main(int argc, char **argv)
1666
char *name1, *output_filename = NULL;
1667
Eina_List *inp_files = NULL;
1668
int comp_mode = EET_COMPRESSION_DEFAULT;
1669
Edje_File *out_file = NULL;
1670
Eina_List *images = NULL;
1671
Eina_List *samples = NULL;
1672
Eina_List *tones = NULL;
1673
Eina_List *vibrations = NULL;
1675
Edje_Part_Collection *edc;
1676
Edje_Part_Collection_Directory_Entry *ce;
1682
ecore_app_no_system_modules();
1688
eina_log_level_set(EINA_LOG_LEVEL_WARN);
1690
k = _edje_pick_command_line_parse(argc, argv, &inp_files, &output_filename);
1691
if ( k != EDJE_PICK_NO_ERROR)
1694
_edje_pick_args_show(inp_files, output_filename);
1697
EINA_LIST_FOREACH(inp_files, f, context.current_file)
1701
ef = eet_open(context.current_file->name, EET_FILE_MODE_READ);
1703
return _edje_pick_cleanup(inp_files, out_file,
1704
EDJE_PICK_FAILED_OPEN_INP);
1706
edf = eet_data_read(ef, _edje_edd_edje_file, "edje/file");
1708
return _edje_pick_cleanup(inp_files, out_file,
1709
EDJE_PICK_FAILED_READ_INP);
1711
context.current_file->edf = edf;
1714
out_file = _edje_pick_output_prepare(out_file, edf, output_filename);
1717
_edje_cache_file_unref(edf);
1719
return _edje_pick_cleanup(inp_files, out_file, k);
1722
k = _edje_pick_header_make(out_file, edf, inp_files);
1723
if (k != EDJE_PICK_NO_ERROR)
1725
_edje_cache_file_unref(edf);
1727
return _edje_pick_cleanup(inp_files, out_file, k);
1731
_edje_pick_sounds_add(edf);
1732
_edje_pick_vibrations_add(edf);
1734
_edje_pick_data_update(out_file, edf);
1737
EINA_LIST_FOREACH(context.current_file->groups, l, name1)
1739
ce = eina_hash_find(edf->collection, name1);
1740
if (!ce || (ce->id < 0))
1742
EINA_LOG_ERR("Failed to find group <%s> id\n", name1);
1743
_edje_cache_file_unref(edf);
1744
return _edje_pick_cleanup(inp_files, out_file,
1745
EDJE_PICK_GROUP_NOT_FOUND);
1748
VERBOSE(EINA_LOG_INFO("Copy group: <%s>\n", name1));
1750
edje_cache_emp_alloc(ce);
1752
snprintf(buf, sizeof(buf), "edje/collections/%i", ce->id);
1753
EINA_LOG_INFO("Trying to read group <%s>\n", buf);
1754
edc = eet_data_read(edf->ef, _edje_edd_edje_part_collection, buf);
1757
EINA_LOG_ERR("Failed to read group <%s> id <%d>\n", name1, ce->id);
1758
_edje_cache_file_unref(edf);
1759
return _edje_pick_cleanup(inp_files, out_file,
1760
EDJE_PICK_GROUP_NOT_FOUND);
1764
_edje_pick_collection_process(edc, edf, out_file);
1767
_edje_pick_scripts_add(edf, ce->id, edc->id);
1768
_edje_pick_lua_scripts_add(edf, ce->id, edc->id);
1772
snprintf(buf, sizeof(buf),
1773
"edje/collections/%i", edc->id);
1774
bytes = eet_data_write(out_file->ef,
1775
_edje_edd_edje_part_collection,
1776
buf, edc, comp_mode);
1777
EINA_LOG_INFO("Wrote <%d> bytes for group <%s>\n", bytes, buf);
1781
edje_cache_emp_free(ce);
1785
_edje_pick_images_copy(edf, out_file);
1786
_edje_cache_file_unref(edf);
1787
_Edje_Pick_Fonts_add(out_file, edf);
1795
EINA_LIST_FOREACH(inp_files, f, context.current_file)
1803
EINA_LIST_FOREACH(context.current_file->scriptlist, t, s)
1806
snprintf(buf, sizeof(buf),
1807
"edje/scripts/embryo/compiled/%i", s->id.new_id);
1808
VERBOSE(EINA_LOG_INFO("wrote embryo scr <%s> data <%p> size <%d>\n",
1809
buf, s->data, s->size));
1810
eet_write(out_file->ef, buf, s->data, s->size, comp_mode);
1813
EINA_LIST_FOREACH(context.current_file->luascriptlist, t, s)
1816
snprintf(buf, sizeof(buf),
1817
"edje/scripts/lua/%i", s->id.new_id);
1818
VERBOSE(EINA_LOG_INFO("wrote lua scr <%s> data <%p> size <%d>\n",
1819
buf, s->data, s->size));
1820
eet_write(out_file->ef, buf, s->data, s->size, comp_mode);
1823
EINA_LIST_FOREACH(context.current_file->imagelist, t, s)
1825
if (context.current_file->append || s->id.used)
1827
snprintf(buf, sizeof(buf), "edje/images/%i", s->id.new_id);
1828
eet_write(out_file->ef, buf, s->data, s->size, EINA_TRUE);
1829
VERBOSE(EINA_LOG_INFO("Wrote <%s> image data <%p> size <%d>\n", buf, s->data, s->size));
1833
EINA_LIST_FOREACH(context.current_file->vectorlist, t, s)
1835
if (context.current_file->append || s->id.used)
1837
snprintf(buf, sizeof(buf), "edje/vectors/%i", s->id.new_id);
1838
eet_write(out_file->ef, buf, s->data, s->size, EINA_TRUE);
1839
VERBOSE(EINA_LOG_INFO("Wrote <%s> vector data <%p> size <%d>\n", buf, s->data, s->size));
1843
EINA_LIST_FOREACH(context.current_file->fontlist, t, fn)
1845
if (context.current_file->append || fn->used)
1847
snprintf(buf, sizeof(buf), "edje/fonts/%s", fn->f->name);
1848
eet_write(out_file->ef, buf, fn->data, fn->size, EINA_TRUE);
1849
VERBOSE(EINA_LOG_INFO("Wrote <%s> fonts data <%p> size <%d>\n", buf, fn->data, fn->size));
1853
EINA_LIST_FOREACH(context.current_file->samplelist, l, s)
1855
if (context.current_file->append || s->id.used)
1857
samples = eina_list_append(samples, s->entry);
1859
snprintf(buf, sizeof(buf), "edje/sounds/%i",
1861
eet_write(out_file->ef, buf,
1862
s->data, s->size, EET_COMPRESSION_NONE);
1863
VERBOSE(EINA_LOG_INFO("Wrote <%s> sample data <%p> size <%d>\n",
1864
buf, s->data, s->size));
1868
EINA_LIST_FOREACH(context.current_file->tonelist, l, tn)
1870
if (context.current_file->append || tn->used)
1871
tones = eina_list_append(tones, tn->tone);
1874
EINA_LIST_FOREACH(context.current_file->vibrationlist, l, s)
1876
if (context.current_file->append || s->id.used)
1878
vibrations = eina_list_append(vibrations, s->entry);
1880
snprintf(buf, sizeof(buf), "edje/vibrations/%i",
1882
eet_write(out_file->ef, buf,
1883
s->data, s->size, EINA_TRUE);
1884
VERBOSE(EINA_LOG_INFO("Wrote <%s> vibration data <%p> size <%d>\n",
1885
buf, s->data, s->size));
1890
_edje_pick_sound_dir_compose(samples, tones, out_file);
1891
_edje_pick_vibration_dir_compose(vibrations, out_file);
1896
bytes = eet_data_write(out_file->ef, _edje_edd_edje_file, "edje/file",
1897
out_file, comp_mode);
1898
VERBOSE(EINA_LOG_INFO("Wrote <%d> bytes for file header.\n", bytes));
1901
eina_list_free(images);
1902
eina_list_free(samples);
1903
eina_list_free(tones);
1905
if (output_filename)
1906
printf("Wrote <%s> output file.\n", output_filename);
1908
return _edje_pick_cleanup(inp_files, out_file, EDJE_PICK_NO_ERROR);