LibJuno 1.0.1
LibJuno is a lightweight C11 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
status.h File Reference

Status codes and failure-handling helpers for LibJuno. More...

#include <stdint.h>
Include dependency graph for status.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define JUNO_STATUS_SUCCESS   0
 Operation completed successfully.
 
#define JUNO_STATUS_ERR   1
 Unspecified error.
 
#define JUNO_STATUS_NULLPTR_ERROR   2
 A required pointer argument was NULL or invalid.
 
#define JUNO_STATUS_MEMALLOC_ERROR   3
 Memory allocation failed (hosted or platform-specific allocator).
 
#define JUNO_STATUS_MEMFREE_ERROR   4
 Memory free operation failed or was invalid.
 
#define JUNO_STATUS_INVALID_TYPE_ERROR   5
 Provided type or trait did not match the expected one.
 
#define JUNO_STATUS_INVALID_SIZE_ERROR   6
 Provided size or alignment was invalid or unsupported.
 
#define JUNO_STATUS_TABLE_FULL_ERROR   7
 A fixed-capacity table/structure was full.
 
#define JUNO_STATUS_DNE_ERROR   8
 Requested element or key did not exist.
 
#define JUNO_STATUS_FILE_ERROR   9
 Generic file I/O error on hosted platforms.
 
#define JUNO_STATUS_READ_ERROR   10
 Read operation failed or returned less than requested.
 
#define JUNO_STATUS_WRITE_ERROR   11
 Write operation failed or returned less than requested.
 
#define JUNO_STATUS_CRC_ERROR   12
 CRC check failed or a CRC value was invalid.
 
#define JUNO_STATUS_INVALID_REF_ERROR   13
 A reference identifier or handle was invalid.
 
#define JUNO_STATUS_REF_IN_USE_ERROR   14
 Resource cannot be freed while references are still active.
 
#define JUNO_STATUS_INVALID_DATA_ERROR   15
 Input data failed validation.
 
#define JUNO_STATUS_TIMEOUT_ERROR   16
 Operation timed out.
 
#define JUNO_STATUS_OOB_ERROR   17
 Index or pointer was out of bounds.
 
#define JUNO_FAIL_MESSAGE_LEN   256
 Recommended maximum length for failure messages.
 
#define JUNO_FAIL(tStatus, pfcnFailureHandler, pvFailureUserData, pcMessage)   if(pfcnFailureHandler){pfcnFailureHandler(tStatus, pcMessage, pvFailureUserData);}
 Invoke a failure handler if provided.
 
#define JUNO_FAIL_MODULE(tStatus, ptMod, pcMessage)   if(ptMod && ptMod->JUNO_MODULE_SUPER.JUNO_FAILURE_HANDLER){ptMod->JUNO_MODULE_SUPER.JUNO_FAILURE_HANDLER(tStatus, pcMessage, ptMod->JUNO_MODULE_SUPER.JUNO_FAILURE_USER_DATA);}
 Invoke a module instance's failure handler if available.
 
#define JUNO_FAIL_ROOT(tStatus, ptMod, pcMessage)   if(ptMod && ptMod->JUNO_FAILURE_HANDLER){ptMod->JUNO_FAILURE_HANDLER(tStatus, pcMessage, ptMod->JUNO_FAILURE_USER_DATA);}
 Invoke a module root's failure handler if available.
 

Typedefs

typedef int32_t JUNO_STATUS_T
 Canonical status type for LibJuno functions.
 
typedef void JUNO_USER_DATA_T
 Opaque user data type for failure callbacks.
 
typedef void(* JUNO_FAILURE_HANDLER_T) (JUNO_STATUS_T tStatus, const char *pcCustomMessage, JUNO_USER_DATA_T *pvUserData)
 Failure handler callback signature.
 

Detailed Description

Status codes and failure-handling helpers for LibJuno.

This header defines the unified status type used across LibJuno along with a canonical set of status codes and small helper macros to invoke a user-provided failure handler. The design favors freestanding compatibility and deterministic error propagation.

Usage notes:

  • Functions that can fail should return JUNO_STATUS_T (or a JUNO_MODULE_RESULT wrapper that embeds a JUNO_STATUS_T alongside a value).
  • The failure handler is optional; when provided, helper macros will call it with the status and message but will not abort control flow.