Typedefs | |
typedef _gdsl_stack * | gdsl_stack_t |
GDSL stack type. | |
Functions | |
gdsl_stack_t | gdsl_stack_alloc (const char *NAME, gdsl_alloc_func_t ALLOC_F, gdsl_free_func_t FREE_F) |
Create a new stack. | |
void | gdsl_stack_free (gdsl_stack_t S) |
Destroy a stack. | |
void | gdsl_stack_flush (gdsl_stack_t S) |
Flush a stack. | |
const char * | gdsl_stack_get_name (const gdsl_stack_t S) |
Getsthe name of a stack. | |
ulong | gdsl_stack_get_size (const gdsl_stack_t S) |
Get the size of a stack. | |
ulong | gdsl_stack_get_growing_factor (const gdsl_stack_t S) |
Get the growing factor of a stack. | |
bool | gdsl_stack_is_empty (const gdsl_stack_t S) |
Check if a stack is empty. | |
gdsl_element_t | gdsl_stack_get_top (const gdsl_stack_t S) |
Get the top of a stack. | |
gdsl_element_t | gdsl_stack_get_bottom (const gdsl_stack_t S) |
Get the bottom of a stack. | |
gdsl_stack_t | gdsl_stack_set_name (gdsl_stack_t S, const char *NEW_NAME) |
Set the name of a stack. | |
void | gdsl_stack_set_growing_factor (gdsl_stack_t S, ulong G) |
Set the growing factor of a stack. | |
gdsl_element_t | gdsl_stack_insert (gdsl_stack_t S, void *VALUE) |
Insert an element in a stack (PUSH). | |
gdsl_element_t | gdsl_stack_remove (gdsl_stack_t S) |
Remove an element from a stack (POP). | |
gdsl_element_t | gdsl_stack_search (const gdsl_stack_t S, gdsl_compare_func_t COMP_F, void *VALUE) |
Search for a particular element in a stack. | |
gdsl_element_t | gdsl_stack_search_by_position (const gdsl_stack_t S, ulong POS) |
Search for an element by its position in a stack. | |
gdsl_element_t | gdsl_stack_map_forward (const gdsl_stack_t S, gdsl_map_func_t MAP_F, void *USER_DATA) |
Parse a stack from bottom to top. | |
gdsl_element_t | gdsl_stack_map_backward (const gdsl_stack_t S, gdsl_map_func_t MAP_F, void *USER_DATA) |
Parse a stack from top to bottom. | |
void | gdsl_stack_write (const gdsl_stack_t S, gdsl_write_func_t WRITE_F, FILE *OUTPUT_FILE, void *USER_DATA) |
Write all the elements of a stack to a file. | |
void | gdsl_stack_write_xml (gdsl_stack_t S, gdsl_write_func_t WRITE_F, FILE *OUTPUT_FILE, void *USER_DATA) |
Write the content of a stack to a file into XML. | |
void | gdsl_stack_dump (gdsl_stack_t S, gdsl_write_func_t WRITE_F, FILE *OUTPUT_FILE, void *USER_DATA) |
Dump the internal structure of a stack to a file. |
|
GDSL stack type. This type is voluntary opaque. Variables of this kind could'nt be directly used, but by the functions of this module. Definition at line 53 of file gdsl_stack.h. |
|
Create a new stack. Allocate a new stack data structure which name is set to a copy of NAME. The functions pointers ALLOC_F and FREE_F could be used to respectively, alloc and free elements in the stack. These pointers could be set to NULL to use the default ones:
|
|
Destroy a stack. Deallocate all the elements of the stack S by calling S's FREE_F function passed to gdsl_stack_alloc(). The name of S is deallocated and S is deallocated itself too.
|
|
Flush a stack. Deallocate all the elements of the stack S by calling S's FREE_F function passed to gdsl_stack_alloc(). S is not deallocated itself and S's name is not modified.
|
|
Getsthe name of a stack.
|
|
Get the size of a stack.
|
|
Get the growing factor of a stack. Get the growing factor of the stack S. This value is the amount of cells to reserve for next insertions. For example, if you set this value to 10, each time the number of elements of S reaches 10, then 10 new cells will be reserved for next 10 insertions. It is a way to save time for insertions. This value is 1 by default and can be modified with gdsl_stack_set_growing_factor().
|
|
Check if a stack is empty.
|
|
Get the top of a stack.
|
|
Get the bottom of a stack.
|
|
Set the name of a stack. Change the previous name of the stack S to a copy of NEW_NAME.
|
|
Set the growing factor of a stack. Set the growing factor of the stack S. This value is the amount of cells to reserve for next insertions. For example, if you set this value to 10, each time the number of elements of S reaches 10, then 10 new cells will be reserved for next 10 insertions. It is a way to save time for insertions. To know the actual value of the growing factor, use gdsl_stack_get_growing_factor()
|
|
Insert an element in a stack (PUSH). Allocate a new element E by calling S's ALLOC_F function on VALUE. ALLOC_F is the function pointer passed to gdsl_stack_alloc(). The new element E is the inserted at the top position of the stack S. If the number of elements in S reaches S's growing factor (G), then G new cells are reserved for future insertions into S to save time.
|
|
Remove an element from a stack (POP). Remove the element at the top position of the stack S.
|
|
Search for a particular element in a stack. Search for the first element E equal to VALUE in the stack S, by using COMP_F to compare all S's element with.
|
|
Search for an element by its position in a stack.
|
|
Parse a stack from bottom to top. Parse all elements of the stack S from bottom to top. The MAP_F function is called on each S's element with USER_DATA argument. If MAP_F returns GDSL_MAP_STOP, then gdsl_stack_map_forward() stops and returns its last examinated element.
|
|
Parse a stack from top to bottom. Parse all elements of the stack S from top to bottom. The MAP_F function is called on each S's element with USER_DATA argument. If MAP_F returns GDSL_MAP_STOP, then gdsl_stack_map_backward() stops and returns its last examinated element.
|
|
Write all the elements of a stack to a file. Write the elements of the stack S to OUTPUT_FILE, using WRITE_F function. Additionnal USER_DATA argument could be passed to WRITE_F.
|
|
Write the content of a stack to a file into XML. Write the elements of the stack S to OUTPUT_FILE, into XML language. If WRITE_F != NULL, then uses WRITE_F to write S's elements to OUTPUT_FILE. Additionnal USER_DATA argument could be passed to WRITE_F.
|
|
Dump the internal structure of a stack to a file. Dump the structure of the stack S to OUTPUT_FILE. If WRITE_F != NULL, then uses WRITE_F to write S's elements to OUTPUT_FILE. Additionnal USER_DATA argument could be passed to WRITE_F.
|