49#ifndef JUNO_DS_STACK_API_H
50#define JUNO_DS_STACK_API_H
96 ptStack->ptApi->Push &&
97 ptStack->ptApi->Pop &&
Abstract fixed-capacity array interface for DS modules.
struct JUNO_DS_ARRAY_ROOT_TAG JUNO_DS_ARRAY_ROOT_T
Opaque array root carrying capacity and API pointer.
Definition array_api.h:58
static JUNO_STATUS_T JunoDs_ArrayVerify(const JUNO_DS_ARRAY_ROOT_T *ptArray)
Verify an array instance's capacity and API.
Definition array_api.h:117
#define JUNO_ASSERT_EXISTS(ptr)
Returns JUNO_STATUS_NULLPTR_ERROR if the expression is falsy.
Definition macros.h:50
#define JUNO_MODULE_ROOT(API_T,...)
Implement a module root struct containing ptApi and failure fields.
Definition module.h:126
void(* JUNO_FAILURE_HANDLER_T)(JUNO_STATUS_T tStatus, const char *pcCustomMessage, JUNO_USER_DATA_T *pvUserData)
Failure handler callback signature.
Definition status.h:104
int32_t JUNO_STATUS_T
Canonical status type for LibJuno functions.
Definition status.h:49
void JUNO_USER_DATA_T
Opaque user data type for failure callbacks.
Definition status.h:96
Common assertion and helper macros for LibJuno modules.
Module system and dependency injection primitives for LibJuno.
struct JUNO_POINTER_TAG JUNO_POINTER_T
Definition pointer_api.h:49
struct JUNO_DS_STACK_ROOT_TAG JUNO_DS_STACK_ROOT_T
The stack root module.
Definition stack_api.h:61
static JUNO_STATUS_T JunoDs_StackVerify(const JUNO_DS_STACK_ROOT_T *ptStack)
Definition stack_api.h:91
JUNO_STATUS_T JunoDs_StackPush(JUNO_DS_STACK_ROOT_T *ptStack, JUNO_POINTER_T tItem)
Push an item onto the top of the stack (O(1)).
Definition juno_buff_stack.c:27
JUNO_STATUS_T JunoDs_StackInit(JUNO_DS_STACK_ROOT_T *ptStack, JUNO_DS_ARRAY_ROOT_T *ptStackArray, JUNO_FAILURE_HANDLER_T pfcnFailureHdlr, JUNO_USER_DATA_T *pvFailureUserData)
Initialize a stack over a backing array with a given capacity.
Definition juno_buff_stack.c:98
JUNO_STATUS_T JunoDs_StackPop(JUNO_DS_STACK_ROOT_T *ptStack, JUNO_POINTER_T tReturn)
Pop the top item into tReturn (O(1)).
Definition juno_buff_stack.c:51
JUNO_RESULT_POINTER_T JunoDs_StackPeek(JUNO_DS_STACK_ROOT_T *ptStack)
Peek at the top item without removing it (O(1)).
Definition juno_buff_stack.c:75
Status codes and failure-handling helpers for LibJuno.
Definition stack_api.h:74
JUNO_STATUS_T(* Pop)(JUNO_DS_STACK_ROOT_T *ptStack, JUNO_POINTER_T tReturn)
Pop the top item into tReturn (O(1)).
Definition stack_api.h:84
JUNO_RESULT_POINTER_T(* Peek)(JUNO_DS_STACK_ROOT_T *ptStack)
Peek at the top item without removing it (O(1)).
Definition stack_api.h:88
JUNO_STATUS_T(* Push)(JUNO_DS_STACK_ROOT_T *ptStack, JUNO_POINTER_T tItem)
Push an item onto the top of the stack (O(1)).
Definition stack_api.h:79