|
LibJuno 1.0.1
LibJuno is a lightweight C11 library designed specifically for embedded systems.
|
Macros | |
| #define | JUNO_ASSERT_EXISTS(ptr) |
| Returns JUNO_STATUS_NULLPTR_ERROR if the expression is falsy. | |
| #define | JUNO_ASSERT_EXISTS_MODULE(ptr, ptMod, str) |
| Like JUNO_ASSERT_EXISTS but also calls the module's failure handler. | |
| #define | JUNO_ASSERT_SUCCESS(tStatus, ...) |
| Execute the provided failure operation(s) if status is not success. | |
These macros provide lightweight, freestanding-friendly assertions and failure-notification hooks. They are designed to return error codes rather than aborting, in line with LibJuno's deterministic error handling.
| #define JUNO_ASSERT_EXISTS | ( | ptr | ) |
Returns JUNO_STATUS_NULLPTR_ERROR if the expression is falsy.
Use to validate required pointers or expressions. Typical usage within a function that returns JUNO_STATUS_T:
| ptr | Pointer/expression to validate (may combine with &&). |
| #define JUNO_ASSERT_EXISTS_MODULE | ( | ptr, | |
| ptMod, | |||
| str | |||
| ) |
Like JUNO_ASSERT_EXISTS but also calls the module's failure handler.
Invokes JUNO_FAIL_MODULE(JUNO_STATUS_NULLPTR_ERROR, ptMod, str) before returning JUNO_STATUS_NULLPTR_ERROR.
| ptr | The dependency expression to validate. |
| ptMod | The module instance providing the failure handler. |
| str | Message passed to the failure handler upon failure. |
| #define JUNO_ASSERT_SUCCESS | ( | tStatus, | |
| ... | |||
| ) |
Execute the provided failure operation(s) if status is not success.
Intended for early-returns and cleanup in error paths:
The variadic statements are emitted verbatim inside the error branch; ensure they are valid in the enclosing scope.
| tStatus | Status value to check. |
| ... | Statements to execute when tStatus != JUNO_STATUS_SUCCESS. |