Salad  1.0.15
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Typedefs | Enumerations | Functions
Sld_stack

Data Structures

struct  sld_stack
 

Typedefs

typedef struct sld_stack sld_stack
 

Enumerations

enum  sld_stack_type { sld_stack_list = 0, sld_stack_vector = 1 }
 

Functions

SLD_SSINT sld_stack_init (struct sld_stack *stack, sld_stack_type stack_type)
 Initializes a sld_stack. More...
 
SLD_UINT sld_stack_size (struct sld_stack *stack)
 Returns the size of a sld_stack. More...
 
SLD_SSINT sld_stack_push (struct sld_stack *stack, void *object)
 Adds an object to the top of a sld_stack. More...
 
void * sld_stack_pop (struct sld_stack *stack)
 Returns and removes the object at the top of a sld_stack. More...
 
void * sld_stack_peek (struct sld_stack *stack)
 Returns the object at the top of a sld_stack. More...
 
void sld_stack_free (struct sld_stack *stack)
 Frees any memory allocated for an initialized sld_stack. More...
 

Detailed Description

This module contains enums, functions, and structures related to sld_stack objects.

Typedef Documentation

typedef struct sld_stack sld_stack

A sld_stack contains data in a LIFO (last in, first out) arrangement

Enumeration Type Documentation

These constants allow the user to define how stack data should reside in memory (contiguous or not.) This can also affect performance (resizing arrays can be expensive in the case of a vector for example.)

Enumerator
sld_stack_list 
sld_stack_vector 

Function Documentation

void sld_stack_free ( struct sld_stack stack)
related

Frees any memory allocated for an initialized sld_stack.

Parameters
stackan initialized sld_stack
Examples:
stack.c.
SLD_SSINT sld_stack_init ( struct sld_stack stack,
sld_stack_type  stack_type 
)
related

Initializes a sld_stack.

Parameters
stackan uninitialized sld_stack
stack_typecan be either a sld_stack_list or sld_stack_vector
Returns
Success or failure
Examples:
stack.c.
void * sld_stack_peek ( struct sld_stack stack)
related

Returns the object at the top of a sld_stack.

Parameters
stackan initialized sld_stack
Returns
The object at the top of the passed sld_stack
puts((char *)sld_stack_pop(&stack));
Examples:
stack.c.
void * sld_stack_pop ( struct sld_stack stack)
related

Returns and removes the object at the top of a sld_stack.

Parameters
stackan initialized sld_stack
Returns
The object at the top of the passed sld_stack
puts((char *)sld_stack_pop(&stack));
Examples:
stack.c.
SLD_SSINT sld_stack_push ( struct sld_stack stack,
void *  object 
)
related

Adds an object to the top of a sld_stack.

Parameters
stackan initialized sld_stack
objectan arbitrary object
Returns
Success or failure
sld_stack_push(&stack, "foo");
Examples:
stack.c.
SLD_UINT sld_stack_size ( struct sld_stack stack)
related

Returns the size of a sld_stack.

Parameters
stackan initialized sld_stack
Returns
The size of the passed sld_stack
printf("There are %u items in the stack.\n", sld_stack_size(&stack));
Examples:
stack.c.