group Stacks

Description

Stacks are another useful data structure. Here is a stright forward implementation.

group attributes
function ferite_create_stack() - Create a stack
function ferite_stack_push() - Push a value onto the stack
function ferite_stack_pop() - Pop a value off the top of the stack and return it
function ferite_delete_stack() - Delete a stack and free up the memory it uses
function ferite_stack_top() - Return the top item off the stack without changing the stack's state
function ferite_duplicate_stack_contents() - Duplicate the contents of a stack

Functions

function ferite_create_stack Click to go up to the list
Create a stack
Declaration:
    FeriteStack *ferite_create_stack( FeriteScript *script, int size )
Description:
It is important to note that the stacks contents go from 1 to stack->stack_ptr
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: int size - The initial size of the stack
Returns:
    A new stack structure

function ferite_stack_push Click to go up to the list
Push a value onto the stack
Declaration:
    void ferite_stack_push( FeriteStack *stck, void *ptr )
Parameters:
    Parameter #1: FeriteStack *stck - The stack to push the value onto
    Parameter #2: void *ptr - The pointer to push onto the stack

function ferite_stack_pop Click to go up to the list
Pop a value off the top of the stack and return it
Declaration:
    void *ferite_stack_pop( FeriteStack *stck )
Parameters:
    Parameter #1: FeriteStack *stck - The stack to pop the value off
Returns:
    The popped off value

function ferite_delete_stack Click to go up to the list
Delete a stack and free up the memory it uses
Declaration:
    void ferite_delete_stack( FeriteScript *script, FeriteStack *stack )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteStack *stack - The stack to delete

function ferite_stack_top Click to go up to the list
Return the top item off the stack without changing the stack's state
Declaration:
    void *ferite_stack_top( FeriteStack *stck )
Parameters:
    Parameter #1: FeriteStack *stck - The stack to get the item off
Returns:
    The value

function ferite_duplicate_stack_contents Click to go up to the list
Duplicate the contents of a stack
Declaration:
    void **ferite_duplicate_stack_contents( FeriteScript *script, FeriteStack *stack, void *(*ddup)( FeriteScript*,void *data,void *data2 ), void *data2 )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteStack *stack - The stack whose contents should be duplicated
    Parameter #3: void *ddup - The function that gets called to copy the data
Returns:
    An exact copy of the stacks' contents

Automatically generated at 8:45pm, Wednesday 08 January 2003 by feritedoc.