35#ifndef JUNO_POINTER_API_H
36#define JUNO_POINTER_API_H
118#define JunoMemory_PointerInit(ptApi, TYPE_T, pvAddr) (JUNO_POINTER_T){ptApi, pvAddr, sizeof(TYPE_T), alignof(TYPE_T)}
128#define JunoMemory_PointerVerifyType(pointer, type, tApi) \
130 JunoMemory_PointerVerify(pointer) == JUNO_STATUS_SUCCESS && \
131 pointer.ptApi == &tApi && \
132 pointer.zSize == sizeof(type) && \
133 pointer.zAlignment == alignof(type) && \
134 (uintptr_t) pointer.pvAddr % pointer.zAlignment == 0 \
135)?JUNO_STATUS_SUCCESS:JUNO_STATUS_ERR)
146#define JUNO_ASSERT_POINTER_TYPE(tStatus, tPointer, tType, tApi) JUNO_ASSERT_SUCCESS((tStatus = JunoMemory_PointerVerifyType(tPointer, tType, tApi)), return tStatus)
158 ptPointerApi->
Copy &&
#define JUNO_ASSERT_EXISTS(ptr)
Returns JUNO_STATUS_NULLPTR_ERROR if the expression is falsy.
Definition macros.h:50
#define JUNO_ASSERT_SUCCESS(tStatus,...)
Execute the provided failure operation(s) if status is not success.
Definition macros.h:87
static JUNO_STATUS_T JunoMemory_ValuePointerApiVerify(const JUNO_VALUE_POINTER_API_T *ptPointerApi)
Verify that a value-pointer API provides required functions.
Definition pointer_api.h:170
static JUNO_STATUS_T JunoMemory_PointerApiVerify(const JUNO_POINTER_API_T *ptPointerApi)
Verify that a pointer API provides required functions.
Definition pointer_api.h:154
static JUNO_STATUS_T JunoMemory_PointerVerify(const JUNO_POINTER_T tPointer)
Verify a pointer descriptor (API non-null, address non-null, size non-zero).
Definition pointer_api.h:185
#define JUNO_MODULE_RESULT(NAME_T, OK_T)
Define a result type combining a status and a success payload.
Definition module.h:193
#define JUNO_TRAIT_ROOT(API_T,...)
Define a trait root carrying only the API pointer and members.
Definition module.h:142
#define JUNO_MODULE_OPTION(NAME_T, SOME_T)
Define an option type combining a presence flag and a payload.
Definition module.h:236
#define JUNO_STATUS_SUCCESS
Operation completed successfully.
Definition status.h:56
int32_t JUNO_STATUS_T
Canonical status type for LibJuno functions.
Definition status.h:49
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
Status codes and failure-handling helpers for LibJuno.
Pointer operations API (copy/reset).
Definition pointer_api.h:74
JUNO_STATUS_T(* Reset)(JUNO_POINTER_T tPointer)
Reset the memory at the pointer (e.g., zero-initialize).
Definition pointer_api.h:83
JUNO_STATUS_T(* Copy)(JUNO_POINTER_T tDest, const JUNO_POINTER_T tSrc)
Copy memory from source to destination.
Definition pointer_api.h:79
Value-pointer operations API (equality by contents).
Definition pointer_api.h:94
JUNO_RESULT_BOOL_T(* Equals)(const JUNO_POINTER_T tLeft, const JUNO_POINTER_T tRight)
Compare two pointer values for equality (by contents).
Definition pointer_api.h:97
Common module result type aliases used throughout LibJuno.