Home > Support > Documentation

Stack Utility Functions


Detailed Description

This is a simple stack structure with supporting push and pop functions. Different initialization routines are provided to permit different memory management schemes.


Classes

struct  _OSRTStack
struct  _OSRTStack

Typedefs

typedef _OSRTStack OSRTStack

Functions

EXTERNRTX OSRTStackrtxStackCreate (void)
EXTERNRTX OSRTStackrtxStackCreateEx (OSCTXT *pctxt)
EXTERNRTX void rtxStackInit (OSRTStack *pStack)
EXTERNRTX void * rtxStackPop (OSRTStack *pStack)
EXTERNRTX int rtxStackPush (OSRTStack *pStack, void *pData)

Function Documentation

EXTERNRTX OSRTStack* rtxStackCreate ( void   ) 

This function creates a new stack structure. It allocates memory for the structure and calls rtxStackInit to initialize the structure.

Returns:
A pointer to an allocated stack structure.

EXTERNRTX OSRTStack* rtxStackCreateEx ( OSCTXT pctxt  ) 

This function creates a new stack structure. The pctxt will be used for memory management.

Parameters:
pctxt A pointer to a context structure.
Returns:
A pointer to an allocated stack structure.

EXTERNRTX void rtxStackInit ( OSRTStack pStack  ) 

This function initializes a stack structure. It sets the number of elements to zero and sets all internal pointer values to NULL.

Parameters:
pStack A pointer to a stack structure to be initialized.

EXTERNRTX void* rtxStackPop ( OSRTStack pStack  ) 

This function pops an item off the stack.

Parameters:
pStack The pointer to the stack structure from which the value is to be popped. Pointer to the updated stack structure.
Returns:
The pointer to the item popped from the stack

EXTERNRTX int rtxStackPush ( OSRTStack pStack,
void *  pData 
)

This function pushes an item onto the stack.

Parameters:
pStack A pointer to the structure onto which the data item is to be pushed. The pointer updated to the stack structure
pData A pointer to the data item to be pushed on the stack.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.