Main Page | Modules | Class List | File List | Class Members | File Members

linked_list.c File Reference

#include <gandalf/common/linked_list.h>
#include <gandalf/common/misc_error.h>
#include <gandalf/common/allocate.h>

Functions

Gan_Listgan_list_new (void)
 Makes a new singly linked list containing no elements.
Gan_Listgan_list_form (Gan_List *list)
 Forms a new singly linked list containing no elements.
Gan_Listgan_list_new_from_array (void **array, unsigned n)
 Makes a new linked list containing nodes with data from array.
void gan_list_free (Gan_List *list, Gan_FreeFunc free_func)
 Frees the list, nodes and data contained in the list.
Gan_Bool gan_list_insert_first (Gan_List *list, void *data)
 Inserts a new node at the head of the list.
Gan_Bool gan_list_insert_next (Gan_List *list, void *data)
 Inserts a new node in the position following the current one.
Gan_Bool gan_list_insert_prev (Gan_List *list, void *data)
 Inserts a new node in the position before current one.
Gan_Bool gan_list_insert_last (Gan_List *list, void *data)
 Inserts a new node at the tail of the list.
Gan_Bool gan_list_insert_at (Gan_List *list, void *data, int pos)
 Inserts a new node at a specified position (0 = head).
Gan_Bool gan_list_delete_first (Gan_List *list, Gan_FreeFunc free_func)
 Deletes the node at the head of the list.
Gan_Bool gan_list_delete_next (Gan_List *list, Gan_FreeFunc free_func)
 Deletes the node following the current position.
Gan_Bool gan_list_delete_current (Gan_List *list, Gan_FreeFunc free_func)
 Deletes the node in the current position in a linked list.
Gan_Bool gan_list_delete_prev (Gan_List *list, Gan_FreeFunc free_func)
 Deletes the node in the position previous to the current one.
Gan_Bool gan_list_delete_at (Gan_List *list, Gan_FreeFunc free_func, int pos)
 Deletes the node with the specified position (0 = head).
Gan_Bool gan_list_delete_last (Gan_List *list, Gan_FreeFunc free_func)
 Deletes the node at the tail of the list.
void gan_list_delete_all (Gan_List *list, Gan_FreeFunc free_func)
 Deletes all the nodes in the list and frees their data.
void gan_list_goto_head (Gan_List *list)
 Moves the current position to the position before the head.
Gan_Bool gan_list_goto_pos (Gan_List *list, int pos)
 Moves the current position to the specified position.
void gan_list_goto_tail (Gan_List *list)
 Moves the current position to the tail of the list.
void * gan_list_get_prev_node (Gan_List *list)
 Not a user function.
void * gan_list_get_current_node (Gan_List *list)
 Not a user function.
void * gan_list_get_next_node (Gan_List *list)
 Not a user function.
void * gan_list_set_prev (Gan_List *list, void *new_data)
 Sets the previous data pointer, decrements the current position.
void * gan_list_set_current (Gan_List *list, void *new_data)
 Sets the value of the data pointer in the current node.
void * gan_list_set_next (Gan_List *list, void *new_data)
 Sets the next data pointer, increments the current position.
void gan_list_push_current (Gan_List *list)
 Pushes the current position of the data pointer onto the stack.
void gan_list_pop_current (Gan_List *list)
 Pops the current position of the data pointer from the stack.
int gan_list_get_pos (Gan_List *list)
 Returns the current position in the list.
int gan_list_get_size (Gan_List *list)
 Returns the current number of nodes in the list.
void gan_list_process_data (Gan_List *list, void(*process_func)(void *, void *), void *data)
 Processes all elements in the list.
Gan_Listgan_list_concat (Gan_List *list1, Gan_List *list2)
 Concatanates two lists, creating a new list.
void gan_list_reverse (Gan_List *list)
 Reverses the order of the elements in the list.
int gan_list_to_array (Gan_List *list, void ***array_ptr)
 Creates an array of pointers to the objects in a list.
Gan_Listgan_list_copy (Gan_List *list)
 Copies all the nodes of a list, creating a new list.
Gan_Listgan_list_copy_with_data (Gan_List *list, Gan_CopyFunc copy_func)
 Copies all the nodes of a list, creating a new list.
void gan_list_sort_asc (Gan_List *list, int(*compare)(const void *, const void *))
 Sorts the nodes in the list in ascending order.
void gan_list_make_straight (Gan_List *list)
 Makes a doubly linked list behave like a straight linked list.
void gan_list_make_circular (Gan_List *list)
 Makes a doubly linked list behave like a circular linked list.
Gan_Bool gan_list_is_circular (Gan_List *list)
 Returns GAN_TRUE is the doubly linked list is circular.
Gan_Bool gan_list_contains (Gan_List *list, void *data)
 Returns GAN_TRUE is the doubly linked list contains 'data'.

Detailed Description

Module: Linked list

Part of: Gandalf Library

Version:
1.33
Date:
2005/10/18 22:01:50
Author:
pm
Copyright: (c) 2000 Imagineer Software Limited
Generated on Fri Mar 17 12:44:52 2006 by  doxygen 1.3.9.1