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);
+ EAPI int ecore_list_append_list(Ecore_List * list, Ecore_List * append);
+ EAPI int ecore_list_prepend_list(Ecore_List * list, Ecore_List * prepend);
/* Removing items from the list */
EAPI int ecore_list_remove_destroy(Ecore_List *list);
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);
+ 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);
/* Info about list's state */
EAPI void *ecore_dlist_current(Ecore_DList *list);
/* Retrieve and store data into the hash */
EAPI void *ecore_hash_get(Ecore_Hash *hash, const void *key);
EAPI int ecore_hash_set(Ecore_Hash *hash, void *key, void *value);
+ EAPI int ecore_hash_set_hash(Ecore_Hash *hash, Ecore_Hash *set);
EAPI void *ecore_hash_remove(Ecore_Hash *hash, const void *key);
EAPI void ecore_hash_dump_graph(Ecore_Hash *hash);
EAPI void ecore_hash_dump_stats(Ecore_Hash *hash);
}
/**
+ * Sets all key-value pairs from set in the given hash table.
+ * @param hash The given hash table.
+ * @param set The hash table to import.
+ * @return @c TRUE if successful, @c FALSE if not.
+ * @ingroup Ecore_Data_Hash_ADT_Data_Group
+ */
+EAPI int
+ecore_hash_set_hash(Ecore_Hash *hash, Ecore_Hash *set)
+{
+ unsigned int i;
+ Ecore_Hash_Node *node, *old;
+
+ CHECK_PARAM_POINTER_RETURN("hash", hash, FALSE);
+ CHECK_PARAM_POINTER_RETURN("set", set, FALSE);
+
+ for (i = 0; i < ecore_prime_table[set->size]; i++)
+ {
+ /* Hash into a new list to avoid loops of rehashing the same nodes */
+ while ((old = set->buckets[i]))
+ {
+ set->buckets[i] = old->next;
+ old->next = NULL;
+ node = _ecore_hash_get_node(hash, old->key);
+ if (node)
+ {
+ /* This key already exists. Delete the old and add the new
+ * value */
+ if (hash->free_key) hash->free_key(node->key);
+ if (hash->free_value) hash->free_key(node->value);
+ node->key = old->key;
+ node->value = old->value;
+ free(old);
+ }
+ else
+ _ecore_hash_add_node(hash, old);
+ }
+ }
+ FREE(set->buckets);
+ ecore_hash_init(set, set->hash_func, set->compare);
+ return TRUE;
+}
+
+/**
* Frees the hash table and the data contained inside it.
* @param hash The hash table to destroy.
* @return @c TRUE on success, @c FALSE on error.
* @brief Rehash the nodes of a table into the hash table
* @param hash: the hash to place the nodes of the table
* @param table: the table to remove the nodes from and place in hash
- * @return Returns TRUE on success, FALSE on success
+ * @return Returns TRUE on success, FALSE on error
*/
inline int
_ecore_hash_rehash(Ecore_Hash *hash, Ecore_Hash_Node **old_table, int old_size)
return TRUE;
}
+/**
+ * Append a list to the list.
+ * @param list The list.
+ * @param append The list to append.
+ * @return @c FALSE if an error occurs, @c TRUE if appended successfully
+ * @ingroup Ecore_Data_List_Add_Item_Group
+ */
+
+EAPI int
+ecore_list_append_list(Ecore_List *list, Ecore_List *append)
+{
+ CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
+ CHECK_PARAM_POINTER_RETURN("append", append, FALSE);
+
+ if (ecore_list_is_empty(append)) return TRUE;
+
+ if (ecore_list_is_empty(list))
+ {
+ list->first = append->first;
+ list->current = NULL;
+ list->last = append->last;
+ list->nodes = append->nodes;
+ }
+ else
+ {
+ list->last->next = append->first;
+ list->last = append->last;
+ list->nodes += append->nodes;
+ }
+ ecore_list_init(append);
+ return TRUE;
+}
+
+/**
+ * Prepend a list to the beginning of the list.
+ * @param list The list.
+ * @param prepend The list to prepend.
+ * @return @c FALSE if an error occurs, @c TRUE if prepended successfully.
+ * @ingroup Ecore_Data_List_Add_Item_Group
+ */
+EAPI int
+ecore_list_prepend_list(Ecore_List *list, Ecore_List *prepend)
+{
+ CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
+ CHECK_PARAM_POINTER_RETURN("prepend", prepend, FALSE);
+
+ if (ecore_list_is_empty(prepend)) return TRUE;
+
+ if (ecore_list_is_empty(list))
+ {
+ list->first = prepend->first;
+ list->current = NULL;
+ list->last = prepend->last;
+ list->nodes = prepend->nodes;
+ }
+ else
+ {
+ prepend->last->next = list->first;
+ list->first = prepend->first;
+ list->nodes += prepend->nodes;
+ list->index += prepend->nodes;
+ }
+ ecore_list_init(prepend);
+ return TRUE;
+}
/**
@defgroup Ecore_Data_List_Remove_Item_Group List Item Removing Functions
}
/**
+ * Appends a list to the given doubly linked list.
+ * @param list The given doubly linked list.
+ * @param append The list to append.
+ * @return @c TRUE if the data is successfully appended, @c FALSE otherwise.
+ * @ingroup Ecore_Data_DList_Add_Item_Group
+ */
+EAPI int
+ecore_dlist_append_list(Ecore_DList *list, Ecore_DList *append)
+{
+ CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
+ CHECK_PARAM_POINTER_RETURN("append", append, FALSE);
+
+ if (ecore_dlist_is_empty(append)) return TRUE;
+
+ if (ecore_dlist_is_empty(list))
+ {
+ list->first = append->first;
+ list->current = NULL;
+ list->last = append->last;
+ list->nodes = append->nodes;
+ }
+ else
+ {
+ list->last->next = append->first;
+ ECORE_DLIST_NODE(append->first)->previous = ECORE_DLIST_NODE(list->last);
+ list->last = append->last;
+ list->nodes += append->nodes;
+ }
+ ecore_dlist_init(append);
+ return TRUE;
+}
+
+/**
+ * Adds a list to the very beginning of the given doubly linked list.
+ * @param list The given doubly linked list.
+ * @param prepend The list to prepend.
+ * @return @c TRUE if the data is successfully prepended, @c FALSE otherwise.
+ * @ingroup Ecore_Data_DList_Add_Item_Group
+ */
+EAPI int
+ecore_dlist_prepend_list(Ecore_DList *list, Ecore_DList *prepend)
+{
+ CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
+ CHECK_PARAM_POINTER_RETURN("prepend", prepend, FALSE);
+
+ if (ecore_dlist_is_empty(prepend)) return TRUE;
+
+ if (ecore_dlist_is_empty(list))
+ {
+ list->first = prepend->first;
+ list->current = NULL;
+ list->last = prepend->last;
+ list->nodes = prepend->nodes;
+ }
+ else
+ {
+ prepend->last->next = list->first;
+ ECORE_DLIST_NODE(list->first)->previous = ECORE_DLIST_NODE(prepend->last);
+ list->first = prepend->first;
+ list->nodes += prepend->nodes;
+ list->index += prepend->nodes;
+ }
+ ecore_dlist_init(prepend);
+ return TRUE;
+}
+
+/**
* @defgroup Ecore_Data_DList_Remove_Item_Group Doubly Linked List Removing Functions
*
* Functions that remove nodes from an @c Ecore_DList.