More ecore_data to separate lib
authorenglebass <englebass@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 1 Feb 2010 20:20:06 +0000 (20:20 +0000)
committerenglebass <englebass@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 1 Feb 2010 20:20:06 +0000 (20:20 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@45782 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

19 files changed:
configure.ac
ecore-data.pc.in [new file with mode: 0644]
src/lib/Makefile.am
src/lib/ecore/Ecore.h
src/lib/ecore/Makefile.am
src/lib/ecore/ecore.c
src/lib/ecore/ecore_strings.c [deleted file]
src/lib/ecore_data/Ecore_Data.h [moved from src/lib/ecore/Ecore_Data.h with 100% similarity]
src/lib/ecore_data/Ecore_Str.h [moved from src/lib/ecore/Ecore_Str.h with 100% similarity]
src/lib/ecore_data/Makefile.am [new file with mode: 0644]
src/lib/ecore_data/ecore_hash.c [moved from src/lib/ecore/ecore_hash.c with 100% similarity]
src/lib/ecore_data/ecore_list.c [moved from src/lib/ecore/ecore_list.c with 100% similarity]
src/lib/ecore_data/ecore_path.c [moved from src/lib/ecore/ecore_path.c with 100% similarity]
src/lib/ecore_data/ecore_plugin.c [moved from src/lib/ecore/ecore_plugin.c with 100% similarity]
src/lib/ecore_data/ecore_sheap.c [moved from src/lib/ecore/ecore_sheap.c with 100% similarity]
src/lib/ecore_data/ecore_str.c [moved from src/lib/ecore/ecore_str.c with 100% similarity]
src/lib/ecore_data/ecore_strbuf.c [moved from src/lib/ecore/ecore_strbuf.c with 100% similarity]
src/lib/ecore_data/ecore_tree.c [moved from src/lib/ecore/ecore_tree.c with 100% similarity]
src/lib/ecore_data/ecore_value.c [moved from src/lib/ecore/ecore_value.c with 90% similarity]

index 0924fae..1b51b0e 100644 (file)
@@ -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/ecore-data.pc.in b/ecore-data.pc.in
new file mode 100644 (file)
index 0000000..814fe12
--- /dev/null
@@ -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}
index eb16664..d580797 100644 (file)
@@ -18,4 +18,5 @@ ecore_evas \
 ecore_config \
 ecore_file \
 ecore_imf \
-ecore_imf_evas
+ecore_imf_evas \
+ecore_data
index 4da5db1..379feb1 100644 (file)
 #endif
 #include <sys/types.h>
 
-#ifndef TRUE
-# define TRUE 1
-#endif
-
-#ifndef FALSE
-# define FALSE 0
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
index 1f392cd..da710ad 100644 (file)
@@ -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
 
index 9a2d70b..60c6470 100644 (file)
@@ -154,6 +154,18 @@ ecore_shutdown(void)
 }
 
 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)
 {
    ERR("\n"
diff --git a/src/lib/ecore/ecore_strings.c b/src/lib/ecore/ecore_strings.c
deleted file mode 100644 (file)
index fd27a74..0000000
+++ /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/src/lib/ecore_data/Makefile.am b/src/lib/ecore_data/Makefile.am
new file mode 100644 (file)
index 0000000..75adf85
--- /dev/null
@@ -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@
+
similarity index 100%
rename from src/lib/ecore/ecore_hash.c
rename to src/lib/ecore_data/ecore_hash.c
index 1f63312..453bc24 100644 (file)
@@ -9,9 +9,9 @@
 #include <stdio.h>
 #include <string.h>
 
+#include "Ecore_Data.h"
 #include "Ecore.h"
 #include "ecore_private.h"
-#include "Ecore_Data.h"
 
 #define PRIME_TABLE_MAX 21
 #define PRIME_MIN 17
similarity index 90%
rename from src/lib/ecore/ecore_value.c
rename to src/lib/ecore_data/ecore_value.c
index 1f8f51f..6a34412 100644 (file)
@@ -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