E CVS: libs/ecore pfritz

2008-07-30 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_x/xlib


Modified Files:
ecore_x.c ecore_x_atoms.c 


Log Message:
fix warnings

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_x/xlib/ecore_x.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_x.c   23 Jul 2008 10:00:01 -  1.1
+++ ecore_x.c   30 Jul 2008 22:59:23 -  1.2
@@ -925,9 +925,9 @@
Atom *atoms_int;
int i;

-   if (!_ecore_x_disp) return 0;
+   if (!_ecore_x_disp) return;
atoms_int = alloca(num * sizeof(Atom));
-   XInternAtoms(_ecore_x_disp, names, num, False, atoms_int);
+   XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int);
for (i = 0; i < num; i++)
  atoms[i] = atoms_int[i];
 }
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ecore_x_atoms.c 25 Jul 2008 01:45:36 -  1.2
+++ ecore_x_atoms.c 30 Jul 2008 22:59:23 -  1.3
@@ -197,7 +197,7 @@
num = sizeof(items) / sizeof(Atom_Item);
atoms = alloca(num * sizeof(Atom));
names = alloca(num * sizeof(char *));
-   for (i = 0; i < num; i++) names[i] = items[i].name;
+   for (i = 0; i < num; i++) names[i] = (char *)items[i].name;
XInternAtoms(_ecore_x_disp, names, num, False, atoms);
for (i = 0; i < num; i++) *(items[i].atom) = atoms[i];
 }



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-07-17 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_value.c 


Log Message:
prevent degenerated hash values with 64bit pointer

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_value.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- ecore_value.c   17 May 2008 03:19:38 -  1.12
+++ ecore_value.c   17 Jul 2008 22:58:28 -  1.13
@@ -56,7 +56,13 @@
 EAPI unsigned int 
 ecore_direct_hash(const void *key)
 {
-   return ((unsigned int) key);
+#ifdef __LP64__
+   unsigned long int val = (unsigned long int)key;
+
+   return (unsigned int) ((val >> 32) ^ val);
+#else
+   return (unsigned int) key;
+#endif
 }
 
 /**



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-06-08 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_config


Modified Files:
Ecore_Config.h ecore_config_extra.c 


Log Message:
add constness; formatting

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_config/Ecore_Config.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- Ecore_Config.h  15 Mar 2007 22:21:27 -  1.57
+++ Ecore_Config.h  8 Jun 2008 12:38:56 -   1.58
@@ -253,7 +253,7 @@
/* FIXME: this should only be included if evas is present */
EAPI int ecore_config_evas_font_path_apply(Evas *evas);
EAPI char   *ecore_config_theme_search_path_get(void);
-   EAPI int ecore_config_theme_search_path_append(char 
*append);
+   EAPI int ecore_config_theme_search_path_append(const char 
*append);
  
EAPI char   *ecore_config_theme_default_path_get(void);
EAPI char   *ecore_config_theme_with_path_from_name_get(char 
*name);
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_config/ecore_config_extra.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ecore_config_extra.c8 Jan 2006 14:57:14 -   1.9
+++ ecore_config_extra.c8 Jun 2008 12:38:56 -   1.10
@@ -407,7 +407,7 @@
  * @c ECORE_CONFIG_ERR_FAIL is returned if @p path is @c NULL.
  */
 int
-ecore_config_theme_search_path_append(char *path)
+ecore_config_theme_search_path_append(const char *path)
 {
char   *search_path, *loc, *new_search_path;
int len, search_len;
@@ -430,9 +430,9 @@
strncat(new_search_path, path, len);
 
ecore_config_string_set("/e/themes/search_path", new_search_path);
-  prop = ecore_config_get("/e/themes/search_path");
-  if (prop)
- prop->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
+   prop = ecore_config_get("/e/themes/search_path");
+   if (prop)
+ prop->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
 
free(new_search_path);
 



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-05-30 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_path.c ecore_plugin.c 


Log Message:
move ecore_plugin_available_get() to ecore_plugin.c

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_path.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ecore_path.c2 Mar 2008 02:01:11 -   1.27
+++ ecore_path.c30 May 2008 10:18:04 -  1.28
@@ -211,84 +211,3 @@
return avail;
 }
 
-/**
- * Retrieves a list of all available plugins in the given path.
- * @param   group_id The identifier for the given path.
- * @return  A pointer to a newly allocated list of all plugins found in the
- *  paths identified by @p group_id.  @c NULL otherwise.
- * @ingroup Ecore_Plugin
- */
-EAPI Ecore_List *
-ecore_plugin_available_get(Ecore_Path_Group *group)
-{
-   Ecore_List *avail = NULL;
-   Ecore_Hash *plugins = NULL;
-   char *path;
-
-   CHECK_PARAM_POINTER_RETURN("group", group, NULL);
-
-   if (!group->paths || ecore_list_empty_is(group->paths))
- return NULL;
-
-   ecore_list_first_goto(group->paths);
-   plugins = ecore_hash_new(ecore_str_hash, ecore_str_compare);
-   ecore_hash_free_key_cb_set(plugins, free);
-
-   while ((path = ecore_list_next(group->paths)) != NULL)
- {
-   DIR *dir;
-   struct stat st;
-   struct dirent *d;
-
-   if (stat(path, &st) < 0)
- continue;
-
-   if (!S_ISDIR(st.st_mode))
- continue;
-
-   dir = opendir(path);
-
-   if (!dir)
- continue;
-
-   while ((d = readdir(dir)) != NULL)
- {
-char ppath[PATH_MAX];
-char *ext;
-
-if (*d->d_name == '.')
-  continue;
-
-if (!ecore_str_has_suffix(d->d_name, SHARED_LIB_SUFFIX))
-  continue;
-
-snprintf(ppath, PATH_MAX, "%s/%s", path, d->d_name);
-
-stat(ppath, &st);
-
-if (!S_ISREG(st.st_mode))
-  continue;
-
-ecore_strlcpy(ppath, d->d_name, sizeof(ppath));
-ext = strrchr(ppath, '.');
-*ext = '\0';
-
-if (!ecore_hash_get(plugins, ppath))
-  {
- char *key;
-
- key = strdup(ppath);
- ecore_hash_set(plugins, key, key);
-  }
- }
-   closedir(dir);
- }
-
-   ecore_hash_free_key_cb_set(plugins, NULL);
-   avail = ecore_hash_keys(plugins);
-   ecore_list_free_cb_set(avail, free);
-   ecore_hash_destroy(plugins);
-
-   return avail;
-}
-
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_plugin.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- ecore_plugin.c  26 May 2008 05:16:32 -  1.18
+++ ecore_plugin.c  30 May 2008 10:18:04 -  1.19
@@ -150,3 +150,85 @@
 
return ret;
 }
+
+/**
+ * Retrieves a list of all available plugins in the given path.
+ * @param   group_id The identifier for the given path.
+ * @return  A pointer to a newly allocated list of all plugins found in the
+ *  paths identified by @p group_id.  @c NULL otherwise.
+ * @ingroup Ecore_Plugin
+ */
+EAPI Ecore_List *
+ecore_plugin_available_get(Ecore_Path_Group *group)
+{
+   Ecore_List *avail = NULL;
+   Ecore_Hash *plugins = NULL;
+   char *path;
+
+   CHECK_PARAM_POINTER_RETURN("group", group, NULL);
+
+   if (!group->paths || ecore_list_empty_is(group->paths))
+ return NULL;
+
+   ecore_list_first_goto(group->paths);
+   plugins = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+   ecore_hash_free_key_cb_set(plugins, free);
+
+   while ((path = ecore_list_next(group->paths)) != NULL)
+ {
+   DIR *dir;
+   struct stat st;
+   struct dirent *d;
+
+   if (stat(path, &st) < 0)
+ continue;
+
+   if (!S_ISDIR(st.st_mode))
+ continue;
+
+   dir = opendir(path);
+
+   if (!dir)
+ continue;
+
+   while ((d = readdir(dir)) != NULL)
+ {
+char ppath[PATH_MAX];
+char *ext;
+
+if (*d->d_name == '.')
+  continue;
+
+if (!ecore_str_has_suffix(d->d_name, SHARED_LIB_SUFFIX))
+  continue;
+
+snprintf(ppath, PATH_MAX, "%s/%s", path, d->d_name);
+
+stat(ppath, &st);
+
+if (!S_ISREG(st.st_mode))
+  continue;
+
+ecore_strlcpy(ppath, d->d_name, sizeof(ppath));
+ext = strrchr(ppath, '.');
+*ext = '\0';
+
+if (!ecore_hash_get(plugins, ppath))
+  {
+ char *key;
+
+ key = strdup(ppath);
+ ecore_hash_set(plugins, key, key);
+  }
+ }
+   closedir(dir);
+ }
+
+   ecore_hash_free_key_cb_set(plugins, NULL);

E CVS: libs/ecore pfritz

2008-03-16 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h 


Log Message:
remove dangerous casts

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- Ecore_Data.h8 Jan 2008 21:49:57 -   1.53
+++ Ecore_Data.h16 Mar 2008 23:05:50 -  1.54
@@ -178,11 +178,11 @@
EAPI int ecore_dlist_prepend_list(Ecore_DList * _e_dlist, Ecore_DList * 
prepend);

/* Info about list's state */
-# define ecore_dlist_first(list) ecore_list_first(ECORE_LIST(list))
-# define ecore_dlist_last(list) ecore_list_last(ECORE_LIST(list))
+# define ecore_dlist_first(list) ecore_list_first(list)
+# define ecore_dlist_last(list) ecore_list_last(list)
EAPI void *ecore_dlist_current(Ecore_DList *list);
EAPI int ecore_dlist_index(Ecore_DList *list);
-# define ecore_dlist_count(list) ecore_list_count(ECORE_LIST(list))
+# define ecore_dlist_count(list) ecore_list_count(list)

/* Removing items from the list */
EAPI void *ecore_dlist_remove(Ecore_DList * _e_dlist);
@@ -192,7 +192,7 @@

/* Traversing the list */
 # define ecore_dlist_for_each(list, function, user_data) \
-   ecore_list_for_each(ECORE_LIST(list), function, user_data)
+   ecore_list_for_each(list, function, user_data)
EAPI void *ecore_dlist_first_goto(Ecore_DList * _e_dlist);
EAPI void *ecore_dlist_last_goto(Ecore_DList * _e_dlist);
EAPI void *ecore_dlist_index_goto(Ecore_DList * _e_dlist, int index);



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-03-13 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_con


Modified Files:
ecore_con_url.c 


Log Message:
compile again with curl

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con_url.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ecore_con_url.c 13 Mar 2008 06:35:57 -  1.20
+++ ecore_con_url.c 13 Mar 2008 09:26:24 -  1.21
@@ -269,7 +269,7 @@
  {
if (url_con->active)
  {
-if (ecore_list_find(_url_con_list, _ecore_con_url_compare_cb, 
url_con) == url_con)
+if (ecore_list_find(_url_con_list, ecore_direct_compare, url_con) 
== url_con)
   ecore_list_remove(_url_con_list);
 url_con->active = 0;
 



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-03-11 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_con


Modified Files:
Ecore_Con.h 


Log Message:
compile on FreeBSD again

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/Ecore_Con.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- Ecore_Con.h 9 Mar 2008 16:43:32 -   1.36
+++ Ecore_Con.h 11 Mar 2008 19:51:32 -  1.37
@@ -25,6 +25,7 @@
 # endif
 #endif
 
+#include 
 #include 
 #include 
 



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-02-11 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_con


Modified Files:
Ecore_Con.h ecore_con_url.c 


Log Message:
add doxy stubs, so that the function names at least appear in the api references
Thanks to mcalamelli

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/Ecore_Con.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- Ecore_Con.h 8 Jan 2008 21:28:51 -   1.34
+++ Ecore_Con.h 11 Feb 2008 23:24:11 -  1.35
@@ -58,6 +58,7 @@
  * @li @ref Ecore_Con_Lib_Group
  * @li @ref Ecore_Con_Server_Group
  * @li @ref Ecore_Con_Client_Group
+ * @li @ref Ecore_Con_Url_Group
  */
 
 #ifdef __cplusplus
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con_url.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ecore_con_url.c 26 Sep 2007 17:18:52 -  1.16
+++ ecore_con_url.c 11 Feb 2008 23:24:11 -  1.17
@@ -40,6 +40,14 @@
 #include "Ecore_Con.h"
 #include "ecore_con_private.h"
 
+/**
+ * @defgroup Ecore_Con_Url_Group Ecore URL Connection Functions
+ *
+ * Utility functions that set up, use and shut down the Ecore URL 
+ * Connection library.
+ * FIXME: write detailed description
+ */
+
 #ifdef HAVE_CURL
 static int _ecore_con_url_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
 static int _ecore_con_url_perform(Ecore_Con_Url *url_con);
@@ -92,6 +100,12 @@
 
 #endif
 
+/**
+ * Initialises the Ecore_Con_Url library.
+ * @return Number of times the library has been initialised without being
+ *  shut down.
+ * @ingroup Ecore_Con_Url_Group
+ */
 EAPI int
 ecore_con_url_init(void)
 {
@@ -135,6 +149,11 @@
 #endif
 }
 
+/**
+ * Shuts down the Ecore_Con_Url library.
+ * @return  Number of calls that still uses Ecore_Con_Url
+ * @ingroup Ecore_Con_Url_Group
+ */
 EAPI int
 ecore_con_url_shutdown(void)
 {
@@ -169,6 +188,11 @@
return 1;
 }
 
+/**
+ * Creates and initializes a new Ecore_Con_Url.
+ * @return  NULL on error, a new Ecore_Con_Url on success.
+ * @ingroup Ecore_Con_Url_Group
+ */
 EAPI Ecore_Con_Url *
 ecore_con_url_new(const char *url)
 {
@@ -213,6 +237,11 @@
 #endif
 }
 
+/**
+ * Frees the Ecore_Con_Url.
+ * @return  FIXME: To be documented. 
+ * @ingroup Ecore_Con_Url_Group
+ */
 EAPI void
 ecore_con_url_destroy(Ecore_Con_Url *url_con)
 {
@@ -242,6 +271,11 @@
 #endif
 }
 
+/**
+ * FIXME: To be documented.
+ * @return  FIXME: To be documented.
+ * @ingroup Ecore_Con_Url_Group
+ */
 EAPI int
 ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url)
 {
@@ -267,6 +301,11 @@
 #endif
 }
 
+/**
+ * FIXME: To be documented.
+ * @return  FIXME: To be documented.
+ * @ingroup Ecore_Con_Url_Group
+ */
 EAPI void
 ecore_con_url_data_set(Ecore_Con_Url *url_con, void *data)
 {
@@ -285,6 +324,11 @@
 #endif
 }
 
+/**
+ * FIXME: To be documented.
+ * @return  FIXME: To be documented.
+ * @ingroup Ecore_Con_Url_Group
+ */
 EAPI void *
 ecore_con_url_data_get(Ecore_Con_Url *url_con)
 {
@@ -302,6 +346,11 @@
 #endif
 }
 
+/**
+ * FIXME: To be documented.
+ * @return  FIXME: To be documented.
+ * @ingroup Ecore_Con_Url_Group
+ */
 EAPI void
 ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, 
time_t tm)
 {
@@ -322,6 +371,11 @@
 #endif
 }
 
+/**
+ * FIXME: To be documented.
+ * @return  FIXME: To be documented.
+ * @ingroup Ecore_Con_Url_Group
+ */
 EAPI int
 ecore_con_url_send(Ecore_Con_Url *url_con, void *data, size_t length, char 
*content_type)
 {
@@ -556,6 +610,7 @@
  }
return job_matched;
 }
+
 static void
 _ecore_con_event_url_free(void *data __UNUSED__, void *ev)
 {



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-01-26 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore.h 


Log Message:
remove stupid semicolons

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- Ecore.h 26 Jan 2008 05:40:52 -  1.59
+++ Ecore.h 26 Jan 2008 14:41:34 -  1.60
@@ -61,8 +61,8 @@
 extern "C" {
 #endif
 
-#define ECORE_CALLBACK_CANCEL 0; /**< Return value to remove a callback */
-#define ECORE_CALLBACK_RENEW 1; /**< Return value to keep a callback */ 
+#define ECORE_CALLBACK_CANCEL 0 /**< Return value to remove a callback */
+#define ECORE_CALLBACK_RENEW 1  /**< Return value to keep a callback */ 
 
 #define ECORE_EVENT_NONE0
 #define ECORE_EVENT_SIGNAL_USER 1 /**< User signal event */



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-01-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore.h ecore_anim.c ecore_events.c ecore_idler.c ecore_poll.c 
ecore_timer.c 


Log Message:
add ECORE_CALLBACK_RENEW and ECORE_CALLBACK_CANCEL

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- Ecore.h 11 Jan 2008 07:33:56 -  1.57
+++ Ecore.h 25 Jan 2008 18:28:16 -  1.58
@@ -61,6 +61,9 @@
 extern "C" {
 #endif
 
+#define ECORE_CALLBACK_CANCEL 0; /**< Return value to remove a callback */
+#define ECORE_CALLBACK_RENEW 1; /**< Return value to keep a callback */ 
+
 #define ECORE_EVENT_NONE0
 #define ECORE_EVENT_SIGNAL_USER 1 /**< User signal event */
 #define ECORE_EVENT_SIGNAL_HUP  2 /**< Hup signal event */
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_anim.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ecore_anim.c20 Oct 2006 12:27:29 -  1.6
+++ ecore_anim.c25 Jan 2008 18:28:16 -  1.7
@@ -21,9 +21,9 @@
  * be passed the @p data pointer as its parameter.
  * 
  * When the animator @p func is called, it must return a value of either 1 or 
0. 
- * If it returns 1, it will be called again at the next tick, or if it returns
- * 0 it will be deleted automatically making any references/handles for it
- * invalid.
+ * If it returns 1 (or ECORE_CALLBACK_RENEW), it will be called again at the 
+ * next tick, or if it returns 0 (or ECORE_CALLBACK_CANCEL) it will be deleted 
+ * automatically making any references/handles for it invalid.
  */
 EAPI Ecore_Animator *
 ecore_animator_add(int (*func) (void *data), const void *data)
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_events.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ecore_events.c  5 Apr 2007 06:44:42 -   1.26
+++ ecore_events.c  25 Jan 2008 18:28:16 -  1.27
@@ -35,10 +35,11 @@
  * provided in this call as the @p data parameter.
  * 
  * When the callback @p func is called, it must return 1 or 0. If it returns 
- * 1, It will keep being called as per normal, for each handler set up for that
- * event type. If it returns 0, it will cease processing handlers for that
- * particular event, so all handler set to handle that event type that have not
- * already been called, will not be.
+ * 1 (or ECORE_CALLBACK_RENEW), It will keep being called as per normal, for 
+ * each handler set up for that event type. If it returns 0 (or 
+ * ECORE_CALLBACK_CANCEL), it will cease processing handlers for that 
particular
+ * event, so all handler set to handle that event type that have not already 
+ * been called, will not be.
  */
 EAPI Ecore_Event_Handler *
 ecore_event_handler_add(int type, int (*func) (void *data, int type, void 
*event), const void *data)
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_idler.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ecore_idler.c   28 Dec 2006 03:31:44 -  1.8
+++ ecore_idler.c   25 Jan 2008 18:28:16 -  1.9
@@ -13,8 +13,9 @@
  *
  * Add an idler handle to the event loop, returning a handle on success and
  * NULL otherwise.  The function @p func will be called repeatedly while
- * no other events are ready to be processed, as long as it returns 1. A return
- * of 0 deletes the idler.
+ * no other events are ready to be processed, as long as it returns 1 
+ * (or ECORE_CALLBACK_RENEW). A return of 0 (or ECORE_CALLBACK_CANCEL) deletes 
+ * the idler.
  *
  * Idlers are useful for progressively prossessing data without blocking.
  */
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_poll.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_poll.c11 Jan 2008 07:33:56 -  1.1
+++ ecore_poll.c25 Jan 2008 18:28:16 -  1.2
@@ -255,8 +255,9 @@
  * failure. The function @p func will be called at tick intervals described
  * above. The function will be passed the @p data pointer as its parameter.
  * 
- * When the poller @p func is called, it must return a value of either 1 or 0. 
- * If it returns 1, it will be called again at the next tick, or if it returns
+ * When the poller @p func is called, it must return a value of either 
+ * 1 (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL). If it 
+ * returns 1, it will be called again at the next tick, or if it returns
  * 0 it will be deleted automatically making any references/handles for it
  * invalid.
  */
==

E CVS: libs/ecore pfritz

2008-01-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_main.c 


Log Message:
typo and formating

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_main.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- ecore_main.c21 Nov 2007 12:26:38 -  1.30
+++ ecore_main.c25 Jan 2008 18:22:51 -  1.31
@@ -110,16 +110,17 @@
  *
  * Normally the return value from the @p func is "zero means this handler is
  * finished and can be deleted" as is usual for handler callbacks.  However,
- * if the @p buf_func is supplied, then the return value from the @p func is 
"non
- * zero means the handler should be called again in a tight loop".
+ * if the @p buf_func is supplied, then the return value from the @p func is 
+ * "non zero means the handler should be called again in a tight loop".
  *
  * @p buf_func is called during event loop handling to check if data that has
  * been read from the file descriptor is in a buffer and is available to
  * read.  Some systems (notably xlib) handle their own buffering, and would
  * otherwise not work with select().  These systems should use a @p buf_func.
  * This is a most annoying hack, only ecore_x uses it, so refer to that for
- * an example.  NOTE - @p func should probably return "one" always if @p 
buf_func
- * is used, to avoid confusion with the other return walue semantics.
+ * an example.  NOTE - @p func should probably return "one" always if 
+ * @p buf_func is used, to avoid confusion with the other return value 
+ * semantics.
  *
  * @param   fd   The file descriptor to watch.
  * @param   flagsTo watch it for read (@c ECORE_FD_READ) and/or



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-01-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Str.h ecore_str.c 


Log Message:
add ecore_str_has_extension()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Str.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- Ecore_Str.h 15 Mar 2007 22:21:26 -  1.9
+++ Ecore_Str.h 25 Jan 2008 18:10:46 -  1.10
@@ -46,6 +46,8 @@
 EAPI int ecore_str_has_prefix(const char *str, const char *prefix);
 
 EAPI int ecore_str_has_suffix(const char *str, const char *suffix);
+EAPI int ecore_str_has_extension(const char *str, const char *ext);
+
 EAPI char **ecore_str_split(const char *string, const char *delimiter, 
 int max_tokens);
 
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_str.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ecore_str.c 22 Aug 2007 17:44:04 -  1.9
+++ ecore_str.c 25 Jan 2008 18:10:46 -  1.10
@@ -23,6 +23,8 @@
 #include "ecore_private.h"
 #include "Ecore_Str.h"
 
+static int ecore_str_has_suffix_helper(const char *str, const char *suffix, 
+   int (*cmp)(const char *, const char *));
 /**
  * @param dst the destination
  * @param src the source
@@ -140,18 +142,47 @@
 int
 ecore_str_has_suffix(const char *str, const char *suffix)
 {
-   size_t str_len;
-   size_t suffix_len;
-
CHECK_PARAM_POINTER_RETURN("str", str, 0);
CHECK_PARAM_POINTER_RETURN("suffix", suffix, 0);
+   
+   return ecore_str_has_suffix_helper(str, suffix, strcmp);
+}
+
+/**
+ * This function does the same like ecore_str_has_suffix(), but with a
+ * case insensitive compare.
+ *
+ * @param str the string to work with
+ * @param ext the  extension to check for
+ * @return true if str has the given extension
+ * @brief checks if the string has the given extension
+ */
+int
+ecore_str_has_extension(const char *str, const char *ext)
+{
+   CHECK_PARAM_POINTER_RETURN("str", str, 0);
+   CHECK_PARAM_POINTER_RETURN("ext", ext, 0);
+   
+   return ecore_str_has_suffix_helper(str, ext, strcasecmp);
+}
+
+/*
+ * Internal helper function used by ecore_str_has_suffix() and 
+ * ecore_str_has_extension()
+ */
+static int
+ecore_str_has_suffix_helper(const char *str, const char *suffix, 
+   int (*cmp)(const char *, const char *))
+{
+   size_t str_len;
+   size_t suffix_len;
 
str_len = strlen(str);
suffix_len = strlen(suffix);
if (suffix_len > str_len)
  return 0;
 
-   return (strncmp(str + str_len - suffix_len, suffix, suffix_len) == 0);
+   return cmp(str + str_len - suffix_len, suffix) == 0;
 }
 
 /**



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-01-08 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_list.c 


Log Message:
add ecore_list_merge() and ecore_dlist_merge()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- Ecore_Data.h11 Nov 2007 17:08:20 -  1.52
+++ Ecore_Data.h8 Jan 2008 21:49:57 -   1.53
@@ -134,6 +134,8 @@
   char order);
EAPI int ecore_list_heapsort(Ecore_List *list, Ecore_Compare_Cb compare,
   char order);
+   EAPI void ecore_list_merge(Ecore_List *list, Ecore_List *l2, 
+  Ecore_Compare_Cb, char order);

/* Check to see if there is any data in the list */
EAPI int ecore_list_empty_is(Ecore_List * list);
@@ -207,6 +209,8 @@
   char order);
 # define ecore_dlist_heapsort(list, compare, order) \
ecore_list_heapsort(list, compare, order)
+   EAPI void ecore_dlist_merge(Ecore_DList *list, Ecore_DList *l2, 
+  Ecore_Compare_Cb, char order);

/* Check to see if there is any data in the list */
EAPI int ecore_dlist_empty_is(Ecore_DList * _e_dlist);
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_list.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- ecore_list.c19 Nov 2007 04:15:26 -  1.43
+++ ecore_list.c8 Jan 2008 21:49:57 -   1.44
@@ -1195,6 +1195,45 @@
return 1;
 }
 
+/**
+ * Merge the @p l2 into the @p list using the compare function @p compare.
+ * Both lists need to be sorted else a corrupt list could be the result.
+ * @param list  The list.
+ * @param l2The second list, this list will be empty after the merge
+ * @param compare   The function to compare the data of @p list and @p l2
+ * @param order The sort direction, possible values are ECORE_SORT_MIN and
+ *  ECORE_SORT_MAX
+ */
+EAPI void
+ecore_list_merge(Ecore_List *list, Ecore_List *l2, Ecore_Compare_Cb compare, 
char order)
+{
+   Ecore_List_Node *node;
+
+   CHECK_PARAM_POINTER("list", list);
+   CHECK_PARAM_POINTER("l2", l2);
+
+   if (ecore_list_empty_is(l2)) return;
+
+   if (ecore_list_empty_is(list))
+ {
+   ecore_list_append_list(list, l2);
+   return;
+ }
+   
+   if (order == ECORE_SORT_MIN)
+ order = 1;
+   else
+ order = -1;
+
+   list->first = _ecore_list_node_merge(list->first, l2->first, compare, 
order);
+   
+   if ((order * compare(list->last->data, l2->last->data)) < 0)
+ list->last = l2->last;
+
+   list->nodes += l2->nodes;
+   ecore_list_init(l2);
+}
+
 /* this is the internal recrusive function for the merge sort */
 static Ecore_List_Node *
 _ecore_list_node_mergesort(Ecore_List_Node *first, int n,
@@ -2048,6 +2087,43 @@
_ecore_list_first_goto(list);
 
return 1;
+}
+
+/**
+ * Merge the @p l2 into the @p list using the compare function @p compare.
+ * Both lists need to be sorted else a corrupt list could be the result.
+ * @param list  The list.
+ * @param l2The second list, this list will be empty after the merge
+ * @param compare   The function to compare the data of @p list and @p l2
+ * @param order The sort direction, possible values are ECORE_SORT_MIN and
+ *  ECORE_SORT_MAX
+ */
+EAPI void
+ecore_dlist_merge(Ecore_DList *list, Ecore_DList *l2, Ecore_Compare_Cb 
compare, char order)
+{
+   CHECK_PARAM_POINTER("list", list);
+   CHECK_PARAM_POINTER("l2", l2);
+
+   if (ecore_dlist_empty_is(l2)) return;
+
+   if (ecore_dlist_empty_is(list))
+ {
+   ecore_dlist_append_list(list, l2);
+   return;
+ }
+   
+   if (order == ECORE_SORT_MIN)
+ order = 1;
+   else
+ order = -1;
+
+   list->first = _ecore_dlist_node_merge(list->first, l2->first, compare, 
order);
+   
+   if ((order * compare(list->last->data, l2->last->data)) < 0)
+ list->last = l2->last;
+
+   list->nodes += l2->nodes;
+   ecore_dlist_init(l2);
 }
 
 /* this is the internal recrusive function for the merge sort */



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2008-01-06 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_file


Modified Files:
Ecore_File.h 


Log Message:
remove old api macros

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/Ecore_File.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- Ecore_File.h6 Aug 2007 20:00:28 -   1.34
+++ Ecore_File.h6 Jan 2008 15:21:00 -   1.35
@@ -71,9 +71,6 @@
EAPI int ecore_file_symlink  (const char *src, const char 
*dest);
EAPI char   *ecore_file_realpath (const char *file);
EAPI int ecore_file_unlink   (const char *file);
-/* NOTE: these aliases will be removed! DO NOT USE THEM */
-#define ecore_file_get_file(path) ecore_file_file_get(path)
-#define ecore_file_get_dir(path) ecore_file_dir_get(path)
EAPI const char *ecore_file_file_get (const char *path);
EAPI char   *ecore_file_dir_get  (const char *path);
 



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-11-06 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_path.c ecore_plugin.c 


Log Message:
*API CHANGE*
- Use Ecore_Path_Group instead of the group id
- remove the name


===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- Ecore_Data.h6 Sep 2007 22:06:32 -   1.50
+++ Ecore_Data.h6 Nov 2007 16:58:12 -   1.51
@@ -285,37 +285,37 @@
 
 
typedef struct _ecore_path_group Ecore_Path_Group;
+# define ECORE_PATH_GROUP(group) ((Ecore_Path_Group *)(group))
+
struct _ecore_path_group
  {
-   int id;
-   char *name;
Ecore_List *paths;
  };

/*
 * Create a new path group
 */
-   EAPI int ecore_path_group_new(const char *group_name);
+   EAPI Ecore_Path_Group *ecore_path_group_new(void);

/*
 * Destroy a previous path group
 */
-   EAPI void ecore_path_group_del(int group_id);
+   EAPI void ecore_path_group_del(Ecore_Path_Group *group);

/*
 * Add a directory to be searched for files
 */
-   EAPI void ecore_path_group_add(int group_id, const char *path);
+   EAPI void ecore_path_group_add(Ecore_Path_Group *group, const char *path);

/*
 * Remove a directory to be searched for files
 */
-   EAPI void ecore_path_group_remove(int group_id, const char *path);
+   EAPI void ecore_path_group_remove(Ecore_Path_Group *group, const char 
*path);

/*
 * Find the absolute path if it exists in the group of paths
 */
-   EAPI char * ecore_path_group_find(int group_id, const char *name);
+   EAPI char * ecore_path_group_find(Ecore_Path_Group *group, const char 
*name);

/*
 * Get a list of all the available files in a path set
@@ -332,7 +332,7 @@
/*
 * Load the specified plugin
 */
-   EAPI Ecore_Plugin *ecore_plugin_load(int group_id, const char *plugin, 
const char *version);
+   EAPI Ecore_Plugin *ecore_plugin_load(Ecore_Path_Group *group, const char 
*plugin, const char *version);

/*
 * Unload the specified plugin
@@ -344,7 +344,7 @@
 */
EAPI void *ecore_plugin_symbol_get(Ecore_Plugin * plugin, const char 
*symbol_name);
 
-   EAPI Ecore_List *ecore_plugin_available_get(int group_id);
+   EAPI Ecore_List *ecore_plugin_available_get(Ecore_Path_Group *group);
 
 
typedef struct _ecore_heap Ecore_Sheap;
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_path.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ecore_path.c4 Nov 2007 13:13:02 -   1.23
+++ ecore_path.c6 Nov 2007 16:58:12 -   1.24
@@ -5,11 +5,6 @@
 #include "Ecore_Data.h"
 #include "Ecore_Str.h"
 
-static Ecore_List *group_list = NULL;
-
-Ecore_Path_Group *__ecore_path_group_find(const char *name);
-Ecore_Path_Group *__ecore_path_group_find_id(int id);
-
 /**
  * @defgroup Ecore_Path_Group Path Group Functions
  *
@@ -24,118 +19,69 @@
  * @return  @c 0 on error, the integer id of the new group on success.
  * @ingroup Ecore_Path_Group
  */
-EAPI int
-ecore_path_group_new(const char *group_name)
+EAPI Ecore_Path_Group *
+ecore_path_group_new(void)
 {
-   int lastid;
Ecore_Path_Group *group;
-
-   CHECK_PARAM_POINTER_RETURN("group_name", group_name, -1);
-
-   if (!group_list)
- {
-   group_list = ecore_list_new();
-   if (!group_list) return 0;
-   lastid = 0;
- }
-   else
- {
-   Ecore_Path_Group *last;
-
-   group = __ecore_path_group_find(group_name);
-   if (group)
- return 0;
-
-   last = ecore_list_last_goto(group_list);
-   lastid = last->id;
- }
-
+   
group = (Ecore_Path_Group *)malloc(sizeof(Ecore_Path_Group));
memset(group, 0, sizeof(Ecore_Path_Group));
 
-   group->name = strdup(group_name);
-   group->id = lastid + 1;
-
-   ecore_list_append(group_list, group);
-
-   return group->id;
+   return group;
 }
 
 /**
  * Destroys a previously created path group
- * @param   group_id The unique identifier for the group.
+ * @param   group The group to delete.
  * @ingroup Ecore_Path_Group
  */
 EAPI void
-ecore_path_group_del(int group_id)
+ecore_path_group_del(Ecore_Path_Group *group)
 {
-   Ecore_Path_Group *group;
-
-   group = __ecore_path_group_find_id(group_id);
-
-   if (!group)
- return;
+   CHECK_PARAM_POINTER("group", group);
 
if (group->paths)
- {
-   ecore_list_for_each(group->paths, ECORE_FOR_EACH(free), NULL);
-   ecore_list_destroy(group->paths);
- }
-
-   if (ecore_list_goto(group_list, group))
- ecore_list_remove(group_list);
-
-   if (ecore_list_empty_is(group_list))
- {
-   ecore_list_destroy(group_list);
-   group_list = NULL;
- }
+ ecore_list_dest

E CVS: libs/ecore pfritz

2007-11-05 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore


Modified Files:
ecore-file.pc.in 


Log Message:
remove @fam_libs@, thanks to Jochen Schroeder

===
RCS file: /cvs/e/e17/libs/ecore/ecore-file.pc.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore-file.pc.in21 Mar 2007 15:30:23 -  1.1
+++ ecore-file.pc.in5 Nov 2007 22:50:42 -   1.2
@@ -7,5 +7,5 @@
 Description: E core library, File module
 Requires: ecore @requirements_ecore_file@
 Version: @VERSION@
-Libs: -L${libdir} -lecore_file @fam_libs@
+Libs: -L${libdir} -lecore_file
 Cflags: -I${includedir}



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-10-27 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_private.h 


Log Message:
typo

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_private.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -3 -r1.44 -r1.45
--- ecore_private.h 26 Aug 2007 11:17:21 -  1.44
+++ ecore_private.h 27 Oct 2007 16:22:10 -  1.45
@@ -95,7 +95,7 @@
 #define ECORE_MAGIC_CHECK(d, m) ((d) && ((d)->__magic == (m)))
 #define ECORE_MAGIC_FAIL(d, m, fn)  _ecore_magic_fail((d), (d) ? (d)->__magic 
: 0, (m), (fn));
 
-/* undef the following, we want out version */
+/* undef the following, we want our version */
 #undef FREE
 #define FREE(ptr) free(ptr); ptr = NULL;
 



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-09-06 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h 


Log Message:
add #defines for ecore_dlist_first() and ecore_dlist_last()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- Ecore_Data.h4 Sep 2007 18:23:47 -   1.49
+++ Ecore_Data.h6 Sep 2007 22:06:32 -   1.50
@@ -176,6 +176,8 @@
EAPI int ecore_dlist_prepend_list(Ecore_DList * _e_dlist, Ecore_DList * 
prepend);

/* Info about list's state */
+# define ecore_dlist_first(list) ecore_list_first(ECORE_LIST(list))
+# define ecore_dlist_last(list) ecore_list_last(ECORE_LIST(list))
EAPI void *ecore_dlist_current(Ecore_DList *list);
EAPI int ecore_dlist_index(Ecore_DList *list);
 # define ecore_dlist_count(list) ecore_list_count(ECORE_LIST(list))



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-09-05 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_path.c 


Log Message:
don't leak

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_path.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ecore_path.c4 Sep 2007 18:23:47 -   1.16
+++ ecore_path.c5 Sep 2007 09:46:56 -   1.17
@@ -339,7 +339,9 @@
  ecore_hash_set(plugins, key, key);
   }
  }
+   closedir(dir);
  }
+
ecore_hash_free_key_cb_set(plugins, NULL);
avail = ecore_hash_keys(plugins);
ecore_list_free_cb_set(avail, free);



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-09-04 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_path.c ecore_plugin.c 


Log Message:
*API BREAK*
rename ecore_plugin_call() to ecore_plugin_symbol_get()
add a version argument to ecore_plugin_load(); it makes it possible to have 
different versions for the interface. NULL gives you the old behaivor

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- Ecore_Data.h2 Sep 2007 12:21:00 -   1.48
+++ Ecore_Data.h4 Sep 2007 18:23:47 -   1.49
@@ -324,15 +324,13 @@
typedef struct _ecore_plugin Ecore_Plugin;
struct _ecore_plugin
  {
-   int group;
-   char *name;
void *handle;
  };

/*
 * Load the specified plugin
 */
-   EAPI Ecore_Plugin *ecore_plugin_load(int group_id, const char *plugin);
+   EAPI Ecore_Plugin *ecore_plugin_load(int group_id, const char *plugin, 
const char *version);

/*
 * Unload the specified plugin
@@ -342,8 +340,8 @@
/*
 * Lookup the specified symbol for the plugin
 */
-   EAPI void *ecore_plugin_call(Ecore_Plugin * plugin, const char 
*symbol_name);
-   
+   EAPI void *ecore_plugin_symbol_get(Ecore_Plugin * plugin, const char 
*symbol_name);
+
EAPI Ecore_List *ecore_plugin_available_get(int group_id);
 
 
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_path.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ecore_path.c2 Sep 2007 17:54:16 -   1.15
+++ ecore_path.c4 Sep 2007 18:23:47 -   1.16
@@ -331,7 +331,13 @@
 ext = strrchr(ppath, '.');
 *ext = '\0';
 
-ecore_hash_set(plugins, strdup(ppath), (void *)1);
+if (!ecore_hash_get(plugins, ppath))
+  {
+ char *key;
+
+ key = strdup(ppath);
+ ecore_hash_set(plugins, key, key);
+  }
  }
  }
ecore_hash_free_key_cb_set(plugins, NULL);
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_plugin.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ecore_plugin.c  26 Aug 2007 11:17:21 -  1.13
+++ ecore_plugin.c  4 Sep 2007 18:23:47 -   1.14
@@ -1,3 +1,6 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
 #ifndef _WIN32
 # include 
 # include "ecore_private.h"
@@ -15,12 +18,14 @@
  * Loads the specified plugin from the specified path group.
  * @param   group_idThe path group to search for the plugin to load
  * @param   plugin_name The name of the plugin to load.
+ * @param   version The interface version of the plugin. With version
+ *  equal to NULL the default will be loaded.
  * @return  A pointer to the newly loaded plugin on success, @c NULL on
  *  failure.
  * @ingroup Ecore_Plugin
  */
 EAPI Ecore_Plugin *
-ecore_plugin_load(int group_id, const char *plugin_name)
+ecore_plugin_load(int group_id, const char *plugin_name, const char *version)
 {
char *path;
char temp[PATH_MAX];
@@ -30,14 +35,28 @@
 
CHECK_PARAM_POINTER_RETURN("plugin_name", plugin_name, NULL);
 
-   snprintf(temp, PATH_MAX, "%s.so", plugin_name);
+   if (!version || *version == '\0')
+ snprintf(temp, sizeof(temp), "%s.so", plugin_name);
+   else
+ snprintf(temp, sizeof(temp), "%s.so.%s", plugin_name, version);
+
path = ecore_path_group_find(group_id, temp);
+   if (!path && version)
+ {
+   /* if this file doesn't exist try a different order */
+   snprintf(temp, sizeof(temp), "%s.%s.so", plugin_name, version);
+   path = ecore_path_group_find(group_id, temp);
+ }
+   
if (!path)
  return NULL;
 
handle = dlopen(path, RTLD_LAZY);
if (!handle)
- return NULL;
+ {
+   FREE(path);
+   return NULL;
+ }
 
/*
 * Allocate the new plugin and initialize it's fields
@@ -46,12 +65,11 @@
if (!plugin)
  {
dlclose(handle);
+   FREE(path);
return NULL;
  }
memset(plugin, 0, sizeof(Ecore_Plugin));
 
-   plugin->group = group_id;
-   plugin->name = strdup(plugin_name);
plugin->handle = handle;
 
/*
@@ -91,7 +109,6 @@
 
dlclose(plugin->handle);
 
-   FREE(plugin->name);
FREE(plugin);
 }
 
@@ -103,7 +120,7 @@
  * @ingroup Ecore_Plugin
  */
 EAPI void *
-ecore_plugin_call(Ecore_Plugin *plugin, const char *symbol_name)
+ecore_plugin_symbol_get(Ecore_Plugin *plugin, const char *symbol_name)
 {
void *ret;
 



-
This SF.net email is sponsored by: Splunk Inc.
Still g

E CVS: libs/ecore pfritz

2007-09-02 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_path.c 


Log Message:
- implement ecore_plugin_available_get()
- fix ecore_path_group_new()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_path.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ecore_path.c2 Sep 2007 12:21:00 -   1.14
+++ ecore_path.c2 Sep 2007 17:54:16 -   1.15
@@ -1,5 +1,9 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
 #include "ecore_private.h"
 #include "Ecore_Data.h"
+#include "Ecore_Str.h"
 
 static Ecore_List *group_list = NULL;
 
@@ -23,28 +27,35 @@
 EAPI int
 ecore_path_group_new(const char *group_name)
 {
-   Ecore_Path_Group *last;
+   int lastid;
Ecore_Path_Group *group;
 
CHECK_PARAM_POINTER_RETURN("group_name", group_name, -1);
 
if (!group_list)
- group_list = ecore_list_new();
+ {
+   group_list = ecore_list_new();
+   lastid = 0;
+ }
else
  {
+   Ecore_Path_Group *last;
+
group = __ecore_path_group_find(group_name);
if (group)
  return -1;
+
+   last = ecore_list_last_goto(group_list);
+   lastid = last->id;
  }
 
group = (Ecore_Path_Group *)malloc(sizeof(Ecore_Path_Group));
memset(group, 0, sizeof(Ecore_Path_Group));
 
group->name = strdup(group_name);
-   ecore_list_append(group_list, group);
+   group->id = lastid + 1;
 
-   last = ecore_list_last_goto(group_list);
-   group->id = last->id + 1;
+   ecore_list_append(group_list, group);
 
return group->id;
 }
@@ -258,6 +269,78 @@
return avail;
 }
 
+/**
+ * Retrieves a list of all available plugins in the given path.
+ * @param   group_id The identifier for the given path.
+ * @return  A pointer to a newly allocated list of all plugins found in the 
+ *  paths identified by @p group_id.  @c NULL otherwise.
+ * @ingroup Ecore_Plugin
+ */
+EAPI Ecore_List *
+ecore_plugin_available_get(int group_id)
+{
+   Ecore_List *avail = NULL;
+   Ecore_Hash *plugins = NULL;
+   Ecore_Path_Group *group;
+   char *path;
+
+   group = __ecore_path_group_find_id(group_id);
+
+   if (!group || !group->paths || ecore_list_empty_is(group->paths))
+ return NULL;
+
+   ecore_list_first_goto(group->paths);
+   plugins = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+   ecore_hash_free_key_cb_set(plugins, free);
+
+   while ((path = ecore_list_next(group->paths)) != NULL)
+ {
+   DIR *dir;
+   struct stat st;
+   struct dirent *d;
+
+   stat(path, &st);
+
+   if (!S_ISDIR(st.st_mode))
+ continue;
+
+   dir = opendir(path);
+
+   if (!dir)
+ continue;
+
+   while ((d = readdir(dir)) != NULL)
+ {
+char ppath[PATH_MAX];
+char *ext;
+
+if (*d->d_name == '.')
+  continue;
+
+if (!ecore_str_has_suffix(d->d_name, ".so"))
+  continue;
+
+snprintf(ppath, PATH_MAX, "%s/%s", path, d->d_name);
+
+stat(ppath, &st);
+
+if (!S_ISREG(st.st_mode))
+  continue;
+
+ecore_strlcpy(ppath, d->d_name, sizeof(ppath));
+ext = strrchr(ppath, '.');
+*ext = '\0';
+
+ecore_hash_set(plugins, strdup(ppath), (void *)1);
+ }
+ }
+   ecore_hash_free_key_cb_set(plugins, NULL);
+   avail = ecore_hash_keys(plugins);
+   ecore_list_free_cb_set(avail, free);
+   ecore_hash_destroy(plugins);
+
+   return avail;
+}
 /*
  * Find the specified group name
  */



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-09-02 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_hash.c 


Log Message:
NULL is a valid value, it's actually the default

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_hash.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- ecore_hash.c25 Jul 2007 17:00:54 -  1.40
+++ ecore_hash.c2 Sep 2007 17:44:38 -   1.41
@@ -96,7 +96,8 @@
 /**
  * Sets the function to destroy the keys of the given hash.
  * @param   hash The given hash.
- * @param   function The function used to free the node keys.
+ * @param   function The function used to free the node keys. NULL is a
+ *  valid value and means that no function will be called.
  * @return  @c TRUE on success, @c FALSE on error.
  * @ingroup Ecore_Data_Hash_ADT_Destruction_Group
  */
@@ -104,7 +105,6 @@
 ecore_hash_free_key_cb_set(Ecore_Hash *hash, Ecore_Free_Cb function)
 {
CHECK_PARAM_POINTER_RETURN("hash", hash, FALSE);
-   CHECK_PARAM_POINTER_RETURN("function", function, FALSE);
 
hash->free_key = function;
 
@@ -114,7 +114,8 @@
 /**
  * Sets the function to destroy the values in the given hash.
  * @param   hash The given hash.
- * @param   function The function that will free the node values.
+ * @param   function The function that will free the node values. NULL is a
+ *  valid value and means that no function will be called.
  * @return  @c TRUE on success, @c FALSE on error
  * @ingroup Ecore_Data_Hash_ADT_Destruction_Group
  */
@@ -122,7 +123,6 @@
 ecore_hash_free_value_cb_set(Ecore_Hash *hash, Ecore_Free_Cb function)
 {
CHECK_PARAM_POINTER_RETURN("hash", hash, FALSE);
-   CHECK_PARAM_POINTER_RETURN("function", function, FALSE);
 
hash->free_value = function;
 



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-09-02 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_path.c 


Log Message:
add constness

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- Ecore_Data.h19 Aug 2007 17:20:06 -  1.47
+++ Ecore_Data.h2 Sep 2007 12:21:00 -   1.48
@@ -293,7 +293,7 @@
/*
 * Create a new path group
 */
-   EAPI int ecore_path_group_new(char *group_name);
+   EAPI int ecore_path_group_new(const char *group_name);

/*
 * Destroy a previous path group
@@ -303,17 +303,17 @@
/*
 * Add a directory to be searched for files
 */
-   EAPI void ecore_path_group_add(int group_id, char *path);
+   EAPI void ecore_path_group_add(int group_id, const char *path);

/*
 * Remove a directory to be searched for files
 */
-   EAPI void ecore_path_group_remove(int group_id, char *path);
+   EAPI void ecore_path_group_remove(int group_id, const char *path);

/*
 * Find the absolute path if it exists in the group of paths
 */
-   EAPI char * ecore_path_group_find(int group_id, char *name);
+   EAPI char * ecore_path_group_find(int group_id, const char *name);

/*
 * Get a list of all the available files in a path set
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_path.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ecore_path.c25 Jul 2007 17:00:54 -  1.13
+++ ecore_path.c2 Sep 2007 12:21:00 -   1.14
@@ -3,7 +3,7 @@
 
 static Ecore_List *group_list = NULL;
 
-Ecore_Path_Group *__ecore_path_group_find(char *name);
+Ecore_Path_Group *__ecore_path_group_find(const char *name);
 Ecore_Path_Group *__ecore_path_group_find_id(int id);
 
 /**
@@ -21,7 +21,7 @@
  * @ingroup Ecore_Path_Group
  */
 EAPI int
-ecore_path_group_new(char *group_name)
+ecore_path_group_new(const char *group_name)
 {
Ecore_Path_Group *last;
Ecore_Path_Group *group;
@@ -90,7 +90,7 @@
  * @ingroup Ecore_Path_Group
  */
 EAPI void
-ecore_path_group_add(int group_id, char *path)
+ecore_path_group_add(int group_id, const char *path)
 {
Ecore_Path_Group *group;
 
@@ -114,7 +114,7 @@
  * @ingroup Ecore_Path_Group
  */
 EAPI void
-ecore_path_group_remove(int group_id, char *path)
+ecore_path_group_remove(int group_id, const char *path)
 {
char *found;
Ecore_Path_Group *group;
@@ -153,7 +153,7 @@
  * @ingroup Ecore_Path_Group
  */
 EAPI char *
-ecore_path_group_find(int group_id, char *name)
+ecore_path_group_find(int group_id, const char *name)
 {
int r;
char *p;
@@ -262,7 +262,7 @@
  * Find the specified group name
  */
 Ecore_Path_Group *
-__ecore_path_group_find(char *name)
+__ecore_path_group_find(const char *name)
 {
Ecore_Path_Group *group;
 



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-08-19 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h 


Log Message:
the time is over, remove the obsolete function name aliases

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- Ecore_Data.h25 Jul 2007 17:00:54 -  1.46
+++ Ecore_Data.h19 Aug 2007 17:20:06 -  1.47
@@ -25,38 +25,6 @@
 /* we need this for size_t */
 #include 
 
-/* NOTE: these aliases will be removed! DO NOT USE THEM! */
-#define ecore_list_nodes(l) ecore_list_count(l)
-#define ecore_list_is_empty(l) ecore_list_empty_is(l)
-#define ecore_list_set_free_cb(l, f) ecore_list_free_cb_set(l, f)
-#define ecore_dlist_nodes(l) ecore_dlist_count(l)
-#define ecore_dlist_is_empty(l) ecore_dlist_empty_is(l)
-#define ecore_dlist_set_free_cb(l, f) ecore_dlist_free_cb_set(l, f)
-#define ecore_hash_set_free_key(l, f) ecore_hash_free_key_cb_set(l, f)
-#define ecore_hash_set_free_value(l, f) ecore_hash_free_value_cb_set(l, f)
-#define ecore_hash_set_hash(l, k, v) ecore_hash_hash_set(l, k, v)
-#define ecore_plugin_get_available(id) ecore_plugin_available_get(id)
-#define ecore_sheap_set_free_cb(s, f) ecore_sheap_free_cb_set(s, f)
-#define ecore_sheap_set_compare(s, f) ecore_sheap_compare_set(s, f)
-#define ecore_sheap_set_order(s, o) ecore_sheap_order_set(s, o)
-#define ecore_tree_is_empty(t) ecore_tree_empty_is(t)
-#define ecore_tree_get_closest_larger(t) ecore_tree_closest_larger_get(t)
-#define ecore_tree_get_closest_smaller(t) ecore_tree_closest_smaller_get(t)
-#define ecore_tree_add_node(t, n) ecore_tree_node_add(t, n);
-#define ecore_tree_remove_node(t, n) ecore_tree_node_remove(t, n)
-#define ecore_tree_set_free_value(t, f) ecore_tree_free_value_cb_set(t, f)
-#define ecore_tree_set_free_key(t, f) ecore_tree_free_key_cb_set(t, f)
-#define ecore_list_remove_first(l) ecore_list_first_remove(l)
-#define ecore_list_remove_last(l) ecore_list_last_remove(l)
-#define ecore_list_goto_first(l) ecore_list_first_goto(l)
-#define ecore_list_goto_last(l) ecore_list_last_goto(l)
-#define ecore_list_goto_index(l) ecore_list_index_goto(l)
-#define ecore_dlist_remove_first(l) ecore_dlist_first_remove(l)
-#define ecore_dlist_remove_last(l) ecore_dlist_last_remove(l)
-#define ecore_dlist_goto_first(l) ecore_dlist_first_goto(l)
-#define ecore_dlist_goto_last(l) ecore_dlist_last_goto(l)
-#define ecore_dlist_goto_index(l) ecore_dlist_index_goto(l)
-
 /**
  * @file Ecore_Data.h
  * @brief Contains threading, list, hash, debugging and tree functions.



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-08-10 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_file


Modified Files:
ecore_file.c 


Log Message:
more docs

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- ecore_file.c10 Aug 2007 14:15:14 -  1.67
+++ ecore_file.c10 Aug 2007 16:01:59 -  1.68
@@ -324,7 +324,8 @@
 /**
  * Get the canonicalized absolute pathname
  * @param  file The file path
- * @return The canonicalized absolute pathname
+ * @return The canonicalized absolute pathname; on failure it will return
+ * an empty string
  */
 EAPI char *
 ecore_file_realpath(const char *file)
@@ -621,7 +622,8 @@
 /**
  * Add the escape sequence ('\\') to the given filename
  * @param  filename The file name
- * @return The file name with special characters escaped
+ * @return The file name with special characters escaped; if the length of the
+ * resulting string is longer than PATH_MAX it will return NULL
  */
 EAPI char *
 ecore_file_escape_name(const char *filename)



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-08-10 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_file


Modified Files:
ecore_file.c 


Log Message:
add some docs

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -3 -r1.66 -r1.67
--- ecore_file.c6 Aug 2007 20:00:28 -   1.66
+++ ecore_file.c10 Aug 2007 14:15:14 -  1.67
@@ -17,6 +17,12 @@
 static int init = 0;
 
 /* externally accessible functions */
+/**
+ * Initialize Ecore_File and the services it will use. Call this function
+ * once before you use any of the ecore file functions.
+ * @return Return the number howoften ecore_file_init() was call succesfully;
+ * 0 if it failed.
+ */
 EAPI int
 ecore_file_init()
 {
@@ -39,6 +45,10 @@
return --init;
 }
 
+/**
+ * Shutdown the Ecore_File
+ * @return returns the number of libraries that still uses Ecore_File
+ */
 EAPI int
 ecore_file_shutdown()
 {
@@ -51,6 +61,12 @@
return init;
 }
 
+/**
+ * Get the time of the last modification to the give file
+ * @param file The name of the file
+ * @return Return the time of the last data modification, if an error should 
+ * occur it will return 0
+ */
 EAPI long long
 ecore_file_mod_time(const char *file)
 {
@@ -415,9 +431,14 @@
 }
 
 /**
- * Get the list of the files in a given directory
+ * Get the list of the files and directories in a given directory. The list 
+ * will be sorted with strcoll as compare function. That means that you may
+ * want to set the current locale for the category LC_COLLATE with setlocale().
+ * For more information see the manual pages of strcoll and setlocale.
+ * The list will not contain the directory entries for '.' and '..'.
  * @param  dir The name of the directory to list
- * @return An Ecore_List containing all the file in the directory
+ * @return Return an Ecore_List containing all the files in the directory; 
+ * on failure it returns NULL.
  */
 EAPI Ecore_List *
 ecore_file_ls(const char *dir)
@@ -449,6 +470,9 @@
return list;
 }
 
+/**
+ * FIXME: To be documented.
+ */
 EAPI char *
 ecore_file_app_exe_get(const char *app)
 {



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-08-02 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_strings.c 


Log Message:
put Nathan's mail into the doxy

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_strings.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ecore_strings.c 25 Jul 2007 17:00:54 -  1.17
+++ ecore_strings.c 2 Aug 2007 18:08:04 -   1.18
@@ -11,6 +11,19 @@
  *
  * 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.
  */
 
 /**



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-07-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_desktop


Modified Files:
ecore_desktop.c ecore_desktop_icon.c ecore_desktop_menu.c 
ecore_desktop_paths.c 


Log Message:
*API BREAK* see the discussion in the mailing list. misc and e_modules will 
follow

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- ecore_desktop.c 20 Feb 2007 10:12:45 -  1.72
+++ ecore_desktop.c 25 Jul 2007 17:00:55 -  1.73
@@ -60,8 +60,8 @@
ecore_hash_destroy(result);
return NULL;
  }
-   ecore_hash_set_free_key(result, free);
-   ecore_hash_set_free_value(result, (Ecore_Free_Cb) ecore_hash_destroy);
+   ecore_hash_free_key_cb_set(result, free);
+   ecore_hash_free_value_cb_set(result, (Ecore_Free_Cb) ecore_hash_destroy);
*buffer = '\0';
 #ifdef DEBUG
fprintf(stdout, "PARSING INI %s\n", file);
@@ -87,8 +87,8 @@
 current = ecore_hash_new(ecore_str_hash, ecore_str_compare);
 if (current)
   {
- ecore_hash_set_free_key(current, free);
- ecore_hash_set_free_value(current, free);
+ ecore_hash_free_key_cb_set(current, free);
+ ecore_hash_free_value_cb_set(current, free);
  ecore_hash_set(result, strdup(key), current);
 #ifdef DEBUG
  fprintf(stdout, "  GROUP [%s]\n", key);
@@ -222,7 +222,7 @@
  {
 int size = 0;
 
-value = (char *) ecore_file_get_file(result->original_path);
+value = (char *) ecore_file_file_get(result->original_path);
 /* Figure out the eap_name. */
 if (value)
   {
@@ -275,7 +275,7 @@
{
   char   *p;
 
-  value = (char *)ecore_file_get_file(tmp);/* In 
case the exe included a path. */
+  value = (char *)ecore_file_file_get(tmp);/* In 
case the exe included a path. */
   p = value;
   while ((*p != '\0') && (*p != ' '))
 {
@@ -322,7 +322,7 @@
char   *dir;
 
dir =
-  ecore_file_get_dir(result->original_path);
+  ecore_file_dir_get(result->original_path);
if (dir)
  {
 sprintf(temp, "%s/%s", dir, result->icon);
@@ -383,7 +383,7 @@
 {
char   *tmp;
 
-   tmp = strdup(ecore_file_get_file(result->exec));
+   tmp = strdup(ecore_file_file_get(result->exec));
if (tmp)
  {
 char   *p2;
@@ -534,8 +534,8 @@
 desktop->group = ecore_hash_new(ecore_str_hash, ecore_str_compare);
 if (desktop->group)
   {
- ecore_hash_set_free_key(desktop->group, free);
- ecore_hash_set_free_value(desktop->group, free);
+ ecore_hash_free_key_cb_set(desktop->group, free);
+ ecore_hash_free_value_cb_set(desktop->group, free);
   }
  }
  }
@@ -669,7 +669,7 @@
fprintf(f, "[Trash Info]\n");
 else
fprintf(f, "[Desktop Entry]\n");
-ecore_list_goto_first(list);
+ecore_list_first_goto(list);
 while ((key = (char *)ecore_list_next(list)))
   {
  char   *value;
@@ -714,8 +714,8 @@
desktop_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
if (desktop_cache)
  {
-ecore_hash_set_free_key(desktop_cache, free);
-ecore_hash_set_free_value(desktop_cache,
+ecore_hash_free_key_cb_set(desktop_cache, free);
+ecore_hash_free_value_cb_set(desktop_cache,
   (Ecore_Free_Cb) _ecore_desktop_destroy);
  }
  }
@@ -847,7 +847,7 @@
 
result = ecore_list_new();
if (!result) return NULL;
-   ecore_list_set_free_cb(result, free);
+   ecore_list_free_cb_set(result, free);
 
if (desktop->exec_params)
   params = strdup(desktop->exec_params);
@@ -857,14 +857,14 @@
   {
  char *file;
 
- ecore_list_goto_first(files);
+ ecore_list_first_goto(files);
  while((file = ecore_list_next(files)) != NULL)
 printf("FILE FOR COMMAND IS - %s\n", file);
   }
 #endif
 
if (files)
-  ecore_list_goto_first(files);
+  ecore_list_first_goto(files);
 
/* FIXME: The string handlin

E CVS: libs/ecore pfritz

2007-07-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_evas


Modified Files:
ecore_evas_fb.c 


Log Message:
*API BREAK* see the discussion in the mailing list. misc and e_modules will 
follow

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_evas/ecore_evas_fb.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ecore_evas_fb.c 17 Jun 2007 03:41:43 -  1.26
+++ ecore_evas_fb.c 25 Jul 2007 17:00:55 -  1.27
@@ -74,7 +74,7 @@
ee = (Ecore_Evas *)l;
ee->visible = 0;
  }
-   ecore_list_goto_first(ecore_evas_input_devices);
+   ecore_list_first_goto(ecore_evas_input_devices);
dev = ecore_list_current(ecore_evas_input_devices);
do
{
@@ -99,7 +99,7 @@
else
  evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
  }
-   ecore_list_goto_first(ecore_evas_input_devices);
+   ecore_list_first_goto(ecore_evas_input_devices);
dev = ecore_list_current(ecore_evas_input_devices);
do
{
@@ -486,7 +486,7 @@
{
   Ecore_Fb_Input_Device *dev;
 
-  ecore_list_goto_first(ecore_evas_input_devices);
+  ecore_list_first_goto(ecore_evas_input_devices);
   dev = ecore_list_current(ecore_evas_input_devices);
   do
   {



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-07-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_con


Modified Files:
ecore_con.c ecore_con_url.c 


Log Message:
*API BREAK* see the discussion in the mailing list. misc and e_modules will 
follow

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- ecore_con.c 16 Feb 2007 18:12:38 -  1.84
+++ ecore_con.c 25 Jul 2007 17:00:55 -  1.85
@@ -102,8 +102,8 @@
 {
if (--init_count != 0) return init_count;
 
-   while (!ecore_list_is_empty(servers))
- _ecore_con_server_free(ecore_list_remove_first(servers));
+   while (!ecore_list_empty_is(servers))
+ _ecore_con_server_free(ecore_list_first_remove(servers));
ecore_list_destroy(servers);
servers = NULL;
 
@@ -974,8 +974,8 @@
  }
  }
if (svr->write_buf) free(svr->write_buf);
-   while (!ecore_list_is_empty(svr->clients))
- _ecore_con_client_free(ecore_list_remove_first(svr->clients));
+   while (!ecore_list_empty_is(svr->clients))
+ _ecore_con_client_free(ecore_list_first_remove(svr->clients));
ecore_list_destroy(svr->clients);
if ((svr->created) && (svr->path) && (svr->ppid == getpid())) 
unlink(svr->path);
if (svr->fd >= 0) close(svr->fd);
@@ -1034,7 +1034,7 @@
if (svr->delete_me) return 1;
if ((svr->client_limit >= 0) && (!svr->reject_excess_clients))
  {
-   if (ecore_list_nodes(svr->clients) >= svr->client_limit) return 1;
+   if (ecore_list_count(svr->clients) >= svr->client_limit) return 1;
  }
/* a new client */
size_in = sizeof(struct sockaddr_in);
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con_url.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ecore_con_url.c 10 Feb 2007 17:23:05 -  1.13
+++ ecore_con_url.c 25 Jul 2007 17:00:55 -  1.14
@@ -109,10 +109,10 @@
init_count--;
if (_url_con_list)
  {
-   if (!ecore_list_is_empty(_url_con_list))
+   if (!ecore_list_empty_is(_url_con_list))
  {
 Ecore_Con_Url *url_con;
-while ((url_con = ecore_list_remove_first(_url_con_list)))
+while ((url_con = ecore_list_first_remove(_url_con_list)))
   {
  ecore_con_url_destroy(url_con);
   }
@@ -356,7 +356,7 @@
if (curlmsg->msg != CURLMSG_DONE) continue;
 
/* find the job which is done */
-   ecore_list_goto_first(_url_con_list);
+   ecore_list_first_goto(_url_con_list);
while ((url_con = ecore_list_current(_url_con_list)))
  {
 if (curlmsg->easy_handle == url_con->curl_easy)



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-07-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_file


Modified Files:
Ecore_File.h ecore_file.c ecore_file_download.c 
ecore_file_path.c 


Log Message:
*API BREAK* see the discussion in the mailing list. misc and e_modules will 
follow

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/Ecore_File.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- Ecore_File.h2 Jun 2007 16:33:42 -   1.32
+++ Ecore_File.h25 Jul 2007 17:00:55 -  1.33
@@ -66,8 +66,11 @@
EAPI int ecore_file_symlink  (const char *src, const char 
*dest);
EAPI char   *ecore_file_realpath (const char *file);
EAPI int ecore_file_unlink   (const char *file);
-   EAPI const char *ecore_file_get_file (const char *path);
-   EAPI char   *ecore_file_get_dir  (const char *path);
+/* NOTE: these aliases will be removed! DO NOT USE THEM */
+#define ecore_file_get_file(path) ecore_file_file_get(path)
+#define ecore_file_get_dir(path) ecore_file_dir_get(path)
+   EAPI const char *ecore_file_file_get (const char *path);
+   EAPI char   *ecore_file_dir_get  (const char *path);
 
EAPI int ecore_file_can_read (const char *file);
EAPI int ecore_file_can_write(const char *file);
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- ecore_file.c5 Jun 2007 22:12:10 -   1.64
+++ ecore_file.c25 Jul 2007 17:00:55 -  1.65
@@ -254,7 +254,7 @@
 }
 
 EAPI const char *
-ecore_file_get_file(const char *path)
+ecore_file_file_get(const char *path)
 {
char *result = NULL;
 
@@ -265,7 +265,7 @@
 }
 
 EAPI char *
-ecore_file_get_dir(const char *file)
+ecore_file_dir_get(const char *file)
 {
char   *p;
charbuf[PATH_MAX];
@@ -330,7 +330,7 @@
if (!dirp) return NULL;
 
list = ecore_list_new();
-   ecore_list_set_free_cb(list, free);
+   ecore_list_free_cb_set(list, free);
 
while ((dp = readdir(dirp)))
  {
@@ -344,7 +344,7 @@

ecore_list_sort(list, ECORE_COMPARE_CB(strcoll), ECORE_SORT_MIN);
 
-   ecore_list_goto_first(list);
+   ecore_list_first_goto(list);
return list;
 }
 
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file_download.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ecore_file_download.c   16 Jan 2007 10:17:46 -  1.14
+++ ecore_file_download.c   25 Jul 2007 17:00:55 -  1.15
@@ -62,9 +62,9 @@
 #ifdef HAVE_CURL
Ecore_File_Download_Job *job;
 
-   if (!ecore_list_is_empty(_job_list))
+   if (!ecore_list_empty_is(_job_list))
  {
-   ecore_list_goto_first(_job_list);
+   ecore_list_first_goto(_job_list);
while ((job = ecore_list_next(_job_list)))
  {
 ecore_main_fd_handler_del(job->fd_handler);
@@ -91,7 +91,7 @@
if (!_job_list)
  return;

-   ecore_list_goto_first(_job_list);
+   ecore_list_first_goto(_job_list);
while ((job = ecore_list_next(_job_list)))
  {
ecore_main_fd_handler_del(job->fd_handler);
@@ -111,7 +111,7 @@
int (*progress_cb)(void *data, const char *file, long int 
dltotal, long int dlnow, long int ultotal, long int ulnow),
void *data)
 {
-   if (!ecore_file_is_dir(ecore_file_get_dir((char *)dst))) return 0;
+   if (!ecore_file_is_dir(ecore_file_dir_get((char *)dst))) return 0;
if (ecore_file_exists(dst)) return 0;
 
/* FIXME: Add handlers for http and ftp! */
@@ -249,7 +249,7 @@
if (curlmsg->msg != CURLMSG_DONE) continue;
 
/* find the job which is done */
-   ecore_list_goto_first(_job_list);
+   ecore_list_first_goto(_job_list);
while ((current = ecore_list_current(_job_list)))
  {
 if (curlmsg->easy_handle == current->curl)
@@ -335,7 +335,7 @@
if (curlmsg->msg != CURLMSG_DONE) continue;
 
/* find the job which is done */
-   ecore_list_goto_first(_job_list);
+   ecore_list_first_goto(_job_list);
while ((job = ecore_list_current(_job_list)))
  {
 if (curlmsg->easy_handle == job->curl)
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file_path.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ecore_file_path.c   19 Jan 2007 14:02:34 -  1.20
+++ ecore_file_path.c   25 Jul 2007 17:00:55 -  1.21
@@ -13,7 +13,7 @@
 {
if (++init != 1) return init;
__ecore_file_path_bin = _ecore_file_path_from_env("PATH"

E CVS: libs/ecore pfritz

2007-07-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_hash.c ecore_list.c ecore_path.c 
ecore_plugin.c ecore_sheap.c ecore_strings.c ecore_tree.c 


Log Message:
*API BREAK* see the discussion in the mailing list. misc and e_modules will 
follow

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- Ecore_Data.h27 Jun 2007 10:57:54 -  1.45
+++ Ecore_Data.h25 Jul 2007 17:00:54 -  1.46
@@ -25,6 +25,38 @@
 /* we need this for size_t */
 #include 
 
+/* NOTE: these aliases will be removed! DO NOT USE THEM! */
+#define ecore_list_nodes(l) ecore_list_count(l)
+#define ecore_list_is_empty(l) ecore_list_empty_is(l)
+#define ecore_list_set_free_cb(l, f) ecore_list_free_cb_set(l, f)
+#define ecore_dlist_nodes(l) ecore_dlist_count(l)
+#define ecore_dlist_is_empty(l) ecore_dlist_empty_is(l)
+#define ecore_dlist_set_free_cb(l, f) ecore_dlist_free_cb_set(l, f)
+#define ecore_hash_set_free_key(l, f) ecore_hash_free_key_cb_set(l, f)
+#define ecore_hash_set_free_value(l, f) ecore_hash_free_value_cb_set(l, f)
+#define ecore_hash_set_hash(l, k, v) ecore_hash_hash_set(l, k, v)
+#define ecore_plugin_get_available(id) ecore_plugin_available_get(id)
+#define ecore_sheap_set_free_cb(s, f) ecore_sheap_free_cb_set(s, f)
+#define ecore_sheap_set_compare(s, f) ecore_sheap_compare_set(s, f)
+#define ecore_sheap_set_order(s, o) ecore_sheap_order_set(s, o)
+#define ecore_tree_is_empty(t) ecore_tree_empty_is(t)
+#define ecore_tree_get_closest_larger(t) ecore_tree_closest_larger_get(t)
+#define ecore_tree_get_closest_smaller(t) ecore_tree_closest_smaller_get(t)
+#define ecore_tree_add_node(t, n) ecore_tree_node_add(t, n);
+#define ecore_tree_remove_node(t, n) ecore_tree_node_remove(t, n)
+#define ecore_tree_set_free_value(t, f) ecore_tree_free_value_cb_set(t, f)
+#define ecore_tree_set_free_key(t, f) ecore_tree_free_key_cb_set(t, f)
+#define ecore_list_remove_first(l) ecore_list_first_remove(l)
+#define ecore_list_remove_last(l) ecore_list_last_remove(l)
+#define ecore_list_goto_first(l) ecore_list_first_goto(l)
+#define ecore_list_goto_last(l) ecore_list_last_goto(l)
+#define ecore_list_goto_index(l) ecore_list_index_goto(l)
+#define ecore_dlist_remove_first(l) ecore_dlist_first_remove(l)
+#define ecore_dlist_remove_last(l) ecore_dlist_last_remove(l)
+#define ecore_dlist_goto_first(l) ecore_dlist_first_goto(l)
+#define ecore_dlist_goto_last(l) ecore_dlist_last_goto(l)
+#define ecore_dlist_goto_index(l) ecore_dlist_index_goto(l)
+
 /**
  * @file Ecore_Data.h
  * @brief Contains threading, list, hash, debugging and tree functions.
@@ -104,22 +136,22 @@
/* Removing items from the list */
EAPI int ecore_list_remove_destroy(Ecore_List *list);
EAPI void *ecore_list_remove(Ecore_List * list);
-   EAPI void *ecore_list_remove_first(Ecore_List * list);
-   EAPI void *ecore_list_remove_last(Ecore_List * list);
+   EAPI void *ecore_list_first_remove(Ecore_List * list);
+   EAPI void *ecore_list_last_remove(Ecore_List * list);

/* Retrieve the current position in the list */
EAPI void *ecore_list_current(Ecore_List * list);
EAPI void *ecore_list_first(Ecore_List * list);
EAPI void *ecore_list_last(Ecore_List * list);
EAPI int ecore_list_index(Ecore_List * list);
-   EAPI int ecore_list_nodes(Ecore_List * list);
+   EAPI int ecore_list_count(Ecore_List * list);

/* Traversing the list */
EAPI int ecore_list_for_each(Ecore_List *list, Ecore_For_Each function,
void *user_data);
-   EAPI void *ecore_list_goto_first(Ecore_List * list);
-   EAPI void *ecore_list_goto_last(Ecore_List * list);
-   EAPI void *ecore_list_goto_index(Ecore_List * list, int index);
+   EAPI void *ecore_list_first_goto(Ecore_List * list);
+   EAPI void *ecore_list_last_goto(Ecore_List * list);
+   EAPI void *ecore_list_index_goto(Ecore_List * list, int index);
EAPI void *ecore_list_goto(Ecore_List * list, const void *_data);

/* Traversing the list and returning data */
@@ -136,7 +168,7 @@
   char order);

/* Check to see if there is any data in the list */
-   EAPI int ecore_list_is_empty(Ecore_List * list);
+   EAPI int ecore_list_empty_is(Ecore_List * list);

/* Remove every node in the list without freeing the list itself */
EAPI int ecore_list_clear(Ecore_List * list);
@@ -150,7 +182,7 @@
/* Destroying nodes */
EAPI int ecore_list_node_destroy(Ecore_List_Node * _e_node, Ecore_Free_Cb 
free_func);

-   EAPI int ecore_list_set_free_cb(Ecore_List * list, Ecore_Free_Cb free_func);
+   EAPI int ecore_list_free_cb_set(Ecore_List * list, Ecore_Free_Cb free_func);

typedef Ecore_List Ecore_DList;
 # define ECORE_DLIST(dli

E CVS: libs/ecore pfritz

2007-07-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_ipc


Modified Files:
ecore_ipc.c 


Log Message:
*API BREAK* see the discussion in the mailing list. misc and e_modules will 
follow

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_ipc/ecore_ipc.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- ecore_ipc.c 16 Feb 2007 18:12:38 -  1.41
+++ ecore_ipc.c 25 Jul 2007 17:00:55 -  1.42
@@ -1042,7 +1042,7 @@
 svr = 
ecore_con_server_data_get(ecore_con_client_server_get(e->client));
 ecore_list_goto(svr->client_list, cl);
 ecore_list_remove(svr->client_list);
-ecore_list_goto_first(svr->client_list);
+ecore_list_first_goto(svr->client_list);
 if (!cl->delete_me)
   {
  e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Del));



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-07-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_x


Modified Files:
ecore_x_netwm.c ecore_xcb_netwm.c ecore_xcb_reply.c 


Log Message:
*API BREAK* see the discussion in the mailing list. misc and e_modules will 
follow

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_x/ecore_x_netwm.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- ecore_x_netwm.c 5 Nov 2006 15:14:49 -   1.58
+++ ecore_x_netwm.c 25 Jul 2007 17:00:55 -  1.59
@@ -256,7 +256,7 @@
startup_info = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
if (startup_info)
  {
-   ecore_hash_set_free_value(startup_info, 
_ecore_x_netwm_startup_info_free);
+   ecore_hash_free_value_cb_set(startup_info, 
_ecore_x_netwm_startup_info_free);
  }
 }
 
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_x/ecore_xcb_netwm.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_xcb_netwm.c   13 Apr 2007 17:12:09 -  1.1
+++ ecore_xcb_netwm.c   25 Jul 2007 17:00:55 -  1.2
@@ -71,7 +71,7 @@
startup_info = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
if (startup_info)
  {
-   ecore_hash_set_free_value(startup_info, 
_ecore_x_netwm_startup_info_free);
+   ecore_hash_free_value_cb_set(startup_info, 
_ecore_x_netwm_startup_info_free);
  }
 }
 
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_x/ecore_xcb_reply.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_xcb_reply.c   13 Apr 2007 17:12:09 -  1.1
+++ ecore_xcb_reply.c   25 Jul 2007 17:00:55 -  1.2
@@ -43,7 +43,7 @@
 return 0;
  }
 
-   if (!ecore_list_set_free_cb(_ecore_xcb_cookies, ECORE_FREE_CB(free)))
+   if (!ecore_list_free_cb_set(_ecore_xcb_cookies, ECORE_FREE_CB(free)))
  {
 ecore_list_destroy(_ecore_xcb_cookies);
 return 0;
@@ -94,7 +94,7 @@
if (!_ecore_xcb_cookies)
  return 0;
 
-   data = ecore_list_remove_first(_ecore_xcb_cookies);
+   data = ecore_list_first_remove(_ecore_xcb_cookies);
if (data)
  {
 cookie = data->cookie;



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-07-25 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_list.c 


Log Message:
doxy

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_list.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- ecore_list.c15 Apr 2007 17:21:00 -  1.39
+++ ecore_list.c25 Jul 2007 09:04:28 -  1.40
@@ -1135,8 +1135,8 @@
  * Sort data in @p list using the compare function @p compare
  * @param list  The list.
  * @param compare   The function to compare the data of @p list
- * @param order The sort direction
- *
+ * @param order The sort direction, possible values are ECORE_SORT_MIN and
+ *  ECORE_SORT_MAX
  * @return  true on success
  *
  * This is a wrapper function for mergesort and heapsort. It
@@ -1162,8 +1162,8 @@
  * Sort data in @p list using the compare function @p compare
  * @param list  The list.
  * @param compare   The function to compare the data of @p list
- * @param order The sort direction
- *
+ * @param order The sort direction, possible values are ECORE_SORT_MIN and
+ *  ECORE_SORT_MAX
  * @return  true on success
  *
  * Mergesort is a stable, in-place sorting algorithm 
@@ -1288,8 +1288,8 @@
  * Sort data in @p list using the compare function @p compare
  * @param list  The list.
  * @param compare   The function to compare the data of @p list
- * @param order The sort direction 
- *
+ * @param order The sort direction, possible values are ECORE_SORT_MIN and
+ *  ECORE_SORT_MAX
  * @return  true on success
  *
  * Heapsort is a unstable sorting algorithm, it needs to allocate extra 
memomry,
@@ -1990,8 +1990,8 @@
  * Sort data in @p list using the compare function @p compare
  * @param list  The list.
  * @param compare   The function to compare the data of @p list
- * @param order The sort direction
- *
+ * @param order The sort direction, possible values are ECORE_SORT_MIN and
+ *  ECORE_SORT_MAX
  * @return  true on success
  *
  * This is a wrapper function for mergesort and heapsort. It
@@ -2017,8 +2017,8 @@
  * Sort data in @p list using the compare function @p compare
  * @param list  The list.
  * @param compare   The function to compare the data of @p list
- * @param order The sort direction
- *
+ * @param order The sort direction, possible values are ECORE_SORT_MIN and
+ *  ECORE_SORT_MAX
  * @return  true on success
  *
  * Mergesort is a stable, in-place sorting algorithm 



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-06-04 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_tree.c 


Log Message:
add a way to set a free callback for the keys in ecore_tree

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- Ecore_Data.h23 May 2007 15:20:55 -  1.43
+++ Ecore_Data.h4 Jun 2007 15:28:29 -   1.44
@@ -252,10 +252,10 @@
   int index;/* The current index into the bucket table */
   
   Ecore_Compare_Cb compare;/* The function used to compare node 
values */
-  Ecore_Hash_Cb hash_func; /* The function used to compare node values */
+  Ecore_Hash_Cb hash_func; /* The callback function to determine hash */
   
   Ecore_Free_Cb free_key;  /* The callback function to free key */
-  Ecore_Free_Cb free_value;/* The callback function to determine 
hash */
+  Ecore_Free_Cb free_value;/* The callback function to free value 
*/
};

/* Create and initialize a hash */
@@ -398,7 +398,7 @@
struct _Ecore_Tree_Node {
   
   /* The actual data for each node */
-  const void *key;
+  void *key;
   void *value;
   
   /* Pointers to surrounding nodes */
@@ -421,7 +421,9 @@
   Ecore_Compare_Cb compare_func;
   
   /* Callback for freeing node data, default is NULL */
-  Ecore_Free_Cb free_func;
+  Ecore_Free_Cb free_value;
+  /* Callback for freeing node key, default is NULL */
+  Ecore_Free_Cb free_key;
};

/* Some basic tree functions */
@@ -444,7 +446,7 @@
EAPI void *ecore_tree_get_closest_smaller(Ecore_Tree * tree, const void 
*key);

/* Set the value associated with key to value */
-   EAPI int ecore_tree_set(Ecore_Tree * tree, const void *key, void *value);
+   EAPI int ecore_tree_set(Ecore_Tree * tree, void *key, void *value);
/* Remove the key from the tree */
EAPI int ecore_tree_remove(Ecore_Tree * tree, const void *key);

@@ -468,12 +470,13 @@
/* Allocate and initialize a new node */
EAPI Ecore_Tree_Node *ecore_tree_node_new(void);
/* Free the desired node */
-   EAPI int ecore_tree_node_destroy(Ecore_Tree_Node * node, Ecore_Free_Cb 
free_data);
+   EAPI int ecore_tree_node_destroy(Ecore_Tree_Node * node, 
+  Ecore_Free_Cb free_value, Ecore_Free_Cb free_key);

/* Set the node's key to key */
-   EAPI int ecore_tree_node_key_set(Ecore_Tree_Node * node, const void *key);
+   EAPI int ecore_tree_node_key_set(Ecore_Tree_Node * node, void *key);
/* Retrieve the key in node */
-   EAPI const void *ecore_tree_node_key_get(Ecore_Tree_Node * node);
+   EAPI void *ecore_tree_node_key_get(Ecore_Tree_Node * node);

/* Set the node's value to value */
EAPI int ecore_tree_node_value_set(Ecore_Tree_Node * node, void *value);
@@ -481,7 +484,9 @@
EAPI void *ecore_tree_node_value_get(Ecore_Tree_Node * node);

/* Add a function to free the data stored in nodes */
-   EAPI int ecore_tree_set_free_cb(Ecore_Tree * tree, Ecore_Free_Cb free_func);
+   EAPI int ecore_tree_set_free_value(Ecore_Tree * tree, Ecore_Free_Cb 
free_value);
+   /* Add a function to free the keys stored in nodes */
+   EAPI int ecore_tree_set_free_key(Ecore_Tree * tree, Ecore_Free_Cb free_key);
 
 
EAPI Ecore_Strbuf * ecore_strbuf_new(void);
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_tree.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ecore_tree.c23 May 2007 15:20:55 -  1.11
+++ ecore_tree.c4 Jun 2007 15:28:29 -   1.12
@@ -73,11 +73,27 @@
  * @return Returns TRUE on successful set, FALSE otherwise.
  */
 EAPI int 
-ecore_tree_set_free_cb(Ecore_Tree *tree, Ecore_Free_Cb free_func)
+ecore_tree_set_free_value(Ecore_Tree *tree, Ecore_Free_Cb free_value)
 {
CHECK_PARAM_POINTER_RETURN("tree", tree, FALSE);
 
-   tree->free_func = free_func;
+   tree->free_value = free_value;
+
+   return TRUE;
+}
+
+/*
+ * @brief Add a function to be called at node destroy time
+ * @param tree: the tree that will use this function when nodes are destroyed
+ * @param free_key: the function that will be passed the node being freed
+ * @return Returns TRUE on successful set, FALSE otherwise.
+ */
+EAPI int 
+ecore_tree_set_free_key(Ecore_Tree *tree, Ecore_Free_Cb free_key)
+{
+   CHECK_PARAM_POINTER_RETURN("tree", tree, FALSE);
+
+   tree->free_key = free_key;
 
return TRUE;
 }
@@ -134,12 +150,14 @@
  * If you don't want the children free'd then you need to remove the node 
first.
  */
 EAPI int 
-ecore_tree_node_destroy(Ecore_Tree_Node *node, Ecore_Free_Cb data_free)
+ecore_tree_node_destroy(Ecore_Tree_Node *node, Ecore_Free_Cb value_fr

E CVS: libs/ecore pfritz

2007-05-23 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_tree.c 


Log Message:
use const void* for the keys in ecore_tree

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- Ecore_Data.h15 Apr 2007 17:20:59 -  1.42
+++ Ecore_Data.h23 May 2007 15:20:55 -  1.43
@@ -398,7 +398,7 @@
struct _Ecore_Tree_Node {
   
   /* The actual data for each node */
-  void *key;
+  const void *key;
   void *value;
   
   /* Pointers to surrounding nodes */
@@ -436,17 +436,17 @@
EAPI int ecore_tree_is_empty(Ecore_Tree * tree);

/* Retrieve the value associated with key */
-   EAPI void *ecore_tree_get(Ecore_Tree * tree, void *key);
-   EAPI Ecore_Tree_Node *ecore_tree_get_node(Ecore_Tree * tree, void *key);
+   EAPI void *ecore_tree_get(Ecore_Tree * tree, const void *key);
+   EAPI Ecore_Tree_Node *ecore_tree_get_node(Ecore_Tree * tree, const void 
*key);
/* Retrieve the value of node with key greater than or equal to key */
-   EAPI void *ecore_tree_get_closest_larger(Ecore_Tree * tree, void *key);
+   EAPI void *ecore_tree_get_closest_larger(Ecore_Tree * tree, const void 
*key);
/* Retrieve the value of node with key less than or equal to key */
-   EAPI void *ecore_tree_get_closest_smaller(Ecore_Tree * tree, void *key);
+   EAPI void *ecore_tree_get_closest_smaller(Ecore_Tree * tree, const void 
*key);

/* Set the value associated with key to value */
-   EAPI int ecore_tree_set(Ecore_Tree * tree, void *key, void *value);
+   EAPI int ecore_tree_set(Ecore_Tree * tree, const void *key, void *value);
/* Remove the key from the tree */
-   EAPI int ecore_tree_remove(Ecore_Tree * tree, void *key);
+   EAPI int ecore_tree_remove(Ecore_Tree * tree, const void *key);

/* Add a node to the tree */
EAPI int ecore_tree_add_node(Ecore_Tree * tree, Ecore_Tree_Node * node);
@@ -471,9 +471,9 @@
EAPI int ecore_tree_node_destroy(Ecore_Tree_Node * node, Ecore_Free_Cb 
free_data);

/* Set the node's key to key */
-   EAPI int ecore_tree_node_key_set(Ecore_Tree_Node * node, void *key);
+   EAPI int ecore_tree_node_key_set(Ecore_Tree_Node * node, const void *key);
/* Retrieve the key in node */
-   EAPI void *ecore_tree_node_key_get(Ecore_Tree_Node * node);
+   EAPI const void *ecore_tree_node_key_get(Ecore_Tree_Node * node);

/* Set the node's value to value */
EAPI int ecore_tree_node_value_set(Ecore_Tree_Node * node, void *value);
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_tree.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ecore_tree.c23 Jun 2006 06:42:35 -  1.10
+++ ecore_tree.c23 May 2007 15:20:55 -  1.11
@@ -7,8 +7,8 @@
 
 /* Utility functions for searching the tree and returning a node, or its
  * parent */
-static Ecore_Tree_Node *tree_node_find(Ecore_Tree * tree, void *key);
-static Ecore_Tree_Node *tree_node_find_parent(Ecore_Tree * tree, void *key);
+static Ecore_Tree_Node *tree_node_find(Ecore_Tree * tree, const void *key);
+static Ecore_Tree_Node *tree_node_find_parent(Ecore_Tree * tree, const void 
*key);
 
 /* Balancing functions, keep the tree balanced within a one node height
  * difference */
@@ -185,7 +185,7 @@
  * @return Returns TRUE if the node is set successfully, FALSE if not.
  */
 EAPI int 
-ecore_tree_node_key_set(Ecore_Tree_Node *node, void *key)
+ecore_tree_node_key_set(Ecore_Tree_Node *node, const void *key)
 {
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
 
@@ -200,10 +200,10 @@
  *
  * @return Returns NULL if an error occurs, otherwise the key is returned
  */
-EAPI void *
+EAPI const void *
 ecore_tree_node_key_get(Ecore_Tree_Node *node)
 {
-   void *ret;
+   const void *ret;
 
CHECK_PARAM_POINTER_RETURN("node", node, NULL);
ret = node->key;
@@ -243,7 +243,7 @@
  * @return Returns the node corresponding to the key if found, otherwise NULL.
  */
 EAPI Ecore_Tree_Node *
-ecore_tree_get_node(Ecore_Tree *tree, void *key)
+ecore_tree_get_node(Ecore_Tree *tree, const void *key)
 {
Ecore_Tree_Node *ret;
 
@@ -261,7 +261,7 @@
  * @return Returns the value corresponding to the key if found, otherwise NULL.
  */
 EAPI void *
-ecore_tree_get(Ecore_Tree *tree, void *key)
+ecore_tree_get(Ecore_Tree *tree, const void *key)
 {
void *ret;
Ecore_Tree_Node *node;
@@ -282,7 +282,7 @@
  * equal to the key
  */
 EAPI void *
-ecore_tree_get_closest_larger(Ecore_Tree *tree, void *key)
+ecore_tree_get_closest_larger(Ecore_Tree *tree, const void *key)
 {
Ecore_Tree_Node *node;
 
@@ -309,7 +309,7 @@
  * @return Returns NULL if no valid nodes, otherwise the no

E CVS: libs/ecore pfritz

2007-05-21 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_str.c 


Log Message:
add doxy

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_str.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ecore_str.c 13 Mar 2007 06:46:14 -  1.7
+++ ecore_str.c 21 May 2007 09:54:20 -  1.8
@@ -23,7 +23,13 @@
 #include "ecore_private.h"
 #include "Ecore_Data.h"
 
-/*
+/**
+ * @param dst the destination
+ * @param src the source
+ * @param siz the size of the destination
+ * @return the length of the source string
+ * @brief copy a c-string
+ *
  * Copy src to string dst of size siz.  At most siz-1 characters
  * will be copied.  Always NUL terminates (unless siz == 0).
  * Returns strlen(src); if retval >= siz, truncation occurred.
@@ -61,7 +67,13 @@
 #endif
 }
 
-/*
+/**
+ * @param dst the destination
+ * @param src the source
+ * @param siz the size of the destination
+ * @return the length of the source string plus MIN(siz, strlen(initial dst)) 
+ * @brief append a c-string
+ *
  * Appends src to string dst of size siz (unlike strncat, siz is the
  * full size of dst, not space left).  At most siz-1 characters
  * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
@@ -96,12 +108,17 @@
 return(dlen + (s - src));/* count does not include NUL */
 }
 
-
+/**
+ * @param str the string to work with
+ * @param prefix the prefix to check for
+ * @return true if str has the given prefix
+ * @brief checks if the string has the given prefix
+ */
 int
 ecore_str_has_prefix(const char *str, const char *prefix)
 {
-   int str_len;
-   int prefix_len;
+   size_t str_len;
+   size_t prefix_len;
 
CHECK_PARAM_POINTER_RETURN("str", str, 0);
CHECK_PARAM_POINTER_RETURN("prefix", prefix, 0);
@@ -114,11 +131,17 @@
return (strncmp(str, prefix, prefix_len) == 0);
 }
 
+/**
+ * @param str the string to work with
+ * @param suffix the suffix to check for
+ * @return true if str has the given suffix
+ * @brief checks if the string has the given suffix
+ */
 int
 ecore_str_has_suffix(const char *str, const char *suffix)
 {
-   int str_len;
-   int suffix_len;
+   size_t str_len;
+   size_t suffix_len;
 
CHECK_PARAM_POINTER_RETURN("str", str, 0);
CHECK_PARAM_POINTER_RETURN("suffix", suffix, 0);



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-03-12 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_str.c Ecore_Str.h 


Log Message:
speed up ecore_str_split(); thanks to mej

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_str.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ecore_str.c 13 Mar 2007 01:17:33 -  1.6
+++ ecore_str.c 13 Mar 2007 06:46:14 -  1.7
@@ -136,89 +136,45 @@
  * delimiter. If max_tokens is reached, the final string in the returned
  * string array contains the remainder of string.
  *
- * @param string  A string to split.
- * @param delimiter   A string which specifies the places at which to split 
the 
+ * @param str A string to split.
+ * @param delim   A string which specifies the places at which to split 
the 
  *string. The delimiter is not included in any of the 
  *resulting strings, unless max_tokens is reached.
  * @param max_tokens  The maximum number of strings to split string into. 
  *If this is less than 1, the string is split completely.
  * @returnA newly-allocated NULL-terminated array of strings.
- *Use ecore_str_vector_free() to free it.
+ *To free it: free the first element of the array
+ *and the array itself.
  */
-char**
-ecore_str_split(const char *string, const char *delimiter, int max_tokens)
+char **
+ecore_str_split(const char *str, const char *delim, int max_tokens)
 {
-   char **str_array = NULL;
-   char *s;
-   size_t n = 0;
-   int max = max_tokens;
-   const char *remainder;
-   size_t delimiter_len;   
-
-   CHECK_PARAM_POINTER_RETURN("string", string, NULL);
-   CHECK_PARAM_POINTER_RETURN("delimiter", delimiter, NULL);
-  
-  /* on the first run we just count the number of the strings we'll finally
-   * have */ 
-   remainder = string;
-   s = strstr(remainder, delimiter);
-   if (s)
-   {
-   delimiter_len = strlen(delimiter);   
-   while (--max_tokens && s)
-   {
- remainder = s + delimiter_len;
- s = strstr(remainder, delimiter);
- n++;
-   }
-   }
-   if (*string != '\0') n++;
-   
-   str_array = malloc(sizeof(char *)*(n + 1));
-   str_array[n] = NULL;
-
-   /* reset to the initial values */
-   n = 0;
-   max_tokens = max;
-   remainder = string;
-   s = strstr(remainder, delimiter);
-   if (s)
-   {
-   while (--max_tokens && s)
-   {
- size_t len; 
- char *new_string;
+   char *s, *sep, **str_array;
+   size_t len, dlen;
+   int i;
 
- len = s - remainder;
- new_string = malloc(sizeof(char)*(len + 1));
- memcpy(new_string, remainder, len);
- new_string[len] = 0;
- str_array[n++] = new_string;
+   CHECK_PARAM_POINTER_RETURN("str", str, NULL);
+   CHECK_PARAM_POINTER_RETURN("delim", delim, NULL);
 
- remainder = s + delimiter_len;
- s = strstr(remainder, delimiter);
-   }
-   }
-   if (*string != '\0') str_array[n] = strdup(remainder);
+   if (*delim == '\0')
+  return NULL;
 
+   max_tokens = ((max_tokens <= 0) ? (INT_MAX) : (max_tokens - 1));
+   len = strlen(str);
+   dlen = strlen(delim);
+   s = strdup(str);
+   str_array = malloc(sizeof(char *) * (len + 1));
+   for (i = 0; (i < max_tokens) && (sep = strstr(s, delim)); i++) 
+  {
+  str_array[i] = s;
+  s = sep + dlen;
+  *sep = 0;
+  }
+
+   str_array[i++] = s;
+   str_array = realloc(str_array, sizeof(char *) * (i + 1));
+   str_array[i] = NULL;
+ 
return str_array;
-}
-
-/**
- * Free an array of strings and the array itself
- *
- * @param str_array An NULL-terminated array of strings to free.
- */
-void
-ecore_str_vector_free(char **str_array)
-{
-   CHECK_PARAM_POINTER("str_array", str_array);
-   int i;
-
-   for(i=0; str_array[i] != NULL; i++)
-   {
-   FREE(str_array[i]);
-   }
-   FREE(str_array);
 }
 
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Str.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- Ecore_Str.h 13 Mar 2007 01:17:33 -  1.5
+++ Ecore_Str.h 13 Mar 2007 06:46:14 -  1.6
@@ -48,7 +48,6 @@
 EAPI int ecore_str_has_suffix(const char *str, const char *suffix);
 EAPI char **ecore_str_split(const char *string, const char *delimiter, 
 int max_tokens);
-EAPI void ecore_str_vector_free(char **str_array);
 
 #ifdef __cplusplus
 }



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&

E CVS: libs/ecore pfritz

2007-03-12 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Str.h ecore_str.c 


Log Message:
add ecore_str_split(), thanks to rookmoot

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Str.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Ecore_Str.h 17 Feb 2007 06:25:53 -  1.4
+++ Ecore_Str.h 13 Mar 2007 01:17:33 -  1.5
@@ -46,7 +46,9 @@
 EAPI int ecore_str_has_prefix(const char *str, const char *prefix);
 
 EAPI int ecore_str_has_suffix(const char *str, const char *suffix);
-
+EAPI char **ecore_str_split(const char *string, const char *delimiter, 
+int max_tokens);
+EAPI void ecore_str_vector_free(char **str_array);
 
 #ifdef __cplusplus
 }
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_str.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ecore_str.c 17 Feb 2007 06:25:53 -  1.5
+++ ecore_str.c 13 Mar 2007 01:17:33 -  1.6
@@ -20,7 +20,8 @@
 #include 
 #include 
 
-# include "ecore_private.h"
+#include "ecore_private.h"
+#include "Ecore_Data.h"
 
 /*
  * Copy src to string dst of size siz.  At most siz-1 characters
@@ -129,3 +130,95 @@
 
return (strncmp(str + str_len - suffix_len, suffix, suffix_len) == 0);
 }
+
+/**
+ * Splits a string into a maximum of max_tokens pieces, using the given
+ * delimiter. If max_tokens is reached, the final string in the returned
+ * string array contains the remainder of string.
+ *
+ * @param string  A string to split.
+ * @param delimiter   A string which specifies the places at which to split 
the 
+ *string. The delimiter is not included in any of the 
+ *resulting strings, unless max_tokens is reached.
+ * @param max_tokens  The maximum number of strings to split string into. 
+ *If this is less than 1, the string is split completely.
+ * @returnA newly-allocated NULL-terminated array of strings.
+ *Use ecore_str_vector_free() to free it.
+ */
+char**
+ecore_str_split(const char *string, const char *delimiter, int max_tokens)
+{
+   char **str_array = NULL;
+   char *s;
+   size_t n = 0;
+   int max = max_tokens;
+   const char *remainder;
+   size_t delimiter_len;   
+
+   CHECK_PARAM_POINTER_RETURN("string", string, NULL);
+   CHECK_PARAM_POINTER_RETURN("delimiter", delimiter, NULL);
+  
+  /* on the first run we just count the number of the strings we'll finally
+   * have */ 
+   remainder = string;
+   s = strstr(remainder, delimiter);
+   if (s)
+   {
+   delimiter_len = strlen(delimiter);   
+   while (--max_tokens && s)
+   {
+ remainder = s + delimiter_len;
+ s = strstr(remainder, delimiter);
+ n++;
+   }
+   }
+   if (*string != '\0') n++;
+   
+   str_array = malloc(sizeof(char *)*(n + 1));
+   str_array[n] = NULL;
+
+   /* reset to the initial values */
+   n = 0;
+   max_tokens = max;
+   remainder = string;
+   s = strstr(remainder, delimiter);
+   if (s)
+   {
+   while (--max_tokens && s)
+   {
+ size_t len; 
+ char *new_string;
+
+ len = s - remainder;
+ new_string = malloc(sizeof(char)*(len + 1));
+ memcpy(new_string, remainder, len);
+ new_string[len] = 0;
+ str_array[n++] = new_string;
+
+ remainder = s + delimiter_len;
+ s = strstr(remainder, delimiter);
+   }
+   }
+   if (*string != '\0') str_array[n] = strdup(remainder);
+
+   return str_array;
+}
+
+/**
+ * Free an array of strings and the array itself
+ *
+ * @param str_array An NULL-terminated array of strings to free.
+ */
+void
+ecore_str_vector_free(char **str_array)
+{
+   CHECK_PARAM_POINTER("str_array", str_array);
+   int i;
+
+   for(i=0; str_array[i] != NULL; i++)
+   {
+   FREE(str_array[i]);
+   }
+   FREE(str_array);
+}
+



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-03-05 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_strbuf.c 


Log Message:
- add ecore_strbuf_replace() and ecore_strbuf_replace_all()
- some formating and minor things

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- Ecore_Data.h21 Feb 2007 06:08:22 -  1.36
+++ Ecore_Data.h5 Mar 2007 21:41:39 -   1.37
@@ -483,14 +483,21 @@
EAPI int ecore_tree_set_free_cb(Ecore_Tree * tree, Ecore_Free_Cb free_func);
 
 
-Ecore_Strbuf * ecore_strbuf_new(void);
-void ecore_strbuf_free(Ecore_Strbuf *buf);
-void ecore_strbuf_append(Ecore_Strbuf *buf, const char *str);
-void ecore_strbuf_append_char(Ecore_Strbuf *buf, char c);
-void ecore_strbuf_insert(Ecore_Strbuf *buf, const char *str, size_t pos);
-#define ecore_strbuf_prepend(buf, str) ecore_strbuf_insert(buf, str, 0)
-const char * ecore_strbuf_string_get(Ecore_Strbuf *buf);
-size_t ecore_strbuf_length_get(Ecore_Strbuf *buf);
+   EAPI Ecore_Strbuf * ecore_strbuf_new(void);
+   EAPI void ecore_strbuf_free(Ecore_Strbuf *buf);
+   EAPI void ecore_strbuf_append(Ecore_Strbuf *buf, const char *str);
+   EAPI void ecore_strbuf_append_char(Ecore_Strbuf *buf, char c);
+   EAPI void ecore_strbuf_insert(Ecore_Strbuf *buf, const char *str, 
+ size_t pos);
+# define ecore_strbuf_prepend(buf, str) ecore_strbuf_insert(buf, str, 0)
+   EAPI const char * ecore_strbuf_string_get(Ecore_Strbuf *buf);
+   EAPI size_t ecore_strbuf_length_get(Ecore_Strbuf *buf);
+   EAPI int ecore_strbuf_replace(Ecore_Strbuf *buf, const char *str, 
+ const char *with, unsigned int n);
+# define ecore_strbuf_replace_first(buf, str, with) \
+   ecore_strbuf_replace(buf, str, with, 1)
+   EAPI int ecore_strbuf_replace_all(Ecore_Strbuf *buf, const char *str,
+ const char *with);
 
 #ifdef __cplusplus
 }
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_strbuf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ecore_strbuf.c  21 Feb 2007 04:31:50 -  1.2
+++ ecore_strbuf.c  5 Mar 2007 21:41:39 -   1.3
@@ -15,10 +15,12 @@
   size_t step;
 };
 
+static int _ecore_strbuf_resize(Ecore_Strbuf *buf, size_t size);
+
 /**
  * Create a new string buffer
  */
-Ecore_Strbuf *
+EAPI Ecore_Strbuf *
 ecore_strbuf_new(void)
 {
   Ecore_Strbuf *buf;
@@ -40,7 +42,7 @@
  * Free a string buffer
  * @param buf the buffer to free
  */
-void
+EAPI void
 ecore_strbuf_free(Ecore_Strbuf *buf)
 {
   CHECK_PARAM_POINTER("buf", buf); 
@@ -53,7 +55,7 @@
  * @param buf the Ecore_Strbuf to append to
  * @param str the string to append
  */
-void
+EAPI void
 ecore_strbuf_append(Ecore_Strbuf *buf, const char *str)
 {
   size_t l;
@@ -80,18 +82,16 @@
   buf->len += l;
 }
 
-
 /**
  * Insert a string to a buffer, reallocating as necessary.
  * @param buf the Ecore_Strbuf to insert
  * @param str the string to insert
  * @param pos the position to insert the string
  */
-void
+EAPI void
 ecore_strbuf_insert(Ecore_Strbuf *buf, const char *str, size_t pos)
 {
   size_t len;
-  size_t new_size;
 
   CHECK_PARAM_POINTER("buf", buf); 
   CHECK_PARAM_POINTER("str", str);
@@ -106,23 +106,12 @@
* resize the buffer if necessary
*/
   len = strlen(str);
-  new_size = buf->size;
-  while (len + buf->len > new_size)
-{
-new_size += buf->step;
-if (buf->step < ECORE_STRBUF_MAX_STEP)
-  buf->step *= 2;
-}
-
-  if (new_size != buf->size)
-{
-   buf->size = new_size;
-buf->buf = realloc(buf->buf, buf->size);
-}
+  if (!_ecore_strbuf_resize(buf, buf->len + len))
+return;
   /* move the existing text */
   memmove(buf->buf + len + pos, buf->buf + pos, buf->len - pos);
   /* and now insert the given string */
-  strncpy(buf->buf + pos, str, len);
+  memcpy(buf->buf + pos, str, len);
   buf->len += len;
   buf->buf[buf->len] = 0;
 }
@@ -132,7 +121,7 @@
  * @param buf the Ecore_Strbuf to append to
  * @param c the char to append
  */
-void
+EAPI void
 ecore_strbuf_append_char(Ecore_Strbuf *buf, char c)
 {
   CHECK_PARAM_POINTER("buf", buf); 
@@ -155,7 +144,7 @@
  * This pointer must not be modified, and will no longer be valid if
  * the Ecore_Strbuf is modified.
  */
-const char *
+EAPI const char *
 ecore_strbuf_string_get(Ecore_Strbuf *buf)
 {
   CHECK_PARAM_POINTER_RETURN("buf", buf, NULL); 
@@ -166,10 +155,206 @@
  * Retrieve the length of the string buffer content
  * @param buf the buffer
  */
-size_t
+EAPI size_t
 ecore_strbuf_length_get(Ecore_Strbuf *buf)
 {
   CHECK_PARAM_POINTER_RETURN("buf", buf, 0); 
   return buf->len;
+}
+
+/**
+ * Replace the n-th string with an other 

E CVS: libs/ecore pfritz

2007-03-01 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_file


Modified Files:
ecore_file.c 


Log Message:
sort the list in the same way ls actually does: using strcoll,
you want to add the line setlocale(LC_COLLATE, ""); or setlocale(LC_ALL, "");
to your application if you not already have

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- ecore_file.c4 Feb 2007 13:14:16 -   1.54
+++ ecore_file.c1 Mar 2007 16:17:04 -   1.55
@@ -331,7 +331,7 @@
  }
closedir(dirp);

-   ecore_list_sort(list, ECORE_COMPARE_CB(strcasecmp), ECORE_SORT_MIN);
+   ecore_list_sort(list, ECORE_COMPARE_CB(strcoll), ECORE_SORT_MIN);
 
ecore_list_goto_first(list);
return list;



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-02-20 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h 


Log Message:
oops, ecore should compile now again, Ecore_Data.h includes know  for 
size_t. If you don't like, let it me know and we'll use unsigned int instead

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- Ecore_Data.h21 Feb 2007 04:31:50 -  1.35
+++ Ecore_Data.h21 Feb 2007 06:08:22 -  1.36
@@ -22,6 +22,9 @@
 # endif
 #endif
 
+/* we need this for size_t */
+#include 
+
 /**
  * @file Ecore_Data.h
  * @brief Contains threading, list, hash, debugging and tree functions.



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-02-20 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_strbuf.c 


Log Message:
add ecore_strbuf_insert() and ecore_strbuf_length_get()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- Ecore_Data.h16 Feb 2007 23:49:55 -  1.34
+++ Ecore_Data.h21 Feb 2007 04:31:50 -  1.35
@@ -481,11 +481,13 @@
 
 
 Ecore_Strbuf * ecore_strbuf_new(void);
-Ecore_Strbuf * ecore_strbuf_new(void);
 void ecore_strbuf_free(Ecore_Strbuf *buf);
 void ecore_strbuf_append(Ecore_Strbuf *buf, const char *str);
 void ecore_strbuf_append_char(Ecore_Strbuf *buf, char c);
+void ecore_strbuf_insert(Ecore_Strbuf *buf, const char *str, size_t pos);
+#define ecore_strbuf_prepend(buf, str) ecore_strbuf_insert(buf, str, 0)
 const char * ecore_strbuf_string_get(Ecore_Strbuf *buf);
+size_t ecore_strbuf_length_get(Ecore_Strbuf *buf);
 
 #ifdef __cplusplus
 }
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_strbuf.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_strbuf.c  16 Feb 2007 23:49:55 -  1.1
+++ ecore_strbuf.c  21 Feb 2007 04:31:50 -  1.2
@@ -10,9 +10,9 @@
 struct _ecore_strbuf
 {
   char *buf;
-  int len;
-  int size;
-  int step;
+  size_t len;
+  size_t size;
+  size_t step;
 };
 
 /**
@@ -56,15 +56,15 @@
 void
 ecore_strbuf_append(Ecore_Strbuf *buf, const char *str)
 {
+  size_t l;
+  size_t off = 0;
+
   CHECK_PARAM_POINTER("buf", buf); 
   CHECK_PARAM_POINTER("str", str); 
 
-int l;
-int off = 0;
-
-l = ecore_strlcpy(buf->buf + buf->len, str, buf->size - buf->len);
+  l = ecore_strlcpy(buf->buf + buf->len, str, buf->size - buf->len);
 
-while (l > buf->size - buf->len) 
+  while (l > buf->size - buf->len) 
 {
 /* we successfully appended this much */
 off += buf->size - buf->len - 1;
@@ -77,11 +77,57 @@
 
 l = ecore_strlcpy(buf->buf + buf->len, str + off, buf->size - 
buf->len);
 }
-buf->len += l;
+  buf->len += l;
 }
 
 
 /**
+ * Insert a string to a buffer, reallocating as necessary.
+ * @param buf the Ecore_Strbuf to insert
+ * @param str the string to insert
+ * @param pos the position to insert the string
+ */
+void
+ecore_strbuf_insert(Ecore_Strbuf *buf, const char *str, size_t pos)
+{
+  size_t len;
+  size_t new_size;
+
+  CHECK_PARAM_POINTER("buf", buf); 
+  CHECK_PARAM_POINTER("str", str);
+
+  if (pos >= buf->len)
+{
+   ecore_strbuf_append(buf, str);
+   return;
+}
+
+  /*
+   * resize the buffer if necessary
+   */
+  len = strlen(str);
+  new_size = buf->size;
+  while (len + buf->len > new_size)
+{
+new_size += buf->step;
+if (buf->step < ECORE_STRBUF_MAX_STEP)
+  buf->step *= 2;
+}
+
+  if (new_size != buf->size)
+{
+   buf->size = new_size;
+buf->buf = realloc(buf->buf, buf->size);
+}
+  /* move the existing text */
+  memmove(buf->buf + len + pos, buf->buf + pos, buf->len - pos);
+  /* and now insert the given string */
+  strncpy(buf->buf + pos, str, len);
+  buf->len += len;
+  buf->buf[buf->len] = 0;
+}
+
+/**
  * Append a character to a string buffer, reallocating as necessary.
  * @param buf the Ecore_Strbuf to append to
  * @param c the char to append
@@ -115,3 +161,15 @@
   CHECK_PARAM_POINTER_RETURN("buf", buf, NULL); 
   return buf->buf;
 }
+
+/**
+ * Retrieve the length of the string buffer content
+ * @param buf the buffer
+ */
+size_t
+ecore_strbuf_length_get(Ecore_Strbuf *buf)
+{
+  CHECK_PARAM_POINTER_RETURN("buf", buf, 0); 
+  return buf->len;
+}
+



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-02-12 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_list.c 


Log Message:
add ecore_dlist_sort() and ecore_dlist_mergesort()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- Ecore_Data.h3 Feb 2007 17:59:05 -   1.32
+++ Ecore_Data.h12 Feb 2007 22:47:46 -  1.33
@@ -192,6 +192,14 @@
EAPI void *ecore_dlist_next(Ecore_DList * list);
EAPI void *ecore_dlist_previous(Ecore_DList * list);

+   /* Sorting the list */
+   EAPI int ecore_dlist_sort(Ecore_DList *list, Ecore_Compare_Cb compare,
+  char order);
+   EAPI int ecore_dlist_mergesort(Ecore_DList *list, Ecore_Compare_Cb compare,
+  char order);
+# define ecore_dlist_heapsort(list, compare, order) \
+   ecore_list_heapsort(list, compare, order)
+   
/* Check to see if there is any data in the list */
EAPI int ecore_dlist_is_empty(Ecore_DList * _e_dlist);

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_list.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ecore_list.c2 Feb 2007 00:41:33 -   1.37
+++ ecore_list.c12 Feb 2007 22:47:46 -  1.38
@@ -40,6 +40,12 @@
Ecore_List_Node *second,
Ecore_Compare_Cb compare,
int order);
+static Ecore_List_Node *_ecore_dlist_node_mergesort(Ecore_List_Node *first,
+  int n, Ecore_Compare_Cb compare, int order);
+static Ecore_List_Node *_ecore_dlist_node_merge(Ecore_List_Node *first, 
+   Ecore_List_Node *second,
+   Ecore_Compare_Cb compare,
+   int order);
 
 /* Private double linked list functions */
 static void *_ecore_dlist_previous(Ecore_DList * list);
@@ -1151,6 +1157,7 @@
   
return 1;
 }
+
 /**
  * Sort data in @p list using the compare function @p compare
  * @param list  The list.
@@ -1977,6 +1984,168 @@
ecore_list_clear(ECORE_LIST(list));
 
return TRUE;
+}
+
+/**
+ * Sort data in @p list using the compare function @p compare
+ * @param list  The list.
+ * @param compare   The function to compare the data of @p list
+ * @param order The sort direction
+ *
+ * @return  true on success
+ *
+ * This is a wrapper function for mergesort and heapsort. It
+ * tries to choose the fastest algorithm depending on the
+ * number of notes. Note: The sort may be unstable.
+ */
+EAPI int
+ecore_dlist_sort(Ecore_List *list, Ecore_Compare_Cb compare, char order)
+{
+   CHECK_PARAM_POINTER_RETURN("list", list, 0);
+   
+   if (list->nodes < 2)
+ return 1;
+   if (list->nodes < ECORE_MERGESORT_LIMIT)
+ return ecore_dlist_mergesort(list, compare, order);
+   if (!ecore_dlist_heapsort(list, compare, order))
+ return ecore_dlist_mergesort(list, compare, order);
+  
+   return 1;
+}
+
+/**
+ * Sort data in @p list using the compare function @p compare
+ * @param list  The list.
+ * @param compare   The function to compare the data of @p list
+ * @param order The sort direction
+ *
+ * @return  true on success
+ *
+ * Mergesort is a stable, in-place sorting algorithm 
+ */
+EAPI int
+ecore_dlist_mergesort(Ecore_DList *list, Ecore_Compare_Cb compare, char order)
+{
+   Ecore_List_Node *node;
+
+   CHECK_PARAM_POINTER_RETURN("list", list, 0);
+   if (list->nodes < 2)
+ return 1;
+
+   if (order == ECORE_SORT_MIN)
+ order = 1;
+   else
+ order = -1;
+
+   node = _ecore_dlist_node_mergesort(list->first, list->nodes, compare, 
order);
+   list->first = node;
+
+   /* maybe there is a better way to do that but our last node has changed */
+   while (node->next)
+ node = node->next;
+   list->last = node;
+
+   _ecore_list_goto_first(list);
+
+   return 1;
+}
+
+/* this is the internal recrusive function for the merge sort */
+static Ecore_List_Node *
+_ecore_dlist_node_mergesort(Ecore_List_Node *first, int n,
+   Ecore_Compare_Cb compare, int order)
+{
+   Ecore_List_Node *middle;
+   Ecore_List_Node *premid;
+   int mid;
+   int i;
+
+   mid = n/2;
+
+   if (n < 2)
+ return first;
+   else if (n == 2)
+ {
+   if (compare(first->data, first->next->data) * order > 0)
+  {
+   /* swap the data */
+   void *data;
+   data = first->next->data;
+   first->next->data = first->data;
+   first->data = data;
+ }
+  return first;
+}
+
+   /*

E CVS: libs/ecore pfritz

2007-02-01 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_list.c ecore_sheap.c 


Log Message:
- add ecore_list_sort() a wrapper for ecore_list_mergesort and 
ecore_list_heapsort
- change the API for the sort functions to return an int on success
- change ECORE_SHEAP_MIN/MAX to ECORE_SORT_MIN/MAX (*API break*)
- use ecore_list_sort() in ecore_file_ls()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- Ecore_Data.h28 Jan 2007 02:46:13 -  1.30
+++ Ecore_Data.h1 Feb 2007 19:22:35 -   1.31
@@ -40,6 +40,9 @@

EAPI extern const unsigned int ecore_prime_table[];

+# define ECORE_SORT_MIN 0
+# define ECORE_SORT_MAX 1
+
typedef void (*Ecore_For_Each) (void *value, void *user_data);
 # define ECORE_FOR_EACH(function) ((Ecore_For_Each)function)

@@ -119,9 +122,11 @@
 const void *user_data);
 
/* Sorting the list */
-   EAPI void ecore_list_mergesort(Ecore_List *list, Ecore_Compare_Cb compare,
+   EAPI int ecore_list_sort(Ecore_List *list, Ecore_Compare_Cb compare,
+  char order);
+   EAPI int ecore_list_mergesort(Ecore_List *list, Ecore_Compare_Cb compare,
   char order);
-   EAPI void ecore_list_heapsort(Ecore_List *list, Ecore_Compare_Cb compare,
+   EAPI int ecore_list_heapsort(Ecore_List *list, Ecore_Compare_Cb compare,
   char order);

/* Check to see if there is any data in the list */
@@ -326,9 +331,6 @@

EAPI Ecore_List *ecore_plugin_get_available(int group_id);
 
-
-# define ECORE_SHEAP_MIN 0
-# define ECORE_SHEAP_MAX 1
 
typedef struct _ecore_heap Ecore_Sheap;
 # define ECORE_HEAP(heap) ((Ecore_Sheap *)heap)
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_list.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- ecore_list.c28 Jan 2007 02:46:13 -  1.35
+++ ecore_list.c1 Feb 2007 19:22:35 -   1.36
@@ -2,6 +2,11 @@
 #include "Ecore.h"
 #include "Ecore_Data.h"
 
+/* Some tests showed that beyond that value heap sort is faster than merge sort
+ * (in this implementation). This value has to be changed or at least review
+ * if someone is changing the implementation. */
+#define ECORE_MERGESORT_LIMIT 4
+
 /* Return information about the list */
 static void *_ecore_list_current(Ecore_List * list);
 
@@ -1121,24 +1126,51 @@
 }
 
 /**
- * Sort data in @p list using the compare function @p func
+ * Sort data in @p list using the compare function @p compare
  * @param list  The list.
  * @param compare   The function to compare the data of @p list
  * @param order The sort direction
  *
+ * @return  true on success
+ *
+ * This is a wrapper function for mergesort and heapsort. It
+ * tries to choose the fastest algorithm depending on the
+ * number of notes. Note: The sort may be unstable.
+ */
+EAPI int
+ecore_list_sort(Ecore_List *list, Ecore_Compare_Cb compare, char order)
+{
+   CHECK_PARAM_POINTER_RETURN("list", list, 0);
+   
+   if (list->nodes < 2)
+ return 1;
+   if (list->nodes < ECORE_MERGESORT_LIMIT)
+ return ecore_list_mergesort(list, compare, order);
+   if (!ecore_list_heapsort(list, compare, order))
+ return ecore_list_mergesort(list, compare, order);
+  
+   return 1;
+}
+/**
+ * Sort data in @p list using the compare function @p compare
+ * @param list  The list.
+ * @param compare   The function to compare the data of @p list
+ * @param order The sort direction
+ *
+ * @return  true on success
+ *
  * Mergesort is a stable, in-place sorting algorithm 
  */
-EAPI void
+EAPI int
 ecore_list_mergesort(Ecore_List *list, Ecore_Compare_Cb compare, char order)
 {
Ecore_List_Node *node;
 
-   CHECK_PARAM_POINTER("list", list);
-   if (!list || list->nodes < 2)
- {
-   return;
- }
-   if (order == ECORE_SHEAP_MIN)
+   CHECK_PARAM_POINTER_RETURN("list", list, 0);
+   if (list->nodes < 2)
+ return 1;
+
+   if (order == ECORE_SORT_MIN)
  order = 1;
else
  order = -1;
@@ -1152,6 +1184,8 @@
list->last = node;
 
_ecore_list_goto_first(list);
+
+   return 1;
 }
 
 /* this is the internal recrusive function for the merge sort */
@@ -1170,7 +1204,7 @@
  return first;
else if (n == 2)
  {
-   if (compare(first->data, first->next->data) == order)
+   if (compare(first->data, first->next->data) * order > 0)
   {
/* swap the data */
void *data;
@@ -1206,7 +1240,7 @@
 
/* select the first node outside the loop, because we need to keep
 * a pointer to it */
-   if (compare(first->data, second->data)

E CVS: libs/ecore pfritz

2007-02-01 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_file


Modified Files:
ecore_file.c 


Log Message:
- add ecore_list_sort() a wrapper for ecore_list_mergesort and 
ecore_list_heapsort
- change the API for the sort functions to return an int on success
- change ECORE_SHEAP_MIN/MAX to ECORE_SORT_MIN/MAX (*API break*)
- use ecore_list_sort() in ecore_file_ls()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- ecore_file.c18 Jan 2007 07:28:56 -  1.52
+++ ecore_file.c1 Feb 2007 19:22:35 -   1.53
@@ -298,7 +298,6 @@
DIR*dirp;
struct dirent  *dp;
Ecore_List *list;
-   Ecore_Sheap*heap;
 
dirp = opendir(dir);
if (!dirp) return NULL;
@@ -315,25 +314,8 @@
  }
  }
closedir(dirp);
-
-   /*
-* Push the data into a heap.
-*/
-   heap = ecore_sheap_new(ECORE_COMPARE_CB(strcasecmp), 
ecore_list_nodes(list));
-   while ((f = ecore_list_remove_first(list)))
- {
-   ecore_sheap_insert(heap, f);
- }
-
-   /*
-* Extract in sorted order.
-*/
-   while ((f = ecore_sheap_extract(heap)))
- {
-   ecore_list_append(list, f);
- }
-
-   ecore_sheap_destroy(heap);
+   
+   ecore_list_sort(list, ECORE_COMPARE_CB(strcasecmp), ECORE_SORT_MIN);
 
ecore_list_goto_first(list);
return list;



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2007-01-27 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
Ecore_Data.h ecore_list.c 


Log Message:
add ecore_list_mergesort() and ecore_list_heapsort()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- Ecore_Data.h17 Jan 2007 13:41:08 -  1.29
+++ Ecore_Data.h28 Jan 2007 02:46:13 -  1.30
@@ -117,6 +117,12 @@
EAPI void *ecore_list_next(Ecore_List * list);
EAPI void *ecore_list_find(Ecore_List *list, Ecore_Compare_Cb function,
 const void *user_data);
+
+   /* Sorting the list */
+   EAPI void ecore_list_mergesort(Ecore_List *list, Ecore_Compare_Cb compare,
+  char order);
+   EAPI void ecore_list_heapsort(Ecore_List *list, Ecore_Compare_Cb compare,
+  char order);

/* Check to see if there is any data in the list */
EAPI int ecore_list_is_empty(Ecore_List * list);
===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_list.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- ecore_list.c21 Jan 2007 13:54:24 -  1.34
+++ ecore_list.c28 Jan 2007 02:46:13 -  1.35
@@ -22,12 +22,20 @@
 static void *_ecore_list_goto(Ecore_List * list, void *data);
 static void *_ecore_list_goto_index(Ecore_List *list, int index);
 
-/* Iterative function */
+/* Iterative functions */
 static int _ecore_list_for_each(Ecore_List *list, Ecore_For_Each function,
 void *user_data);
 static void *_ecore_list_find(Ecore_List *list, Ecore_Compare_Cb function,
   const void *user_data);
 
+/* Sorting functions */
+static Ecore_List_Node *_ecore_list_node_mergesort(Ecore_List_Node *first,
+  int n, Ecore_Compare_Cb compare, int order);
+static Ecore_List_Node *_ecore_list_node_merge(Ecore_List_Node *first, 
+   Ecore_List_Node *second,
+   Ecore_Compare_Cb compare,
+   int order);
+
 /* Private double linked list functions */
 static void *_ecore_dlist_previous(Ecore_DList * list);
 static void *_ecore_dlist_remove_first(Ecore_DList *list);
@@ -1110,6 +1118,172 @@
   }
 
   return NULL;
+}
+
+/**
+ * Sort data in @p list using the compare function @p func
+ * @param list  The list.
+ * @param compare   The function to compare the data of @p list
+ * @param order The sort direction
+ *
+ * Mergesort is a stable, in-place sorting algorithm 
+ */
+EAPI void
+ecore_list_mergesort(Ecore_List *list, Ecore_Compare_Cb compare, char order)
+{
+   Ecore_List_Node *node;
+
+   CHECK_PARAM_POINTER("list", list);
+   if (!list || list->nodes < 2)
+ {
+   return;
+ }
+   if (order == ECORE_SHEAP_MIN)
+ order = 1;
+   else
+ order = -1;
+
+   node = _ecore_list_node_mergesort(list->first, list->nodes, compare, order);
+   list->first = node;
+
+   /* maybe there is a better way to do that but our last node has changed */
+   while (node->next)
+ node = node->next;
+   list->last = node;
+
+   _ecore_list_goto_first(list);
+}
+
+/* this is the internal recrusive function for the merge sort */
+static Ecore_List_Node *
+_ecore_list_node_mergesort(Ecore_List_Node *first, int n,
+   Ecore_Compare_Cb compare, int order)
+{
+   Ecore_List_Node *middle;
+   Ecore_List_Node *premid;
+   int mid;
+   int i;
+
+   mid = n/2;
+
+   if (n < 2)
+ return first;
+   else if (n == 2)
+ {
+   if (compare(first->data, first->next->data) == order)
+  {
+   /* swap the data */
+   void *data;
+   data = first->next->data;
+   first->next->data = first->data;
+   first->data = data;
+ }
+  return first;
+}
+
+   /* first find the premiddle node*/
+   for (premid = first, i = 0; i < mid - 1; i++)
+ premid = premid->next;
+
+   /* split the list */
+   middle = premid->next;
+   premid->next = NULL;
+
+   /* sort the the partial lists */
+   first = _ecore_list_node_mergesort(first, mid, compare, order);
+   middle = _ecore_list_node_mergesort(middle, n - mid, compare, order);
+
+   return _ecore_list_node_merge(first, middle, compare, order);
+}
+
+/* this function is used to merge the partial sorted lists */
+static Ecore_List_Node *
+_ecore_list_node_merge(Ecore_List_Node *first, Ecore_List_Node *second,
+   Ecore_Compare_Cb compare, int order)
+{
+   Ecore_List_Node *list;
+   Ecore_List_Node *l;
+
+   /* select the first node outside the loop, because we need to keep
+* a pointer to it *

E CVS: libs/ecore pfritz

2007-01-09 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore


Modified Files:
ecore_list.c 


Log Message:
save some loops in _ecore_list_goto_index()

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_list.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ecore_list.c28 Dec 2006 10:19:34 -  1.26
+++ ecore_list.c9 Jan 2007 21:21:29 -   1.27
@@ -737,9 +737,15 @@
if (index > ecore_list_nodes(list) || index < 0)
  return NULL;
 
-   _ecore_list_goto_first(list);
+   if (index < list->index) 
+ {
+   _ecore_list_goto_first(list);
+   i = 0;
+ }
+   else
+ i = list->index;
 
-   for (i = 0; i < index && _ecore_list_next(list); i++);
+   for (; i < index && _ecore_list_next(list); i++);
 
if (i >= list->nodes)
  return NULL;



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: libs/ecore pfritz

2006-09-28 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ecore

Dir : e17/libs/ecore/src/lib/ecore_txt


Modified Files:
ecore_txt.c 


Log Message:
fix segv, the new adress is not necessary the same as the old one

===
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_txt/ecore_txt.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ecore_txt.c 6 Jan 2006 18:26:37 -   1.9
+++ ecore_txt.c 28 Sep 2006 20:44:33 -  1.10
@@ -44,6 +44,7 @@
 if (errno == E2BIG)
   {
  new_txt = realloc(new_txt, outalloc + 64);
+ outp = new_txt + outlen;
  outalloc += 64;
  outb += 64;
   }



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs