diff --git a/legacy/ecore/configure.ac b/legacy/ecore/configure.ac index 0924faeeab..1b51b0e02a 100644 --- a/legacy/ecore/configure.ac +++ b/legacy/ecore/configure.ac @@ -1167,6 +1167,7 @@ ecore-sdl.pc ecore-quartz.pc ecore-wince.pc ecore.pc +ecore-data.pc doc/ecore.dox doc/Makefile src/Makefile @@ -1192,6 +1193,7 @@ src/lib/ecore_file/Makefile src/lib/ecore_directfb/Makefile src/lib/ecore_win32/Makefile src/lib/ecore_wince/Makefile +src/lib/ecore_data/Makefile README ecore.spec po/Makefile.in diff --git a/legacy/ecore/ecore-data.pc.in b/legacy/ecore/ecore-data.pc.in new file mode 100644 index 0000000000..814fe12dc0 --- /dev/null +++ b/legacy/ecore/ecore-data.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: ecore-data +Description: Ecore data library +Version: @VERSION@ +Libs: -L${libdir} +Cflags: -I${includedir} diff --git a/legacy/ecore/src/lib/Makefile.am b/legacy/ecore/src/lib/Makefile.am index eb16664025..d580797479 100644 --- a/legacy/ecore/src/lib/Makefile.am +++ b/legacy/ecore/src/lib/Makefile.am @@ -18,4 +18,5 @@ ecore_evas \ ecore_config \ ecore_file \ ecore_imf \ -ecore_imf_evas +ecore_imf_evas \ +ecore_data diff --git a/legacy/ecore/src/lib/ecore/Ecore.h b/legacy/ecore/src/lib/ecore/Ecore.h index 4da5db1802..379feb1bd7 100644 --- a/legacy/ecore/src/lib/ecore/Ecore.h +++ b/legacy/ecore/src/lib/ecore/Ecore.h @@ -63,14 +63,6 @@ #endif #include -#ifndef TRUE -# define TRUE 1 -#endif - -#ifndef FALSE -# define FALSE 0 -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/legacy/ecore/src/lib/ecore/Makefile.am b/legacy/ecore/src/lib/ecore/Makefile.am index 1f392cd9bf..da710ad70d 100644 --- a/legacy/ecore/src/lib/ecore/Makefile.am +++ b/legacy/ecore/src/lib/ecore/Makefile.am @@ -6,8 +6,6 @@ AM_CFLAGS = @WIN32_CFLAGS@ @EFL_PTHREAD_CFLAGS@ lib_LTLIBRARIES = libecore.la include_HEADERS = \ Ecore.h \ -Ecore_Data.h \ -Ecore_Str.h \ Ecore_Getopt.h libecore_la_SOURCES = \ @@ -16,25 +14,16 @@ ecore_anim.c \ ecore_app.c \ ecore_events.c \ ecore_getopt.c \ -ecore_hash.c \ ecore_idle_enterer.c \ ecore_idle_exiter.c \ ecore_idler.c \ ecore_job.c \ -ecore_list.c \ ecore_main.c \ -ecore_path.c \ ecore_pipe.c \ -ecore_plugin.c \ ecore_poll.c \ -ecore_sheap.c \ ecore_signal.c \ -ecore_str.c \ -ecore_strbuf.c \ ecore_time.c \ ecore_timer.c \ -ecore_tree.c \ -ecore_value.c \ ecore_thread.c \ ecore_glib.c diff --git a/legacy/ecore/src/lib/ecore/ecore.c b/legacy/ecore/src/lib/ecore/ecore.c index 9a2d70b56e..60c6470fe9 100644 --- a/legacy/ecore/src/lib/ecore/ecore.c +++ b/legacy/ecore/src/lib/ecore/ecore.c @@ -153,6 +153,18 @@ ecore_shutdown(void) return _ecore_init_count; } +EAPI void +ecore_print_warning(const char *function, const char *sparam) +{ + WRN("***** Developer Warning ***** :\n" + "\tThis program is calling:\n\n" + "\t%s();\n\n" + "\tWith the parameter:\n\n" + "\t%s\n\n" + "\tbeing NULL. Please fix your program.", function, sparam); + if (getenv("ECORE_ERROR_ABORT")) abort(); +} + EAPI void _ecore_magic_fail(const void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname) { diff --git a/legacy/ecore/src/lib/ecore/ecore_strings.c b/legacy/ecore/src/lib/ecore/ecore_strings.c deleted file mode 100644 index fd27a74c7d..0000000000 --- a/legacy/ecore/src/lib/ecore/ecore_strings.c +++ /dev/null @@ -1,155 +0,0 @@ -#include "ecore_private.h" -#include "Ecore_Data.h" - -static void ecore_string_free_cb(void *data); - -static Ecore_Hash *ecore_strings = NULL; -static int ecore_string_init_count = 0; - -/** - * @defgroup Ecore_String_Group String Instance Functions - * - * These functions allow you to store one copy of a string, and use it - * throughout your program. - * - * This is a method to reduce the number of duplicated strings kept in - * memory. It's pretty common for the same strings to be dynamically - * allocated repeatedly between applications and libraries, especially in - * circumstances where you could have multiple copies of a structure that - * allocates the string. So rather than duplicating and freeing these - * strings, you request a read-only pointer to an existing string and - * only incur the overhead of a hash lookup. - * - * It sounds like micro-optimizing, but profiling has shown this can have - * a significant impact as you scale the number of copies up. It improves - * string creation/destruction speed, reduces memory use and decreases - * memory fragmentation, so a win all-around. - */ - -/** - * Initialize the ecore string internal structure. - * @return Zero on failure, non-zero on successful initialization. - */ -EAPI int -ecore_string_init() -{ - /* - * No strings have been loaded at this point, so create the hash - * table for storing string info for later. - */ - if (!ecore_string_init_count) - { - ecore_strings = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (!ecore_strings) - return 0; - ecore_hash_free_value_cb_set(ecore_strings, ecore_string_free_cb); - } - ecore_string_init_count++; - - return 1; -} - -/** - * Retrieves an instance of a string for use in an ecore program. - * @param string The string to retrieve an instance of. - * @return A pointer to an instance of the string on success. - * @c NULL on failure. - * @ingroup Ecore_String_Group - */ -EAPI const char * -ecore_string_instance(const char *string) -{ - Ecore_String *str; - - CHECK_PARAM_POINTER_RETURN("string", string, NULL); - - /* - * Check for a previous instance of the string, if not found, create - * it. - */ - str = ecore_hash_get(ecore_strings, string); - if (!str) - { - int length; - - /* - * Allocate and initialize a new string reference. - */ - length = strlen(string) + 1; - - str = (Ecore_String *)malloc(sizeof(Ecore_String) + length * sizeof(char)); - - str->string = (char*)(str + 1); - str->references = 0; - - memcpy(str->string, string, length); - - ecore_hash_set(ecore_strings, str->string, str); - } - - str->references++; - - return str->string; -} - -/** - * Notes that the given string has lost an instance. - * - * It will free the string if no other instances are left. - * - * @param string The given string. - * @ingroup Ecore_String_Group - */ -EAPI void -ecore_string_release(const char *string) -{ - Ecore_String *str; - - CHECK_PARAM_POINTER("string", string); - - str = ecore_hash_get(ecore_strings, (char *)string); - if (!str) - return; - - str->references--; - if (str->references < 1) - { - ecore_hash_remove(ecore_strings, (char *)string); - FREE(str); - } -} - -EAPI void -ecore_string_hash_dump_graph(void) -{ - ecore_hash_dump_graph(ecore_strings); -} - -EAPI void -ecore_string_hash_dump_stats(void) -{ - ecore_hash_dump_stats(ecore_strings); -} - -/** - * Shutdown the ecore string internal structures - */ -EAPI void -ecore_string_shutdown() -{ - --ecore_string_init_count; - if (!ecore_string_init_count) - { - ecore_hash_destroy(ecore_strings); - ecore_strings = NULL; - } -} - -static void -ecore_string_free_cb(void *data) -{ - Ecore_String *str; - - str = data; - FREE(str); -} diff --git a/legacy/ecore/src/lib/ecore/Ecore_Data.h b/legacy/ecore/src/lib/ecore_data/Ecore_Data.h similarity index 100% rename from legacy/ecore/src/lib/ecore/Ecore_Data.h rename to legacy/ecore/src/lib/ecore_data/Ecore_Data.h diff --git a/legacy/ecore/src/lib/ecore/Ecore_Str.h b/legacy/ecore/src/lib/ecore_data/Ecore_Str.h similarity index 100% rename from legacy/ecore/src/lib/ecore/Ecore_Str.h rename to legacy/ecore/src/lib/ecore_data/Ecore_Str.h diff --git a/legacy/ecore/src/lib/ecore_data/Makefile.am b/legacy/ecore/src/lib/ecore_data/Makefile.am new file mode 100644 index 0000000000..75adf8521b --- /dev/null +++ b/legacy/ecore/src/lib/ecore_data/Makefile.am @@ -0,0 +1,24 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_data.la +include_HEADERS = \ +Ecore_Data.h \ +Ecore_Str.h + +libecore_data_la_SOURCES = \ +ecore_hash.c \ +ecore_list.c \ +ecore_path.c \ +ecore_plugin.c \ +ecore_sheap.c \ +ecore_strbuf.c \ +ecore_tree.c \ +ecore_value.c + +libecore_data_la_LIBADD = @EINA_LIBS@ +libecore_data_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @ecore_release_info@ + diff --git a/legacy/ecore/src/lib/ecore/ecore_hash.c b/legacy/ecore/src/lib/ecore_data/ecore_hash.c similarity index 100% rename from legacy/ecore/src/lib/ecore/ecore_hash.c rename to legacy/ecore/src/lib/ecore_data/ecore_hash.c index 1f6331297d..453bc245b0 100644 --- a/legacy/ecore/src/lib/ecore/ecore_hash.c +++ b/legacy/ecore/src/lib/ecore_data/ecore_hash.c @@ -9,9 +9,9 @@ #include #include +#include "Ecore_Data.h" #include "Ecore.h" #include "ecore_private.h" -#include "Ecore_Data.h" #define PRIME_TABLE_MAX 21 #define PRIME_MIN 17 diff --git a/legacy/ecore/src/lib/ecore/ecore_list.c b/legacy/ecore/src/lib/ecore_data/ecore_list.c similarity index 100% rename from legacy/ecore/src/lib/ecore/ecore_list.c rename to legacy/ecore/src/lib/ecore_data/ecore_list.c diff --git a/legacy/ecore/src/lib/ecore/ecore_path.c b/legacy/ecore/src/lib/ecore_data/ecore_path.c similarity index 100% rename from legacy/ecore/src/lib/ecore/ecore_path.c rename to legacy/ecore/src/lib/ecore_data/ecore_path.c diff --git a/legacy/ecore/src/lib/ecore/ecore_plugin.c b/legacy/ecore/src/lib/ecore_data/ecore_plugin.c similarity index 100% rename from legacy/ecore/src/lib/ecore/ecore_plugin.c rename to legacy/ecore/src/lib/ecore_data/ecore_plugin.c diff --git a/legacy/ecore/src/lib/ecore/ecore_sheap.c b/legacy/ecore/src/lib/ecore_data/ecore_sheap.c similarity index 100% rename from legacy/ecore/src/lib/ecore/ecore_sheap.c rename to legacy/ecore/src/lib/ecore_data/ecore_sheap.c diff --git a/legacy/ecore/src/lib/ecore/ecore_str.c b/legacy/ecore/src/lib/ecore_data/ecore_str.c similarity index 100% rename from legacy/ecore/src/lib/ecore/ecore_str.c rename to legacy/ecore/src/lib/ecore_data/ecore_str.c diff --git a/legacy/ecore/src/lib/ecore/ecore_strbuf.c b/legacy/ecore/src/lib/ecore_data/ecore_strbuf.c similarity index 100% rename from legacy/ecore/src/lib/ecore/ecore_strbuf.c rename to legacy/ecore/src/lib/ecore_data/ecore_strbuf.c diff --git a/legacy/ecore/src/lib/ecore/ecore_tree.c b/legacy/ecore/src/lib/ecore_data/ecore_tree.c similarity index 100% rename from legacy/ecore/src/lib/ecore/ecore_tree.c rename to legacy/ecore/src/lib/ecore_data/ecore_tree.c diff --git a/legacy/ecore/src/lib/ecore/ecore_value.c b/legacy/ecore/src/lib/ecore_data/ecore_value.c similarity index 90% rename from legacy/ecore/src/lib/ecore/ecore_value.c rename to legacy/ecore/src/lib/ecore_data/ecore_value.c index 1f8f51f65a..6a344124d2 100644 --- a/legacy/ecore/src/lib/ecore/ecore_value.c +++ b/legacy/ecore/src/lib/ecore_data/ecore_value.c @@ -50,18 +50,6 @@ EAPI const unsigned int ecore_prime_table[] = 2097143, 4194301, 8388617, 16777213 }; -EAPI void -ecore_print_warning(const char *function, const char *sparam) -{ - WRN("***** Developer Warning ***** :\n" - "\tThis program is calling:\n\n" - "\t%s();\n\n" - "\tWith the parameter:\n\n" - "\t%s\n\n" - "\tbeing NULL. Please fix your program.", function, sparam); - if (getenv("ECORE_ERROR_ABORT")) abort(); -} - /** * Just casts the key to an unsigned int * @param key The key to return compute a hash value