2004-03-17 21:29:54 -08:00
|
|
|
#ifndef _ECORE_DATA_H
|
2004-04-24 21:35:46 -07:00
|
|
|
# define _ECORE_DATA_H
|
|
|
|
|
2005-12-27 09:17:31 -08:00
|
|
|
#ifdef EAPI
|
|
|
|
#undef EAPI
|
|
|
|
#endif
|
2007-03-15 15:21:28 -07:00
|
|
|
#ifdef _MSC_VER
|
2005-12-27 09:17:31 -08:00
|
|
|
# ifdef BUILDING_DLL
|
|
|
|
# define EAPI __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define EAPI __declspec(dllimport)
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# ifdef __GNUC__
|
|
|
|
# if __GNUC__ >= 4
|
|
|
|
# define EAPI __attribute__ ((visibility("default")))
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2007-02-20 22:08:22 -08:00
|
|
|
/* we need this for size_t */
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2004-04-29 20:10:17 -07:00
|
|
|
/**
|
|
|
|
* @file Ecore_Data.h
|
|
|
|
* @brief Contains threading, list, hash, debugging and tree functions.
|
|
|
|
*/
|
|
|
|
|
2004-04-24 21:35:46 -07:00
|
|
|
# ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
# endif
|
2005-04-02 07:59:55 -08:00
|
|
|
|
2005-12-27 09:17:31 -08:00
|
|
|
# ifdef __sgi
|
|
|
|
# define __FUNCTION__ "unknown"
|
|
|
|
# ifndef __cplusplus
|
|
|
|
# define inline
|
|
|
|
# endif
|
|
|
|
# endif
|
2004-04-24 21:35:46 -07:00
|
|
|
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI extern const unsigned int ecore_prime_table[];
|
2004-04-24 21:35:46 -07:00
|
|
|
|
2007-02-01 11:22:35 -08:00
|
|
|
# define ECORE_SORT_MIN 0
|
|
|
|
# define ECORE_SORT_MAX 1
|
|
|
|
|
2005-01-04 14:45:06 -08:00
|
|
|
typedef void (*Ecore_For_Each) (void *value, void *user_data);
|
2004-04-24 21:35:46 -07:00
|
|
|
# define ECORE_FOR_EACH(function) ((Ecore_For_Each)function)
|
|
|
|
|
|
|
|
typedef void (*Ecore_Free_Cb) (void *data);
|
|
|
|
# define ECORE_FREE_CB(func) ((Ecore_Free_Cb)func)
|
|
|
|
|
2006-09-06 00:06:55 -07:00
|
|
|
typedef unsigned int (*Ecore_Hash_Cb) (const void *key);
|
2004-04-24 21:35:46 -07:00
|
|
|
# define ECORE_HASH_CB(function) ((Ecore_Hash_Cb)function)
|
|
|
|
|
2006-09-06 00:06:55 -07:00
|
|
|
typedef int (*Ecore_Compare_Cb) (const void *data1, const void *data2);
|
2004-04-24 21:35:46 -07:00
|
|
|
# define ECORE_COMPARE_CB(function) ((Ecore_Compare_Cb)function)
|
|
|
|
|
|
|
|
typedef struct _ecore_list Ecore_List;
|
|
|
|
# define ECORE_LIST(list) ((Ecore_List *)list)
|
|
|
|
|
|
|
|
typedef struct _ecore_list_node Ecore_List_Node;
|
|
|
|
# define ECORE_LIST_NODE(node) ((Ecore_List_Node *)node)
|
2007-02-16 15:49:55 -08:00
|
|
|
|
|
|
|
typedef struct _ecore_strbuf Ecore_Strbuf;
|
|
|
|
# define ECORE_STRBUF(buf) ((Ecore_Strbuf *)buf)
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
struct _ecore_list_node {
|
|
|
|
void *data;
|
|
|
|
struct _ecore_list_node *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _ecore_list {
|
|
|
|
Ecore_List_Node *first; /* The first node in the list */
|
|
|
|
Ecore_List_Node *last; /* The last node in the list */
|
|
|
|
Ecore_List_Node *current; /* The current node in the list */
|
|
|
|
|
|
|
|
Ecore_Free_Cb free_func; /* The callback to free data in nodes */
|
|
|
|
|
|
|
|
int nodes; /* The number of nodes in the list */
|
|
|
|
int index; /* The position from the front of the
|
|
|
|
list of current node */
|
|
|
|
};
|
|
|
|
|
2006-09-06 00:06:55 -07:00
|
|
|
EAPI int ecore_direct_compare(const void *key1, const void *key2);
|
|
|
|
EAPI int ecore_str_compare(const void *key1, const void *key2);
|
2005-12-27 09:17:31 -08:00
|
|
|
|
2006-09-06 00:06:55 -07:00
|
|
|
EAPI unsigned int ecore_direct_hash(const void *key);
|
|
|
|
EAPI unsigned int ecore_str_hash(const void *key);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Creating and initializing new list structures */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI Ecore_List *ecore_list_new(void);
|
|
|
|
EAPI int ecore_list_init(Ecore_List *list);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Adding items to the list */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_list_append(Ecore_List * list, void *_data);
|
|
|
|
EAPI int ecore_list_prepend(Ecore_List * list, void *_data);
|
|
|
|
EAPI int ecore_list_insert(Ecore_List * list, void *_data);
|
2007-01-17 05:41:08 -08:00
|
|
|
EAPI int ecore_list_append_list(Ecore_List * list, Ecore_List * append);
|
|
|
|
EAPI int ecore_list_prepend_list(Ecore_List * list, Ecore_List * prepend);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Removing items from the list */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_list_remove_destroy(Ecore_List *list);
|
|
|
|
EAPI void *ecore_list_remove(Ecore_List * list);
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI void *ecore_list_first_remove(Ecore_List * list);
|
|
|
|
EAPI void *ecore_list_last_remove(Ecore_List * list);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Retrieve the current position in the list */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void *ecore_list_current(Ecore_List * list);
|
2006-07-25 05:44:19 -07:00
|
|
|
EAPI void *ecore_list_first(Ecore_List * list);
|
|
|
|
EAPI void *ecore_list_last(Ecore_List * list);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_list_index(Ecore_List * list);
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_list_count(Ecore_List * list);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Traversing the list */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_list_for_each(Ecore_List *list, Ecore_For_Each function,
|
|
|
|
void *user_data);
|
2007-07-25 10:01:04 -07:00
|
|
|
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);
|
2007-04-15 10:21:00 -07:00
|
|
|
EAPI void *ecore_list_goto(Ecore_List * list, const void *_data);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Traversing the list and returning data */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void *ecore_list_next(Ecore_List * list);
|
2006-12-27 19:30:11 -08:00
|
|
|
EAPI void *ecore_list_find(Ecore_List *list, Ecore_Compare_Cb function,
|
2006-12-28 02:19:34 -08:00
|
|
|
const void *user_data);
|
2007-01-27 18:46:13 -08:00
|
|
|
|
|
|
|
/* Sorting the list */
|
2007-02-01 11:22:35 -08:00
|
|
|
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,
|
2007-01-27 18:46:13 -08:00
|
|
|
char order);
|
2007-02-01 11:22:35 -08:00
|
|
|
EAPI int ecore_list_heapsort(Ecore_List *list, Ecore_Compare_Cb compare,
|
2007-01-27 18:46:13 -08:00
|
|
|
char order);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Check to see if there is any data in the list */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_list_empty_is(Ecore_List * list);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Remove every node in the list without freeing the list itself */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_list_clear(Ecore_List * list);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Free the list and it's contents */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void ecore_list_destroy(Ecore_List *list);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Creating and initializing list nodes */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI Ecore_List_Node *ecore_list_node_new(void);
|
|
|
|
EAPI int ecore_list_node_init(Ecore_List_Node *newNode);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Destroying nodes */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_list_node_destroy(Ecore_List_Node * _e_node, Ecore_Free_Cb free_func);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_list_free_cb_set(Ecore_List * list, Ecore_Free_Cb free_func);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
typedef Ecore_List Ecore_DList;
|
|
|
|
# define ECORE_DLIST(dlist) ((Ecore_DList *)dlist)
|
|
|
|
|
|
|
|
typedef struct _ecore_dlist_node Ecore_DList_Node;
|
|
|
|
# define ECORE_DLIST_NODE(dlist) ((Ecore_DList_Node *)dlist)
|
|
|
|
|
|
|
|
struct _ecore_dlist_node {
|
|
|
|
Ecore_List_Node single;
|
|
|
|
Ecore_DList_Node *previous;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Creating and initializing new list structures */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI Ecore_DList *ecore_dlist_new(void);
|
|
|
|
EAPI int ecore_dlist_init(Ecore_DList *list);
|
|
|
|
EAPI void ecore_dlist_destroy(Ecore_DList *list);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Adding items to the list */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_dlist_append(Ecore_DList * _e_dlist, void *_data);
|
|
|
|
EAPI int ecore_dlist_prepend(Ecore_DList * _e_dlist, void *_data);
|
|
|
|
EAPI int ecore_dlist_insert(Ecore_DList * _e_dlist, void *_data);
|
2007-01-17 05:41:08 -08:00
|
|
|
EAPI int ecore_dlist_append_list(Ecore_DList * _e_dlist, Ecore_DList * append);
|
|
|
|
EAPI int ecore_dlist_prepend_list(Ecore_DList * _e_dlist, Ecore_DList * prepend);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Info about list's state */
|
2007-09-06 15:06:32 -07:00
|
|
|
# define ecore_dlist_first(list) ecore_list_first(ECORE_LIST(list))
|
|
|
|
# define ecore_dlist_last(list) ecore_list_last(ECORE_LIST(list))
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void *ecore_dlist_current(Ecore_DList *list);
|
|
|
|
EAPI int ecore_dlist_index(Ecore_DList *list);
|
2007-07-25 10:01:04 -07:00
|
|
|
# define ecore_dlist_count(list) ecore_list_count(ECORE_LIST(list))
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Removing items from the list */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void *ecore_dlist_remove(Ecore_DList * _e_dlist);
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI void *ecore_dlist_first_remove(Ecore_DList * _e_dlist);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_dlist_remove_destroy(Ecore_DList *list);
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI void *ecore_dlist_last_remove(Ecore_DList * _e_dlist);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Traversing the list */
|
2005-01-04 14:45:06 -08:00
|
|
|
# define ecore_dlist_for_each(list, function, user_data) \
|
|
|
|
ecore_list_for_each(ECORE_LIST(list), function, user_data)
|
2007-07-25 10:01:04 -07:00
|
|
|
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);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void *ecore_dlist_goto(Ecore_DList * _e_dlist, void *_data);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Traversing the list and returning data */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void *ecore_dlist_next(Ecore_DList * list);
|
|
|
|
EAPI void *ecore_dlist_previous(Ecore_DList * list);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
2007-02-12 14:47:46 -08:00
|
|
|
/* 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)
|
|
|
|
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Check to see if there is any data in the list */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_dlist_empty_is(Ecore_DList * _e_dlist);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Remove every node in the list without free'ing it */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_dlist_clear(Ecore_DList * _e_dlist);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Creating and initializing list nodes */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_dlist_node_init(Ecore_DList_Node * node);
|
|
|
|
EAPI Ecore_DList_Node *ecore_dlist_node_new(void);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Destroying nodes */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_dlist_node_destroy(Ecore_DList_Node * node, Ecore_Free_Cb free_func);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_dlist_free_cb_set(Ecore_DList * dlist, Ecore_Free_Cb free_func);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Hash Table Implementation:
|
|
|
|
*
|
|
|
|
* Traditional hash table implementation. I had tried a list of tables
|
|
|
|
* approach to save on the realloc's but it ended up being much slower than
|
|
|
|
* the traditional approach.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _ecore_hash_node Ecore_Hash_Node;
|
|
|
|
# define ECORE_HASH_NODE(hash) ((Ecore_Hash_Node *)hash)
|
|
|
|
|
|
|
|
struct _ecore_hash_node {
|
2005-11-16 14:17:11 -08:00
|
|
|
Ecore_Hash_Node *next; /* Pointer to the next node in the bucket list */
|
|
|
|
void *key; /* The key for the data node */
|
|
|
|
void *value; /* The value associated with this node */
|
2004-04-24 21:35:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _ecore_hash Ecore_Hash;
|
|
|
|
# define ECORE_HASH(hash) ((Ecore_Hash *)hash)
|
|
|
|
|
|
|
|
struct _ecore_hash {
|
2005-11-16 14:17:11 -08:00
|
|
|
Ecore_Hash_Node **buckets;
|
2004-04-24 21:35:46 -07:00
|
|
|
int size; /* An index into the table of primes to
|
|
|
|
determine size */
|
|
|
|
int nodes; /* The number of nodes currently in the hash */
|
2005-01-04 14:45:06 -08:00
|
|
|
|
2005-11-16 14:17:11 -08:00
|
|
|
int index; /* The current index into the bucket table */
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
Ecore_Compare_Cb compare; /* The function used to compare node values */
|
2007-06-04 08:28:29 -07:00
|
|
|
Ecore_Hash_Cb hash_func; /* The callback function to determine hash */
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
Ecore_Free_Cb free_key; /* The callback function to free key */
|
2007-06-04 08:28:29 -07:00
|
|
|
Ecore_Free_Cb free_value; /* The callback function to free value */
|
2004-04-24 21:35:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Create and initialize a hash */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI Ecore_Hash *ecore_hash_new(Ecore_Hash_Cb hash_func, Ecore_Compare_Cb compare);
|
|
|
|
EAPI int ecore_hash_init(Ecore_Hash *hash, Ecore_Hash_Cb hash_func, Ecore_Compare_Cb compare);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Functions related to freeing the data in the hash table */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_hash_free_key_cb_set(Ecore_Hash *hash, Ecore_Free_Cb function);
|
|
|
|
EAPI int ecore_hash_free_value_cb_set(Ecore_Hash *hash, Ecore_Free_Cb function);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void ecore_hash_destroy(Ecore_Hash *hash);
|
2005-01-04 14:45:06 -08:00
|
|
|
|
2007-01-03 23:45:40 -08:00
|
|
|
EAPI int ecore_hash_count(Ecore_Hash *hash);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_hash_for_each_node(Ecore_Hash *hash, Ecore_For_Each for_each_func,
|
|
|
|
void *user_data);
|
|
|
|
EAPI Ecore_List *ecore_hash_keys(Ecore_Hash *hash);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Retrieve and store data into the hash */
|
2006-09-06 00:06:55 -07:00
|
|
|
EAPI void *ecore_hash_get(Ecore_Hash *hash, const void *key);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_hash_set(Ecore_Hash *hash, void *key, void *value);
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_hash_hash_set(Ecore_Hash *hash, Ecore_Hash *set);
|
2006-11-05 08:42:30 -08:00
|
|
|
EAPI void *ecore_hash_remove(Ecore_Hash *hash, const void *key);
|
2007-03-25 09:44:11 -07:00
|
|
|
EAPI void *ecore_hash_find(Ecore_Hash *hash, Ecore_Compare_Cb compare, const void *value);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void ecore_hash_dump_graph(Ecore_Hash *hash);
|
2007-01-15 17:27:01 -08:00
|
|
|
EAPI void ecore_hash_dump_stats(Ecore_Hash *hash);
|
2005-04-02 07:59:55 -08:00
|
|
|
|
2005-09-05 08:01:40 -07:00
|
|
|
|
2004-04-24 21:35:46 -07:00
|
|
|
typedef struct _ecore_path_group Ecore_Path_Group;
|
2007-11-06 08:58:12 -08:00
|
|
|
# define ECORE_PATH_GROUP(group) ((Ecore_Path_Group *)(group))
|
|
|
|
|
2004-04-24 21:35:46 -07:00
|
|
|
struct _ecore_path_group
|
|
|
|
{
|
2004-03-17 21:29:54 -08:00
|
|
|
Ecore_List *paths;
|
2004-04-24 21:35:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a new path group
|
|
|
|
*/
|
2007-11-06 08:58:12 -08:00
|
|
|
EAPI Ecore_Path_Group *ecore_path_group_new(void);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Destroy a previous path group
|
|
|
|
*/
|
2007-11-06 08:58:12 -08:00
|
|
|
EAPI void ecore_path_group_del(Ecore_Path_Group *group);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add a directory to be searched for files
|
|
|
|
*/
|
2007-11-06 08:58:12 -08:00
|
|
|
EAPI void ecore_path_group_add(Ecore_Path_Group *group, const char *path);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Remove a directory to be searched for files
|
|
|
|
*/
|
2007-11-06 08:58:12 -08:00
|
|
|
EAPI void ecore_path_group_remove(Ecore_Path_Group *group, const char *path);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Find the absolute path if it exists in the group of paths
|
|
|
|
*/
|
2007-11-06 08:58:12 -08:00
|
|
|
EAPI char * ecore_path_group_find(Ecore_Path_Group *group, const char *name);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get a list of all the available files in a path set
|
|
|
|
*/
|
2007-11-11 09:08:20 -08:00
|
|
|
EAPI Ecore_List * ecore_path_group_available(Ecore_Path_Group *group);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct _ecore_plugin Ecore_Plugin;
|
|
|
|
struct _ecore_plugin
|
|
|
|
{
|
2004-03-17 21:29:54 -08:00
|
|
|
void *handle;
|
2004-04-24 21:35:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Load the specified plugin
|
|
|
|
*/
|
2007-11-06 08:58:12 -08:00
|
|
|
EAPI Ecore_Plugin *ecore_plugin_load(Ecore_Path_Group *group, const char *plugin, const char *version);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Unload the specified plugin
|
|
|
|
*/
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void ecore_plugin_unload(Ecore_Plugin * plugin);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Lookup the specified symbol for the plugin
|
|
|
|
*/
|
2007-09-04 11:23:47 -07:00
|
|
|
EAPI void *ecore_plugin_symbol_get(Ecore_Plugin * plugin, const char *symbol_name);
|
|
|
|
|
2007-11-06 08:58:12 -08:00
|
|
|
EAPI Ecore_List *ecore_plugin_available_get(Ecore_Path_Group *group);
|
2005-09-05 08:01:40 -07:00
|
|
|
|
|
|
|
|
2004-04-24 21:35:46 -07:00
|
|
|
typedef struct _ecore_heap Ecore_Sheap;
|
|
|
|
# define ECORE_HEAP(heap) ((Ecore_Sheap *)heap)
|
|
|
|
|
|
|
|
struct _ecore_heap {
|
|
|
|
void **data;
|
|
|
|
int size;
|
|
|
|
int space;
|
|
|
|
|
|
|
|
char order, sorted;
|
|
|
|
|
2005-01-28 18:13:12 -08:00
|
|
|
/* Callback for comparing node values, default is direct comparison */
|
2004-04-24 21:35:46 -07:00
|
|
|
Ecore_Compare_Cb compare;
|
2005-01-28 18:13:12 -08:00
|
|
|
|
|
|
|
/* Callback for freeing node data, default is NULL */
|
|
|
|
Ecore_Free_Cb free_func;
|
2004-04-24 21:35:46 -07:00
|
|
|
};
|
|
|
|
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI Ecore_Sheap *ecore_sheap_new(Ecore_Compare_Cb compare, int size);
|
|
|
|
EAPI void ecore_sheap_destroy(Ecore_Sheap *heap);
|
|
|
|
EAPI int ecore_sheap_init(Ecore_Sheap *heap, Ecore_Compare_Cb compare, int size);
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_sheap_free_cb_set(Ecore_Sheap *heap, Ecore_Free_Cb free_func);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_sheap_insert(Ecore_Sheap *heap, void *data);
|
|
|
|
EAPI void *ecore_sheap_extract(Ecore_Sheap *heap);
|
|
|
|
EAPI void *ecore_sheap_extreme(Ecore_Sheap *heap);
|
|
|
|
EAPI int ecore_sheap_change(Ecore_Sheap *heap, void *item, void *newval);
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_sheap_compare_set(Ecore_Sheap *heap, Ecore_Compare_Cb compare);
|
|
|
|
EAPI void ecore_sheap_order_set(Ecore_Sheap *heap, char order);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void ecore_sheap_sort(Ecore_Sheap *heap);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void *ecore_sheap_item(Ecore_Sheap *heap, int i);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct _ecore_string Ecore_String;
|
|
|
|
struct _ecore_string {
|
|
|
|
char *string;
|
|
|
|
int references;
|
|
|
|
};
|
|
|
|
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_string_init(void);
|
|
|
|
EAPI void ecore_string_shutdown(void);
|
2006-10-26 20:52:28 -07:00
|
|
|
EAPI const char *ecore_string_instance(const char *string);
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void ecore_string_release(const char *string);
|
2007-06-27 03:57:54 -07:00
|
|
|
EAPI void ecore_string_hash_dump_graph(void);
|
|
|
|
EAPI void ecore_string_hash_dump_stats(void);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct _Ecore_Tree_Node Ecore_Tree_Node;
|
|
|
|
# define ECORE_TREE_NODE(object) ((Ecore_Tree_Node *)object)
|
|
|
|
struct _Ecore_Tree_Node {
|
|
|
|
|
|
|
|
/* The actual data for each node */
|
2007-06-04 08:28:29 -07:00
|
|
|
void *key;
|
2004-04-24 21:35:46 -07:00
|
|
|
void *value;
|
|
|
|
|
|
|
|
/* Pointers to surrounding nodes */
|
|
|
|
Ecore_Tree_Node *parent;
|
|
|
|
Ecore_Tree_Node *left_child;
|
|
|
|
Ecore_Tree_Node *right_child;
|
|
|
|
|
|
|
|
/* Book keeping information for quicker balancing of the tree */
|
|
|
|
int max_right;
|
|
|
|
int max_left;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _Ecore_Tree Ecore_Tree;
|
|
|
|
# define ECORE_TREE(object) ((Ecore_Tree *)object)
|
|
|
|
struct _Ecore_Tree {
|
|
|
|
/* Nodes of the tree */
|
|
|
|
Ecore_Tree_Node *tree;
|
|
|
|
|
|
|
|
/* Callback for comparing node values, default is direct comparison */
|
|
|
|
Ecore_Compare_Cb compare_func;
|
|
|
|
|
|
|
|
/* Callback for freeing node data, default is NULL */
|
2007-06-04 08:28:29 -07:00
|
|
|
Ecore_Free_Cb free_value;
|
|
|
|
/* Callback for freeing node key, default is NULL */
|
|
|
|
Ecore_Free_Cb free_key;
|
2004-04-24 21:35:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Some basic tree functions */
|
|
|
|
/* Allocate and initialize a new tree */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI Ecore_Tree *ecore_tree_new(Ecore_Compare_Cb compare_func);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Initialize a new tree */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_tree_init(Ecore_Tree * tree, Ecore_Compare_Cb compare_func);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Free the tree */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_tree_destroy(Ecore_Tree * tree);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Check to see if the tree has any nodes in it */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_tree_empty_is(Ecore_Tree * tree);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Retrieve the value associated with key */
|
2007-05-23 08:20:55 -07:00
|
|
|
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);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Retrieve the value of node with key greater than or equal to key */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI void *ecore_tree_closest_larger_get(Ecore_Tree * tree, const void *key);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Retrieve the value of node with key less than or equal to key */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI void *ecore_tree_closest_smaller_get(Ecore_Tree * tree, const void *key);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Set the value associated with key to value */
|
2007-06-04 08:28:29 -07:00
|
|
|
EAPI int ecore_tree_set(Ecore_Tree * tree, void *key, void *value);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Remove the key from the tree */
|
2007-05-23 08:20:55 -07:00
|
|
|
EAPI int ecore_tree_remove(Ecore_Tree * tree, const void *key);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Add a node to the tree */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_tree_node_add(Ecore_Tree * tree, Ecore_Tree_Node * node);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Remove a node from the tree */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_tree_node_remove(Ecore_Tree * tree, Ecore_Tree_Node * node);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* For each node in the tree perform the for_each_func function */
|
|
|
|
/* For this one pass in the node */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_tree_for_each_node(Ecore_Tree * tree, Ecore_For_Each for_each_func,
|
|
|
|
void *user_data);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* And here pass in the node's value */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_tree_for_each_node_value(Ecore_Tree * tree,
|
|
|
|
Ecore_For_Each for_each_func,
|
|
|
|
void *user_data);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Some basic node functions */
|
|
|
|
/* Initialize a node */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_tree_node_init(Ecore_Tree_Node * new_node);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Allocate and initialize a new node */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI Ecore_Tree_Node *ecore_tree_node_new(void);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Free the desired node */
|
2007-06-04 08:28:29 -07:00
|
|
|
EAPI int ecore_tree_node_destroy(Ecore_Tree_Node * node,
|
|
|
|
Ecore_Free_Cb free_value, Ecore_Free_Cb free_key);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Set the node's key to key */
|
2007-06-04 08:28:29 -07:00
|
|
|
EAPI int ecore_tree_node_key_set(Ecore_Tree_Node * node, void *key);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Retrieve the key in node */
|
2007-06-04 08:28:29 -07:00
|
|
|
EAPI void *ecore_tree_node_key_get(Ecore_Tree_Node * node);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Set the node's value to value */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI int ecore_tree_node_value_set(Ecore_Tree_Node * node, void *value);
|
2004-04-24 21:35:46 -07:00
|
|
|
/* Retrieve the value in node */
|
2005-12-27 09:17:31 -08:00
|
|
|
EAPI void *ecore_tree_node_value_get(Ecore_Tree_Node * node);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
|
|
|
/* Add a function to free the data stored in nodes */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_tree_free_value_cb_set(Ecore_Tree * tree, Ecore_Free_Cb free_value);
|
2007-06-04 08:28:29 -07:00
|
|
|
/* Add a function to free the keys stored in nodes */
|
2007-07-25 10:01:04 -07:00
|
|
|
EAPI int ecore_tree_free_key_cb_set(Ecore_Tree * tree, Ecore_Free_Cb free_key);
|
2004-04-24 21:35:46 -07:00
|
|
|
|
2007-02-16 15:49:55 -08:00
|
|
|
|
2007-03-05 13:41:39 -08:00
|
|
|
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);
|
2007-02-16 15:49:55 -08:00
|
|
|
|
2004-04-24 21:35:46 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2004-03-17 21:29:54 -08:00
|
|
|
#endif /* _ECORE_DATA_H */
|