This is a simple stack structure with supporting push and pop functions. Different initialization routines are provided to permit different memory management schemes.
◆ rtxStackIsEmpty
#define rtxStackIsEmpty |
( |
|
stack | ) |
(OSBOOL)((stack).dlist.count == 0) |
This macro tests if the stack is empty.
- Parameters
-
stack | Stack structure variable to be tested. |
◆ rtxStackCreate()
This function creates a new stack structure. It allocates memory for the structure and calls rtxStackInit to initialize the structure.
- Parameters
-
pctxt | A pointer to the context with which the stack is associated. |
- Returns
- A pointer to an allocated stack structure.
◆ rtxStackInit()
This function initializes a stack structure. It sets the number of elements to zero and sets all internal pointer values to NULL.
- Parameters
-
pctxt | A pointer to the context with which the stack is associated. |
pStack | A pointer to a stack structure to be initialized. |
◆ rtxStackPeek()
This functions returns the data item on the top of 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 |
- Returns
- Pointer to data item at top of stack or NULL if stack empty.
- 0 (0) = success,
- negative return value is error.
◆ rtxStackPop()
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
◆ rtxStackPush()
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.