|
| #define | JunoMemory_PointerInit(ptApi, TYPE_T, pvAddr) (JUNO_POINTER_T){ptApi, pvAddr, sizeof(TYPE_T), alignof(TYPE_T)} |
| | Initialize a JUNO_POINTER_T with API, type, and address.
|
| |
| #define | JunoMemory_PointerVerifyType(pointer, type, tApi) |
| | Verify pointer descriptor matches an expected type and API.
|
| |
| #define | JUNO_ASSERT_POINTER_TYPE(tStatus, tPointer, tType, tApi) JUNO_ASSERT_SUCCESS((tStatus = JunoMemory_PointerVerifyType(tPointer, tType, tApi)), return tStatus) |
| | Assert a pointer descriptor's type and API, returning on failure.
|
| |
Defines a portable pointer trait (JUNO_POINTER_T) with an associated API for copying and resetting memory, along with helpers to verify type and alignment. A separate value-pointer API allows equality checks over pointer contents. These utilities are used by allocators and callers to enforce size/alignment constraints and perform safe operations in a freestanding-friendly way.
◆ JUNO_ASSERT_POINTER_TYPE
Assert a pointer descriptor's type and API, returning on failure.
- Parameters
-
| tStatus | Lvalue to receive the resulting status. |
| tPointer | The pointer descriptor to validate. |
| tType | The expected type of the pointee. |
| tApi | The expected pointer API symbol. |
◆ JunoMemory_PointerInit
| #define JunoMemory_PointerInit |
( |
|
ptApi, |
|
|
|
TYPE_T, |
|
|
|
pvAddr |
|
) |
| (JUNO_POINTER_T){ptApi, pvAddr, sizeof(TYPE_T), alignof(TYPE_T)} |
Initialize a JUNO_POINTER_T with API, type, and address.
- Parameters
-
| ptApi | Pointer to a valid JUNO_POINTER_API_T. |
| TYPE_T | The value type at pvAddr (deduces size and alignment). |
| pvAddr | Address of the value or buffer. |
- Returns
- A populated JUNO_POINTER_T describing the location, size, and alignment.
◆ JunoMemory_PointerVerifyType
| #define JunoMemory_PointerVerifyType |
( |
|
pointer, |
|
|
|
type, |
|
|
|
tApi |
|
) |
| |
Value:(( \
pointer.ptApi == &tApi && \
pointer.zSize == sizeof(type) && \
pointer.zAlignment == alignof(type) && \
(uintptr_t) pointer.pvAddr % pointer.zAlignment == 0 \
#define JUNO_STATUS_ERR
Unspecified error.
Definition status.h:58
#define JUNO_STATUS_SUCCESS
Operation completed successfully.
Definition status.h:56
Verify pointer descriptor matches an expected type and API.
- Parameters
-
| pointer | The JUNO_POINTER_T descriptor to verify. |
| type | The expected C type for the memory region. |
| tApi | The expected JUNO_POINTER_API_T symbol. |
- Returns
- JUNO_STATUS_SUCCESS if the descriptor is valid and matches, error otherwise.
◆ JUNO_MODULE_OPTION()
Option type carrying a pointer descriptor.
◆ JUNO_MODULE_RESULT()
Result type carrying a pointer descriptor.
◆ JunoMemory_PointerApiVerify()
Verify that a pointer API provides required functions.
- Parameters
-
| ptPointerApi | Pointer to the API vtable. |
- Returns
- JUNO_STATUS_SUCCESS if all required functions are present.
◆ JunoMemory_PointerVerify()
Verify a pointer descriptor (API non-null, address non-null, size non-zero).
- Parameters
-
| tPointer | The pointer descriptor to check. |
- Returns
- JUNO_STATUS_SUCCESS if valid; error otherwise.
◆ JunoMemory_ValuePointerApiVerify()
Verify that a value-pointer API provides required functions.
- Parameters
-
| ptPointerApi | Pointer to the value-pointer API vtable. |
- Returns
- JUNO_STATUS_SUCCESS if all required functions are present.