GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > XLX / V9-0-0

Constituent: parser     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

stack.c File Reference

Stack manipulation functions. More...

#include "XLX_p.h"
#include "stdlib.h"
#include "string.h"
#include "stdio.h"

Include dependency graph for stack.c:


Functions

unsigned XLX_initStack (XLX_stack *stack, unsigned limit)
 Initialise a stack by allocating memory to hold the contents and setting limit and used.
void XLX_endStack (XLX_stack *stack)
 Free the memory allocated to the stack.
void XLX_destroyStack (XLX_stack *stack, XLX_pDelete dFn)
 Free the memory allocated to the stack and its elements.
unsigned XLX_push (XLX_stack *stack, void *ptr)
 Put a new item on the top of the stack and increment the counter, doubling the size of the stack if the stack is already full.
void * XLX_pop (XLX_stack *stack)
 Remove and return the top item on the stack.
void * XLX_peek (XLX_stack *stack)
 Look at the item on the top of the stack without removing it.
void XLX_dump (XLX_stack *stack)
 Print out the stack information.

Detailed Description

Stack manipulation functions.

Author:
James Swain & Owen Saxton
Id
stack.c,v 1.6 2006/07/29 00:04:40 saxton Exp

Function Documentation

void XLX_destroyStack XLX_stack stack,
XLX_pDelete  dFn
 

Free the memory allocated to the stack and its elements.

Parameters:
stack Stack to end
dFn Function to call to delete objects on the stack

void XLX_dump XLX_stack stack  ) 
 

Print out the stack information.

Parameters:
stack Stack to dump

void XLX_endStack XLX_stack stack  ) 
 

Free the memory allocated to the stack.

Parameters:
stack Stack to free

unsigned XLX_initStack XLX_stack stack,
unsigned  limit
 

Initialise a stack by allocating memory to hold the contents and setting limit and used.

Parameters:
stack Stack to initialise
limit Size of the stack
Return values:
0 If the stack was successfully initialised
-1 If there was an error allocating memory for the stack

void* XLX_peek XLX_stack stack  ) 
 

Look at the item on the top of the stack without removing it.

Parameters:
stack Stack to peek at
Returns:
Item on the top of the stack

void* XLX_pop XLX_stack stack  ) 
 

Remove and return the top item on the stack.

Parameters:
stack Stack to pop item off
Returns:
Item popped off the top of the stack

unsigned XLX_push XLX_stack stack,
void *  ptr
 

Put a new item on the top of the stack and increment the counter, doubling the size of the stack if the stack is already full.

Parameters:
stack Stack to push ptr onto
ptr Pointer to push onto stack
Return values:
0 If the item is added successfully
-1 If the stack needs to be extended to accomodate the new item and the memory allocation failed


Generated on Mon Jul 31 20:39:56 2006 by  doxygen 1.4.4