From: cedric Date: Mon, 28 Jun 2010 13:56:30 +0000 (+0000) Subject: * edje: This is the first commit of a rewrite of edje file X-Git-Tag: submit/2.0alpha-wayland/20121127.221958~1242 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbfbf52c4b8b4b03b5b40daf307512041920a808;p=profile%2Fivi%2Fedje.git * edje: This is the first commit of a rewrite of edje file internal representation. The objectiv is to simplify code, consume less CPU and memory without loosing feature. Please report any breakage when you see them. It will take a few weeks before we change the file layout, during that time the load time may increase. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@49922 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/bin/edje_cc.c b/src/bin/edje_cc.c index b86ea8a..47036a5 100644 --- a/src/bin/edje_cc.c +++ b/src/bin/edje_cc.c @@ -199,7 +199,7 @@ main(int argc, char **argv) if (!edje_init()) exit(-1); - edje_file = mem_alloc(SZ(Edje_File)); + edje_file = mem_alloc(SZ(Old_Edje_File)); edje_file->compiler = strdup("edje_cc"); edje_file->version = EDJE_FILE_VERSION; edje_file->feature_ver = 1; /* increment this every time we add a field diff --git a/src/bin/edje_cc.h b/src/bin/edje_cc.h index 2479b0f..99bd589 100644 --- a/src/bin/edje_cc.h +++ b/src/bin/edje_cc.h @@ -166,7 +166,7 @@ extern int max_quality; extern int line; extern Eina_List *stack; extern Eina_List *params; -extern Edje_File *edje_file; +extern Old_Edje_File *edje_file; extern Eina_List *edje_collections; extern Eina_List *externals; extern Eina_List *fonts; diff --git a/src/bin/edje_cc_out.c b/src/bin/edje_cc_out.c index ec19d58..3fcd1a3 100644 --- a/src/bin/edje_cc_out.c +++ b/src/bin/edje_cc_out.c @@ -99,7 +99,7 @@ struct _Code_Lookup static 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)); -Edje_File *edje_file = NULL; +Old_Edje_File *edje_file = NULL; Eina_List *edje_collections = NULL; Eina_List *externals = NULL; Eina_List *fonts = NULL; diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index bec0f28..f6992a1 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -43,7 +43,8 @@ edje_script_only.c \ edje_lua_script_only.c \ edje_entry.c \ edje_external.c \ -edje_module.c +edje_module.c \ +edje_convert.c if EDJE_AMALGAMATION nodist_libedje_la_SOURCES = edje_amalgamation.c diff --git a/src/lib/edje_cache.c b/src/lib/edje_cache.c index f77a4c5..b29eeba 100644 --- a/src/lib/edje_cache.c +++ b/src/lib/edje_cache.c @@ -61,34 +61,50 @@ static int _edje_collection_cache_size = 16; static Edje_Part_Collection * _edje_file_coll_open(Edje_File *edf, const char *coll) { + Old_Edje_Part_Collection *oedc = NULL; Edje_Part_Collection *edc = NULL; Edje_Part_Collection_Directory_Entry *ce; - Eina_List *l = NULL; int id = -1, size = 0; + Eina_List *l; char buf[256]; void *data; - EINA_LIST_FOREACH(edf->collection_dir->entries, l, ce) + ce = eina_hash_find(edf->collection, coll); + + if (!ce) return NULL; + + if (ce->ref) { - if ((ce->entry) && (!strcmp(ce->entry, coll))) + ce->ref->references++; + return ce->ref; + } + + EINA_LIST_FOREACH(edf->collection_cache, l, edc) + { + if (!strcmp(edc->part, coll)) { - id = ce->id; - break; + edc->references = 1; + ce->ref = edc; + + edf->collection_cache = eina_list_remove_list(edf->collection_cache, l); + return ce->ref; } } + + id = ce->id; if (id < 0) return NULL; snprintf(buf, sizeof(buf), "collections/%i", id); - edc = eet_data_read(edf->ef, _edje_edd_edje_part_collection, buf); - if (!edc) return NULL; + oedc = eet_data_read(edf->ef, _edje_edd_edje_part_collection, buf); + if (!oedc) return NULL; snprintf(buf, sizeof(buf), "scripts/%i", id); data = eet_read(edf->ef, buf, &size); if (data) { - edc->script = embryo_program_new(data, size); - _edje_embryo_script_init(edc); + oedc->script = embryo_program_new(data, size); + _edje_embryo_script_init(oedc); free(data); } @@ -98,12 +114,12 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) if (data) { #ifdef LUA2 - _edje_lua2_script_load(edc, data, size); + _edje_lua2_script_load(oedc, data, size); #else int err_code; //printf("lua chunk size: %d\n", size); - _edje_lua_new_reg(_edje_lua_state_get(), -1, edc); // gets freed in 'edje_load::_edje_collectoin_free' + _edje_lua_new_reg(_edje_lua_state_get(), -1, oedc); // gets freed in 'edje_load::_edje_collectoin_free' if ((err_code = luaL_loadbuffer(_edje_lua_state_get(), data, size, "edje_lua_script"))) { @@ -117,57 +133,22 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) #endif free(data); } - - edc->part = eina_stringshare_add(coll); - edc->references = 1; - if (!edf->collection_hash) - edf->collection_hash = eina_hash_string_small_new(NULL); - eina_hash_add(edf->collection_hash, coll, edc); - return edc; -} -static int -_edje_font_hash(Edje_File *edf) -{ - int count = 0; + oedc->part = ce->entry; + oedc->references = 1; - if (!edf->font_hash) - edf->font_hash = eina_hash_string_small_new(NULL); + edc = _edje_collection_convert(edf, oedc); - if (edf->font_dir) - { - Eina_List *l; - Edje_Font_Directory_Entry *fnt; - - EINA_LIST_FOREACH(edf->font_dir->entries, l, fnt) - { - int length; - char *tmp; - - length = strlen(fnt->entry) + 7; - tmp = alloca(length); - - snprintf(tmp, length, "fonts/%s", fnt->entry); - fnt->path = eina_stringshare_add(tmp); - if (edf->free_strings) - eina_stringshare_del(fnt->entry); - fnt->entry = fnt->path + 6; - eina_hash_direct_add(edf->font_hash, fnt->entry, fnt); - - count++; - } - } - return count; + return edc; } static Edje_File * _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret) { + Old_Edje_File *oedf; Edje_File *edf; Edje_Part_Collection *edc; - Edje_Data *di; Eet_File *ef; - Eina_List *l; struct stat st; if (stat(file, &st) != 0) @@ -182,15 +163,15 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co *error_ret = EDJE_LOAD_ERROR_UNKNOWN_FORMAT; return NULL; } - edf = eet_data_read(ef, _edje_edd_edje_file, "edje_file"); - if (!edf) + oedf = eet_data_read(ef, _edje_edd_edje_file, "edje_file"); + if (!oedf) { *error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE; eet_close(ef); return NULL; } - edf->free_strings = eet_dictionary_get(ef) ? 0 : 1; + edf = _edje_file_convert(ef, oedf); edf->ef = ef; edf->mtime = st.st_mtime; @@ -201,7 +182,7 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co _edje_file_free(edf); return NULL; } - if (!edf->collection_dir) + if (!edf->collection) { *error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE; _edje_file_free(edf); @@ -211,14 +192,9 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co edf->path = eina_stringshare_add(file); edf->references = 1; + /* This should be done at edje generation time */ _edje_textblock_style_parse_and_fix(edf); - if (!edf->data_cache) - edf->data_cache = eina_hash_string_small_new(NULL); - - EINA_LIST_FOREACH(edf->data, l, di) - eina_hash_add(edf->data_cache, di->key, di->value); - if (coll) { edc = _edje_file_coll_open(edf, coll); @@ -229,10 +205,6 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co if (edc_ret) *edc_ret = edc; } - edf->font_hash = NULL; - - _edje_font_hash(edf); - return edf; } @@ -319,36 +291,14 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E if (!coll) return edf; - if (!edf->collection_hash) - edf->collection_hash = eina_hash_string_small_new(NULL); - - edc = eina_hash_find(edf->collection_hash, coll); - if (edc) + edc = _edje_file_coll_open(edf, coll); + if (!edc) { - edc->references++; + *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION; } else { - EINA_LIST_FOREACH(edf->collection_cache, l, edc) - { - if (!strcmp(edc->part, coll)) - { - edc->references = 1; - edf->collection_cache = eina_list_remove_list(edf->collection_cache, l); - eina_hash_add(edf->collection_hash, coll, edc); - break; - } - edc = NULL; - } - } - if (!edc) - { - edc = _edje_file_coll_open(edf, coll); - if (!edc) - { - *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION; - } - else + if (!edc->checked) { EINA_LIST_FOREACH(edc->parts, l, ep) { @@ -412,15 +362,11 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E eina_list_free(hist); hist = NULL; } + edc->checked = 1; } } if (edc_ret) *edc_ret = edc; - if (eina_hash_population(edf->collection_hash) == 0) - { - eina_hash_free(edf->collection_hash); - edf->collection_hash = NULL; - } return edf; } @@ -457,14 +403,14 @@ _edje_cache_coll_flush(Edje_File *edf) void _edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc) { + Edje_Part_Collection_Directory_Entry *ce; + edc->references--; if (edc->references != 0) return; - eina_hash_del(edf->collection_hash, edc->part, edc); - if (eina_hash_population(edf->collection_hash) == 0) - { - eina_hash_free(edf->collection_hash); - edf->collection_hash = NULL; - } + + ce = eina_hash_find(edf->collection, edc->part); + + ce->ref = NULL; edf->collection_cache = eina_list_prepend(edf->collection_cache, edc); _edje_cache_coll_clean(edf); } diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c index 692b716..d52757f 100644 --- a/src/lib/edje_calc.c +++ b/src/lib/edje_calc.c @@ -830,11 +830,11 @@ _edje_part_recalc_single_text(FLOAT_T sc, if (!text) text = ""; /* check if the font is embedded in the .eet */ - if (ed->file->font_hash) + if (ed->file->fonts) { Edje_Font_Directory_Entry *fnt; - fnt = eina_hash_find(ed->file->font_hash, font); + fnt = eina_hash_find(ed->file->fonts, font); if (fnt) { diff --git a/src/lib/edje_convert.c b/src/lib/edje_convert.c new file mode 100644 index 0000000..7519afb --- /dev/null +++ b/src/lib/edje_convert.c @@ -0,0 +1,149 @@ +#include "edje_private.h" + +static const Edje_File *_current_edje_file = NULL; + +const Edje_File * +_edje_file_get(void) +{ + return _current_edje_file; +} + +void +_edje_file_set(const Edje_File *edf) +{ + _current_edje_file = edf; +} + +static void +_edje_font_string_free(void *data) +{ + Edje_Font_Directory_Entry *fe = data; + + eina_stringshare_del(fe->path); + free(fe); +} + +static void +_edje_collection_string_free(void *data) +{ + Edje_Part_Collection_Directory_Entry *ce = data; + + eina_stringshare_del(ce->entry); + + if (ce->ref) + { + Edje_File *edf; + + edf = (Edje_File*) _edje_file_get(); + + if (!edf->warning) + ERR("EDJE ERROR:\n" + "\n" + "Naughty Programmer - spank spank!\n" + "\n" + "This program as probably called edje_shutdown() with active Edje objects\n" + "still around.\n This can cause problems as both Evas and Edje retain\n" + "references to the objects. you should shut down all canvases and objects\n" + "before calling edje_shutdown().\n" + "The following errors are the edje object files and parts that are still\n" + "hanging around, with their reference counts"); + + edf->warning = 1; + ERR("EEK: EDJE FILE: \"%s\" ref(%i) PART: \"%s\" ref(%i) ", + edf->path, edf->references, + ce->ref->part, ce->ref->references); + + _edje_collection_free(edf, ce->ref); + } + + free(ce); +} + +Edje_File * +_edje_file_convert(Eet_File *file, Old_Edje_File *oedf) +{ + Edje_Part_Collection_Directory_Entry *ce; + Edje_Font_Directory_Entry *fnt; + Edje_File *edf; + Eina_List *l; + Edje_Data *ed; + + edf = malloc(sizeof (Edje_File)); + if (!edf) return NULL; + + edf->free_strings = eet_dictionary_get(file) ? 0 : 1; + + if (edf->free_strings) + { + edf->fonts = eina_hash_string_small_new(_edje_font_string_free); + edf->collection = eina_hash_string_small_new(_edje_collection_string_free); + edf->data = eina_hash_string_small_new((Eina_Free_Cb) eina_stringshare_del); + } + else + { + edf->fonts = eina_hash_string_small_new(free); + edf->collection = eina_hash_string_small_new(free); + edf->data = eina_hash_string_small_new(NULL); + } + + EINA_LIST_FREE(oedf->data, ed) + { + eina_hash_direct_add(edf->data, ed->key, ed->value); + free(ed); + } + + EINA_LIST_FOREACH(oedf->collection_dir->entries, l, ce) + if (ce->entry) + eina_hash_direct_add(edf->collection, ce->entry, ce); + + if (oedf->font_dir) + EINA_LIST_FOREACH(oedf->font_dir->entries, l, fnt) + { + char *tmp; + int length; + + length = strlen(fnt->entry) + 7; + tmp = alloca(length); + + snprintf(tmp, length, "fonts/%s", fnt->entry); + fnt->path = eina_stringshare_add(tmp); + if (edf->free_strings) + eina_stringshare_del(fnt->entry); + fnt->entry = fnt->path + 6; + + eina_hash_direct_add(edf->fonts, fnt->entry, fnt); + } + + edf->oef = oedf; + edf->external_dir = oedf->external_dir; + edf->image_dir = oedf->image_dir; + edf->spectrum_dir = oedf->spectrum_dir; + edf->styles = oedf->styles; + edf->color_classes = oedf->color_classes; + edf->version = oedf->version; + edf->feature_ver = oedf->feature_ver; + edf->compiler = oedf->compiler; + + edf->dangling = EINA_FALSE; + edf->warning = EINA_FALSE; + + edf->collection_cache = NULL; + + return edf; +} + +Edje_Part_Collection * +_edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc) +{ + Edje_Part_Collection_Directory_Entry *ce; + Edje_Part_Collection *edc; + + edc = oedc; + + ce = eina_hash_find(file->collection, oedc->part); + + ce->ref = edc; + + /* FIXME : Count type part and change their structure */ + return edc; +} diff --git a/src/lib/edje_convert.h b/src/lib/edje_convert.h new file mode 100644 index 0000000..daf70f7 --- /dev/null +++ b/src/lib/edje_convert.h @@ -0,0 +1,31 @@ +#ifndef EDJE_CONVERT_H__ +# define EDJE_CONVERT_H__ + +typedef struct _Edje_Part_Collection Old_Edje_Part_Collection; + +struct _Old_Edje_File +{ + const char *path; + time_t mtime; + + Edje_External_Directory *external_dir; + Edje_Font_Directory *font_dir; + Edje_Image_Directory *image_dir; + Edje_Spectrum_Directory *spectrum_dir; + Edje_Part_Collection_Directory *collection_dir; + Eina_List *data; + Eina_List *styles; + Eina_List *color_classes; + + char *compiler; + int version; + int feature_ver; +}; + +Edje_File *_edje_file_convert(Eet_File *file, Old_Edje_File *oedf); +Edje_Part_Collection *_edje_collection_convert(Edje_File *file, + Old_Edje_Part_Collection *oedc); +const Edje_File *_edje_file_get(void); +void _edje_file_set(const Edje_File *edf); + +#endif diff --git a/src/lib/edje_data.c b/src/lib/edje_data.c index 3b1465c..c479f71 100644 --- a/src/lib/edje_data.c +++ b/src/lib/edje_data.c @@ -206,17 +206,17 @@ _edje_edd_init(void) EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_File); _edje_edd_edje_file = eet_data_descriptor_file_new(&eddc); - EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "compiler", compiler, EET_T_STRING); - EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "version", version, EET_T_INT); - EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "feature_ver", feature_ver, EET_T_INT); - EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "external_dir", external_dir, _edje_edd_edje_external_directory); - EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "font_dir", font_dir, _edje_edd_edje_font_directory); - EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "image_dir", image_dir, _edje_edd_edje_image_directory); - EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "spectrum_dir", spectrum_dir, _edje_edd_edje_spectrum_directory); - EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "collection_dir", collection_dir, _edje_edd_edje_part_collection_directory); - EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "data", data, _edje_edd_edje_data); - EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "styles", styles, _edje_edd_edje_style); - EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "color_classes", color_classes, _edje_edd_edje_color_class); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Old_Edje_File, "compiler", compiler, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Old_Edje_File, "version", version, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Old_Edje_File, "feature_ver", feature_ver, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Old_Edje_File, "external_dir", external_dir, _edje_edd_edje_external_directory); + EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Old_Edje_File, "font_dir", font_dir, _edje_edd_edje_font_directory); + EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Old_Edje_File, "image_dir", image_dir, _edje_edd_edje_image_directory); + EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Old_Edje_File, "spectrum_dir", spectrum_dir, _edje_edd_edje_spectrum_directory); + EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Old_Edje_File, "collection_dir", collection_dir, _edje_edd_edje_part_collection_directory); + EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Old_Edje_File, "data", data, _edje_edd_edje_data); + EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Old_Edje_File, "styles", styles, _edje_edd_edje_style); + EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Old_Edje_File, "color_classes", color_classes, _edje_edd_edje_color_class); /* parts & programs - loaded induvidually */ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program_Target); diff --git a/src/lib/edje_edit.c b/src/lib/edje_edit.c index 4e279a5..21424b3 100644 --- a/src/lib/edje_edit.c +++ b/src/lib/edje_edit.c @@ -773,8 +773,8 @@ _edje_edit_external_get(Edje *ed, const char *name) void _edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name, const char *new_group_name) { - - Eina_List *gl, *pll, *pl; + Eina_Iterator *i; + Eina_List *pll, *pl; Edje_Part_Collection *pc; Edje_Part_Collection_Directory_Entry *pce; char *part_name; @@ -790,7 +790,9 @@ _edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name, old = eina_stringshare_add(old_group_name); - EINA_LIST_FOREACH(ed->file->collection_dir->entries, gl, pce) + i = eina_hash_iterator_data_new(ed->file->collection); + + EINA_ITERATOR_FOREACH(i, pce) { edje_object_file_set(part_obj, ed->file->path, pce->entry); @@ -808,6 +810,9 @@ _edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name, eina_stringshare_del(source); } } + + eina_iterator_free(i); + eina_stringshare_del(old); evas_object_del(part_obj); @@ -869,7 +874,6 @@ edje_edit_group_add(Evas_Object *obj, const char *name) Edje_Part_Collection_Directory_Entry *de; Edje_Part_Collection_Directory_Entry *d; Edje_Part_Collection *pc; - Eina_List *l; int id; int search; //Code *cd; @@ -879,9 +883,8 @@ edje_edit_group_add(Evas_Object *obj, const char *name) //printf("ADD GROUP: %s \n", name); /* check if a group with the same name already exists */ - EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, d) - if (!strcmp(d->entry, name)) - return EINA_FALSE; + if (eina_hash_find(ed->file->collection, name)) + return EINA_FALSE; /* Create structs */ de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry)); @@ -899,9 +902,12 @@ edje_edit_group_add(Evas_Object *obj, const char *name) search = 0; while (id == -1) { + Eina_Iterator *i; Eina_Bool found = 0; - EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, d) + i = eina_hash_iterator_data_new(ed->file->collection); + + EINA_ITERATOR_FOREACH(i, d) { // printf("search if %d is free [id %d]\n", search, d->id); if (search == d->id) @@ -910,17 +916,18 @@ edje_edit_group_add(Evas_Object *obj, const char *name) break; } } - if (!found) - id = search; - else - search++; + + eina_iterator_free(i); + + if (!found) id = search; + else search++; } /* Init Edje_Part_Collection_Directory_Entry */ //printf(" new id: %d\n", id); de->id = id; de->entry = eina_stringshare_add(name); - ed->file->collection_dir->entries = eina_list_append(ed->file->collection_dir->entries, de); + eina_hash_direct_add(ed->file->collection, de->entry, de); /* Init Edje_Part_Collection */ pc->id = id; @@ -957,11 +964,12 @@ edje_edit_group_add(Evas_Object *obj, const char *name) EAPI Eina_Bool edje_edit_group_del(Evas_Object *obj, const char *group_name) { - char buf[32]; - Eina_List *l; + Edje_Part_Collection_Directory_Entry *e; + Edje_Part_Collection *die = NULL; Edje_Part_Collection *g; + Eina_List *l; Eet_File *eetf; - Edje_Part_Collection_Directory_Entry *e; + char buf[32]; GET_ED_OR_RETURN(EINA_FALSE); @@ -972,30 +980,27 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name) _edje_edit_group_references_update(obj, group_name, NULL); - EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, e) - { - if (!strcmp(e->entry, group_name)) - { - if (e->id == ed->collection->id) return EINA_FALSE; - ed->file->collection_dir->entries = - eina_list_remove_list(ed->file->collection_dir->entries, l); - break; - } - e = NULL; - } + e = eina_hash_find(ed->file->collection, group_name); if (!e) return EINA_FALSE; - EINA_LIST_FOREACH(ed->file->collection_cache, l, g) + if (e->id == ed->collection->id) return EINA_FALSE; + if (e->ref) { - if (g->id == e->id) - { - ed->file->collection_cache = - eina_list_remove_list(ed->file->collection_cache, l); - break; - } - g = NULL; + ERR("EEK: Group \"%s\" still in use !", group_name); + die = e->ref; + e->ref = NULL; + eina_hash_del(ed->file->collection, group_name, e); } + EINA_LIST_FOREACH(ed->file->collection_cache, l, g) + if (g->id == e->id) + { + ed->file->collection_cache = + eina_list_remove_list(ed->file->collection_cache, l); + die = g; + break; + } + /* Remove collection/id from eet file */ eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE); if (!eetf) @@ -1009,10 +1014,7 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name) eet_close(eetf); /* Free Group */ - if (g) _edje_collection_free(ed->file, g); - - _edje_if_string_free(ed, e->entry); - free(e); + if (die) _edje_collection_free(ed->file, die); /* we need to save everything to make sure the file won't have broken * references the next time is loaded */ @@ -1024,23 +1026,18 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name) EAPI Eina_Bool edje_edit_group_exist(Evas_Object *obj, const char *group) { - Eina_List *l; - Edje_Part_Collection_Directory_Entry *e; - GET_ED_OR_RETURN(EINA_FALSE); - EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, e) - if (e->entry && !strcmp(e->entry, group)) - return EINA_TRUE; + if (eina_hash_find(ed->file->collection, group)) + return EINA_TRUE; return EINA_FALSE; } EAPI Eina_Bool edje_edit_group_name_set(Evas_Object *obj, const char *new_name) { - Eina_List *l; - Edje_Part_Collection *pc; Edje_Part_Collection_Directory_Entry *pce; + Edje_Part_Collection *pc; GET_ED_OR_RETURN(EINA_FALSE); @@ -1058,27 +1055,15 @@ edje_edit_group_name_set(Evas_Object *obj, const char *new_name) // pc->part, pc->id, new_name); //if (pc->part && ed->file->free_strings) eina_stringshare_del(pc->part); TODO FIXME - pc->part = eina_stringshare_add(new_name); + pce = eina_hash_find(ed->file->collection, pc->part); - EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, pce) - { - if (pc->id == pce->id) - { - eina_hash_del(ed->file->collection_hash, - pce->entry, NULL); - if (!ed->file->collection_hash) - ed->file->collection_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(ed->file->collection_hash, - new_name, pc); - - //if (pce->entry && //TODO Also this cause segv - // !eet_dictionary_string_check(eet_dictionary_get(ed->file->ef), pce->entry)) - // eina_stringshare_del(pce->entry); - pce->entry = eina_stringshare_add(new_name); + eina_hash_del(ed->file->collection, pce->entry, pce); + + pce->entry = eina_stringshare_add(new_name); + pc->part = pce->entry; + + eina_hash_add(ed->file->collection, pce->entry, pce); - return EINA_TRUE; - } - } return EINA_FALSE; } @@ -1176,18 +1161,21 @@ edje_edit_group_data_list_get(Evas_Object * obj) EAPI Eina_List * edje_edit_data_list_get(Evas_Object * obj) { + Eina_Iterator *i; Eina_List *datas = NULL; - Eina_List *l; - Edje_Data *d; + const char *key; GET_ED_OR_RETURN(NULL); if (!ed->file || !ed->file->data) return NULL; - datas = NULL; - EINA_LIST_FOREACH(ed->file->data, l, d) - datas = eina_list_append(datas, eina_stringshare_add(d->key)); + i = eina_hash_iterator_key_new(ed->file->data); + + EINA_ITERATOR_FOREACH(i, key) + datas = eina_list_append(datas, eina_stringshare_add(key)); + + eina_iterator_free(i); return datas; } @@ -1225,27 +1213,15 @@ edje_edit_group_data_add(Evas_Object *obj, const char *key, const char *value) EAPI Eina_Bool edje_edit_data_add(Evas_Object *obj, const char *itemname, const char *value) { - Eina_List *l; - Edje_Data *d; - Edje_Data *dd; - GET_ED_OR_RETURN(EINA_FALSE); if (!itemname || !ed->file) return EINA_FALSE; - EINA_LIST_FOREACH(ed->file->data, l, dd) - if (strcmp(dd->key, itemname) == 0) - return EINA_FALSE; - - d = _alloc(sizeof(Edje_Data)); - if (!d) return EINA_FALSE; - - d->key = (char*)eina_stringshare_add(itemname); - if (value) d->value = (char*)eina_stringshare_add(value); - else d->value = NULL; + if (eina_hash_find(ed->file->data, itemname)) + return EINA_FALSE; - ed->file->data = eina_list_append(ed->file->data, d); + eina_hash_add(ed->file->data, itemname, eina_stringshare_add(value)); return EINA_TRUE; } @@ -1281,26 +1257,12 @@ edje_edit_group_data_del(Evas_Object *obj, const char *key) EAPI Eina_Bool edje_edit_data_del(Evas_Object *obj, const char *itemname) { - Eina_List *l; - Edje_Data *d; - GET_ED_OR_RETURN(EINA_FALSE); if (!itemname || !ed->file || !ed->file->data) return 0; - EINA_LIST_FOREACH(ed->file->data, l, d) - { - if (strcmp(d->key, itemname) == 0) - { - _edje_if_string_free(ed, d->key); - _edje_if_string_free(ed, d->value); - ed->file->data = eina_list_remove(ed->file->data, d); - free(d); - return EINA_TRUE; - } - } - return EINA_FALSE; + return eina_hash_del(ed->file->data, itemname, NULL); } EAPI const char * @@ -1326,19 +1288,12 @@ edje_edit_group_data_value_get(Evas_Object * obj, char *key) EAPI const char * edje_edit_data_value_get(Evas_Object * obj, char *itemname) { - Eina_List *l; - Edje_Data *d; - GET_ED_OR_RETURN(NULL); if (!itemname || !ed->file || !ed->file->data) return NULL; - EINA_LIST_FOREACH(ed->file->data, l, d) - if (strcmp(d->key, itemname) == 0) - return eina_stringshare_add(d->value); - - return NULL; + return eina_stringshare_add(eina_hash_find(ed->file->data, itemname)); } EAPI Eina_Bool @@ -1368,22 +1323,16 @@ edje_edit_group_data_value_set(Evas_Object *obj, const char *key, const char *va EAPI Eina_Bool edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *value) { - Eina_List *l; - Edje_Data *d; + const char *old; GET_ED_OR_RETURN(EINA_FALSE); if (!itemname || !value || !ed->file || !ed->file->data) return EINA_FALSE; - EINA_LIST_FOREACH(ed->file->data, l, d) - if (strcmp(d->key, itemname) == 0) - { - _edje_if_string_free(ed, d->value); - d->value = (char*)eina_stringshare_add(value); - return EINA_TRUE; - } - + old = eina_hash_modify(ed->file->data, itemname, eina_stringshare_add(value)); + if (old) + return EINA_TRUE; return EINA_FALSE; } @@ -1416,23 +1365,22 @@ edje_edit_group_data_name_set(Evas_Object *obj, const char *key, const char *ne EAPI Eina_Bool edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname) { - Eina_List *l; - Edje_Data *d; + const char *value; GET_ED_OR_RETURN(EINA_FALSE); if (!itemname || !newname || !ed->file || !ed->file->data) return EINA_FALSE; - EINA_LIST_FOREACH(ed->file->data, l, d) - if (strcmp(d->key, itemname) == 0) - { - _edje_if_string_free(ed, d->key); - d->key = (char*)eina_stringshare_add(newname); - return EINA_TRUE; - } + /* Get value and prevent it's destruction */ + value = eina_hash_find(ed->file->data, itemname); + value = eina_stringshare_add(value); + if (!value) return EINA_FALSE; - return EINA_FALSE; + eina_hash_del(ed->file->data, itemname, NULL); + eina_hash_add(ed->file->data, itemname, value); + + return EINA_TRUE; } /***********************/ @@ -4295,21 +4243,18 @@ EAPI Eina_List * edje_edit_fonts_list_get(Evas_Object *obj) { Edje_Font_Directory_Entry *f; + Eina_Iterator *i; Eina_List *fonts = NULL; - Eina_List *l; GET_ED_OR_RETURN(NULL); if (!ed->file) return NULL; - if (!ed->file->font_dir) return NULL; //printf("GET FONT LIST for %s\n", ed->file->path); + i = eina_hash_iterator_data_new(ed->file->fonts); - EINA_LIST_FOREACH(ed->file->font_dir->entries, l, f) - { - fonts = eina_list_append(fonts, f); - //printf(" Font: %s (%s) \n", f->entry, f->path); - } + EINA_ITERATOR_FOREACH(i, f) + fonts = eina_list_append(fonts, f); return fonts; } @@ -4330,18 +4275,6 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias) if (!ed->file) return EINA_FALSE; if (!ed->path) return EINA_FALSE; - /* Create Font_Directory if not exist */ - if (!ed->file->font_dir) - { - ed->file->font_dir = _alloc(sizeof(Edje_Font_Directory)); - if (!ed->file->font_dir) return EINA_FALSE; - } - if (!ed->file->font_hash) - { - ed->file->font_hash = eina_hash_string_superfast_new(NULL); - if (!ed->file->font_hash) return EINA_FALSE; - } - /* Alias */ if (!alias) { @@ -4351,7 +4284,7 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias) snprintf(entry, sizeof(entry), "fonts/%s", alias); /* Check if exists */ - fnt = eina_hash_find(ed->file->font_hash, alias); + fnt = eina_hash_find(ed->file->fonts, alias); if (fnt) return EINA_FALSE; @@ -4362,25 +4295,15 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias) ERR("Unable to alloc font entry part \"%s\"", alias); return EINA_FALSE; } - fnt->entry = strdup(alias); - fnt->path = strdup(entry); + fnt->entry = eina_stringshare_add(alias); + fnt->path = eina_stringshare_add(entry); - ed->file->font_dir->entries = eina_list_append( - ed->file->font_dir->entries, - fnt); - eina_hash_direct_add(ed->file->font_hash, fnt->entry, fnt); + eina_hash_direct_add(ed->file->fonts, fnt->entry, fnt); /* Import font */ if (!_edje_import_font_file(ed, path, entry)) { - ed->file->font_dir->entries = eina_list_remove( - ed->file->font_dir->entries, - fnt); - eina_hash_del_by_key(ed->file->font_hash, alias); - - free((char *)fnt->entry); - free((char *)fnt->path); - free(fnt); + eina_hash_del(ed->file->fonts, fnt->entry, fnt); return EINA_FALSE; } @@ -4400,30 +4323,13 @@ edje_edit_font_del(Evas_Object *obj, const char* alias) if (!ed->file) return EINA_FALSE; if (!ed->path) return EINA_FALSE; - if (!ed->file->font_dir) - return EINA_TRUE; - - fnt = eina_hash_find(ed->file->font_hash, alias); + fnt = eina_hash_find(ed->file->fonts, alias); if (!fnt) { WRN("Unable to find font entry part \"%s\"", alias); return EINA_TRUE; } - ed->file->font_dir->entries = eina_list_remove( - ed->file->font_dir->entries, - fnt); - - if (!eina_hash_del_by_key(ed->file->font_hash, alias)) - { - ERR("Unable to remove font \"%s\" of fonts hash", alias); - - ed->file->font_dir->entries = eina_list_append( - ed->file->font_dir->entries, - fnt); - return EINA_FALSE; - } - /* Erase font to edje file */ { char entry[PATH_MAX]; @@ -4434,10 +4340,6 @@ edje_edit_font_del(Evas_Object *obj, const char* alias) if (!eetf) { ERR("Unable to open \"%s\" for writing output", ed->path); - eina_hash_direct_add(ed->file->font_hash, fnt->entry, fnt); - ed->file->font_dir->entries = eina_list_append( - ed->file->font_dir->entries, - fnt); return EINA_FALSE; } @@ -4447,10 +4349,6 @@ edje_edit_font_del(Evas_Object *obj, const char* alias) { ERR("Unable to delete \"%s\" font entry", entry); eet_close(eetf); - eina_hash_direct_add(ed->file->font_hash, fnt->entry, fnt); - ed->file->font_dir->entries = eina_list_append( - ed->file->font_dir->entries, - fnt); return EINA_FALSE; } @@ -4458,18 +4356,12 @@ edje_edit_font_del(Evas_Object *obj, const char* alias) if (!_edje_edit_edje_file_save(eetf, ed->file)) { eet_close(eetf); - eina_hash_direct_add(ed->file->font_hash, fnt->entry, fnt); - ed->file->font_dir->entries = eina_list_append( - ed->file->font_dir->entries, - fnt); return EINA_FALSE; } eet_close(eetf); } - free((char *)fnt->entry); - free((char *)fnt->path); - free(fnt); + eina_hash_del(ed->file->fonts, alias, fnt); return EINA_TRUE; } @@ -7228,7 +7120,7 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only) INF("** Writing all collections"); - it = eina_hash_iterator_data_new(ef->collection_hash); + it = eina_hash_iterator_data_new(ef->collection); while (eina_iterator_next(it, (void **)&edc)) { INF("** Writing hash Edje_Part_Collection* ed->collection " diff --git a/src/lib/edje_load.c b/src/lib/edje_load.c index 3d5fdad..096f109 100644 --- a/src/lib/edje_load.c +++ b/src/lib/edje_load.c @@ -6,7 +6,6 @@ #include "edje_private.h" -static Eina_Bool _edje_file_collection_hash_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata); #ifdef EDJE_PROGRAM_CACHE static Eina_Bool _edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata); #endif @@ -146,14 +145,16 @@ edje_file_collection_list(const char *file) edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL); if (edf != NULL) { - if (edf->collection_dir) - { - Eina_List *l; - Edje_Part_Collection_Directory_Entry *ce; + Eina_Iterator *i; + const char *key; + + i = eina_hash_iterator_key_new(edf->collection); + + EINA_ITERATOR_FOREACH(i, key) + lst = eina_list_append(lst, eina_stringshare_add(key)); + + eina_iterator_free(i); - EINA_LIST_FOREACH(edf->collection_dir->entries, l, ce) - lst = eina_list_append(lst, eina_stringshare_add(ce->entry)); - } _edje_cache_file_unref(edf); } return lst; @@ -185,28 +186,35 @@ edje_file_group_exists(const char *file, const char *glob) { Edje_File *edf; int error_ret = 0; + Eina_Bool succeed = EINA_FALSE; if ((!file) || (!*file)) return EINA_FALSE; edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL); if (edf != NULL) { - if (edf->collection_dir) - { - Edje_Patterns *patterns; + /* FIXME: cache the result in Edje_File structure */ + Edje_Part_Collection_Directory_Entry *ce; + Eina_Iterator *i; + Eina_List *l = NULL; + Edje_Patterns *patterns; + + i = eina_hash_iterator_data_new(edf->collection); + + EINA_ITERATOR_FOREACH(i, ce) + l = eina_list_append(l, ce); + + eina_iterator_free(i); + + patterns = edje_match_collection_dir_init(l); + + succeed = edje_match_collection_dir_exec(patterns, glob); + + edje_match_patterns_free(patterns); + eina_list_free(l); - patterns = - edje_match_collection_dir_init(edf->collection_dir->entries); - if (edje_match_collection_dir_exec(patterns, glob)) - { - edje_match_patterns_free(patterns); - _edje_cache_file_unref(edf); - return EINA_TRUE; - } - edje_match_patterns_free(patterns); - } _edje_cache_file_unref(edf); } - return EINA_FALSE; + return succeed; } @@ -237,11 +245,10 @@ edje_file_data_get(const char *file, const char *key) edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL); if (edf != NULL) { - if (edf->data_cache != NULL) - { - str = eina_hash_find(edf->data_cache, key); - if (str) str = strdup(str); - } + str = eina_hash_find(edf->data, key); + + if (str) str = strdup(str); + _edje_cache_file_unref(edf); } } @@ -905,8 +912,9 @@ _edje_file_del(Edje *ed) lua_pop(ed->L, 1); _edje_lua_free_reg(ed->L, rp->custom->description); // created in edje_lua.c::_edje_lua_part_fn_custom_state } -#endif - _edje_collection_free_part_description_free(rp->custom->description, ed->file->free_strings); +#endif + _edje_collection_free_part_description_free(rp->custom->description, + ed->file->free_strings); } /* Cleanup optional part. */ @@ -984,42 +992,41 @@ _edje_file_del(Edje *ed) ed->table_programs = NULL; ed->table_programs_size = 0; } -/** - * Used to free the cached data values that are stored in the data_cache - * hash table. - */ -static Eina_Bool data_cache_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata) -{ - Edje_File *edf; - - edf = fdata; - if (edf->free_strings) eina_stringshare_del(data); - return EINA_TRUE; -} void _edje_file_free(Edje_File *edf) { Edje_Color_Class *ecc; - Edje_Data *edt; + const Edje_File *prev; + + prev = _edje_file_get(); + _edje_file_set(edf); - if (edf->font_dir) +#define HASH_FREE(Hash) \ + eina_hash_free(Hash); \ + Hash = NULL; + + HASH_FREE(edf->fonts); + HASH_FREE(edf->collection); + HASH_FREE(edf->data); + + if (edf->oef) { - Edje_Font_Directory_Entry *fe; + if (edf->oef->font_dir) + { + eina_list_free(edf->oef->font_dir->entries); - EINA_LIST_FREE(edf->font_dir->entries, fe) + free(edf->oef->font_dir); + } + + if (edf->oef->collection_dir) { - eina_hash_del(edf->font_hash, fe->entry, edf); - if (edf->free_strings && fe->path) eina_stringshare_del(fe->path); - free(fe); + eina_list_free(edf->oef->collection_dir->entries); + + free(edf->oef->collection_dir); } - free(edf->font_dir); - } - if (edf->font_hash) - { - eina_hash_free(edf->font_hash); - edf->font_hash = NULL; } + if (edf->image_dir) { Edje_Image_Directory_Entry *ie; @@ -1031,17 +1038,6 @@ _edje_file_free(Edje_File *edf) } free(edf->image_dir); } - if (edf->collection_dir) - { - Edje_Part_Collection_Directory_Entry *ce; - - EINA_LIST_FREE(edf->collection_dir->entries, ce) - { - if (edf->free_strings && ce->entry) eina_stringshare_del(ce->entry); - free(ce); - } - free(edf->collection_dir); - } if (edf->spectrum_dir) { Edje_Spectrum_Directory_Entry *se; @@ -1063,51 +1059,20 @@ _edje_file_free(Edje_File *edf) free(edf->spectrum_dir); } - EINA_LIST_FREE(edf->data, edt) - { - if (edf->free_strings) - { - if (edt->key) eina_stringshare_del(edt->key); - if (edt->value) eina_stringshare_del(edt->value); - } - free(edt); - } - if (edf->data_cache) - { - eina_hash_foreach(edf->data_cache, data_cache_free, edf); - eina_hash_free(edf->data_cache); - edf->data_cache = NULL; - } - EINA_LIST_FREE(edf->color_classes, ecc) { if (edf->free_strings && ecc->name) eina_stringshare_del(ecc->name); free(ecc); } - /* FIXME: free collection_hash and collection_cache */ - if (edf->collection_hash) - { - ERR("EDJE ERROR:\n" - "\n" - "Naughty Programmer - spank spank!\n" - "\n" - "This program as probably called edje_shutdown() with active Edje objects\n" - "still around.\n This can cause problems as both Evas and Edje retain\n" - "references to the objects. you should shut down all canvases and objects\n" - "before calling edje_shutdown().\n" - "The following errors are the edje object files and parts that are still\n" - "hanging around, with their reference counts"); - eina_hash_foreach(edf->collection_hash, - _edje_file_collection_hash_foreach, edf); - eina_hash_free(edf->collection_hash); - } if (edf->path) eina_stringshare_del(edf->path); if (edf->free_strings && edf->compiler) eina_stringshare_del(edf->compiler); if (edf->collection_cache) _edje_cache_coll_flush(edf); _edje_textblock_style_cleanup(edf); if (edf->ef) eet_close(edf->ef); free(edf); + + _edje_file_set(prev); } void @@ -1166,7 +1131,6 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec) free(edt); } } - if (edf->free_strings && ec->part) eina_stringshare_del(ec->part); #ifdef EDJE_PROGRAM_CACHE if (ec->prog_cache.no_matches) eina_hash_free(ec->prog_cache.no_matches); if (ec->prog_cache.matches) @@ -1206,22 +1170,6 @@ _edje_collection_free_part_description_free(Edje_Part_Description *desc, Eina_Bo free(desc); } -static Eina_Bool -_edje_file_collection_hash_foreach(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata) -{ - Edje_File *edf; - Edje_Part_Collection *coll; - - edf = fdata; - coll = data; - ERR("EEK: EDJE FILE: \"%s\" ref(%i) PART: \"%s\" ref(%i) ", - edf->path, edf->references, - coll->part, coll->references); - _edje_collection_free(edf, coll); - - return EINA_TRUE; -} - #ifdef EDJE_PROGRAM_CACHE static Eina_Bool _edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata) diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index a60ea9f..a9d936c 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -236,6 +236,8 @@ typedef struct _Edje_Part_Description Edje_Part_Description; typedef struct _Edje_Spectrum_Color Edje_Spectrum_Color; typedef struct _Edje_Patterns Edje_Patterns; +typedef struct _Old_Edje_File Old_Edje_File; + #define EDJE_INF_MAX_W 100000 #define EDJE_INF_MAX_H 100000 @@ -319,28 +321,29 @@ struct _Edje_File time_t mtime; Edje_External_Directory *external_dir; - Edje_Font_Directory *font_dir; Edje_Image_Directory *image_dir; Edje_Spectrum_Directory *spectrum_dir; - Edje_Part_Collection_Directory *collection_dir; - Eina_List *data; Eina_List *styles; Eina_List *color_classes; int references; - char *compiler; + const char *compiler; int version; int feature_ver; - Eina_Hash *collection_hash; - Eina_Hash *font_hash; - Eina_List *collection_cache; - Eina_Hash *data_cache; + Eina_Hash *data; + Eina_Hash *fonts; + + Eina_Hash *collection; + Eina_List *collection_cache; Eet_File *ef; - - unsigned int free_strings : 1; - unsigned int dangling : 1; + + Old_Edje_File *oef; + + unsigned char free_strings : 1; + unsigned char dangling : 1; + unsigned char warning : 1; }; struct _Edje_Style @@ -528,6 +531,8 @@ struct _Edje_Part_Collection_Directory_Entry { const char *entry; /* the nominal name of the part collection */ int id; /* the id of this named part collection */ + + Edje_Part_Collection *ref; }; /*----------*/ @@ -576,10 +581,12 @@ struct _Edje_Part_Collection Embryo_Program *script; /* all the embryo script code for this group */ const char *part; - + unsigned char script_only; unsigned char lua_script_only; + + unsigned char checked : 1; }; struct _Edje_Part @@ -1656,4 +1663,5 @@ void _edje_lua2_script_load(Edje_Part_Collection *edc, void *data, int size); void _edje_lua2_script_unload(Edje_Part_Collection *edc); #endif +#include "edje_convert.h" #endif diff --git a/src/lib/edje_text.c b/src/lib/edje_text.c index 9cc67ea..660e32a 100644 --- a/src/lib/edje_text.c +++ b/src/lib/edje_text.c @@ -330,9 +330,9 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, if (!font) font = ""; /* check if the font is embedded in the .eet */ - if (ed->file->font_hash) + if (ed->file->fonts) { - Edje_Font_Directory_Entry *fnt = eina_hash_find(ed->file->font_hash, font); + Edje_Font_Directory_Entry *fnt = eina_hash_find(ed->file->fonts, font); if (fnt) { diff --git a/src/lib/edje_textblock_styles.c b/src/lib/edje_textblock_styles.c index c1b1305..5b9fd0b 100644 --- a/src/lib/edje_textblock_styles.c +++ b/src/lib/edje_textblock_styles.c @@ -7,9 +7,9 @@ #include "edje_private.h" static int -_edje_font_is_embedded(Edje_File *edf, char *font __UNUSED__) +_edje_font_is_embedded(Edje_File *edf, char *font) { - if (!edf->font_dir) return 0; + if (!eina_hash_find(edf->fonts, font)) return 0; return 1; }