LibJuno 1.0.4
LibJuno is a lightweight C11 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
status.h
Go to the documentation of this file.
1/*
2 MIT License
3
4 Copyright (c) 2025 Robin A. Onsay
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files
8 (the "Software"), to deal in the Software without restriction,
9 including without limitation the rights to use, copy, modify, merge,
10 publish, distribute, sublicense, and/or sell copies of the Software,
11 and to permit persons to whom the Software is furnished to do so,
12 subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be
15 included in all copies or substantial portions of the Software.
16*/
40// @{"req": ["REQ-SYS-004", "REQ-SYS-005"]}
41#ifndef JUNO_STATUS_H
42#define JUNO_STATUS_H
43#include <stdint.h>
44#ifdef __cplusplus
45extern "C" {
46#endif
50// @{"req": ["REQ-STATUS-001"]}
51typedef int32_t JUNO_STATUS_T;
57// @{"req": ["REQ-STATUS-002"]}
59#define JUNO_STATUS_SUCCESS 0
61#define JUNO_STATUS_ERR 1
63#define JUNO_STATUS_NULLPTR_ERROR 2
65#define JUNO_STATUS_MEMALLOC_ERROR 3
67#define JUNO_STATUS_MEMFREE_ERROR 4
69#define JUNO_STATUS_INVALID_TYPE_ERROR 5
71#define JUNO_STATUS_INVALID_SIZE_ERROR 6
73#define JUNO_STATUS_TABLE_FULL_ERROR 7
75#define JUNO_STATUS_DNE_ERROR 8
77#define JUNO_STATUS_FILE_ERROR 9
79#define JUNO_STATUS_READ_ERROR 10
81#define JUNO_STATUS_WRITE_ERROR 11
83#define JUNO_STATUS_CRC_ERROR 12
85#define JUNO_STATUS_INVALID_REF_ERROR 13
87#define JUNO_STATUS_REF_IN_USE_ERROR 14
89#define JUNO_STATUS_INVALID_DATA_ERROR 15
91#define JUNO_STATUS_TIMEOUT_ERROR 16
93#define JUNO_STATUS_OOB_ERROR 17
95#define JUNO_STATUS_CUSTOM_ERROR 1000
101typedef void JUNO_USER_DATA_T;
109// @{"req": ["REQ-STATUS-003"]}
110typedef void (*JUNO_FAILURE_HANDLER_T)(JUNO_STATUS_T tStatus, const char *pcCustomMessage, JUNO_USER_DATA_T *pvUserData);
111
115#ifndef JUNO_FAIL_MESSAGE_LEN
116#define JUNO_FAIL_MESSAGE_LEN 256
117#endif
129// @{"req": ["REQ-STATUS-004"]}
130#define JUNO_FAIL(tStatus, pfcnFailureHandler, pvFailureUserData, pcMessage) \
131if(pfcnFailureHandler){pfcnFailureHandler(tStatus, pcMessage, pvFailureUserData);}
132
145#define JUNO_FAIL_MODULE(tStatus, ptMod, pcMessage) \
146if(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);}
147
156#define JUNO_FAIL_ROOT(tStatus, ptMod, pcMessage) \
157if(ptMod && ptMod->JUNO_FAILURE_HANDLER){ptMod->JUNO_FAILURE_HANDLER(tStatus, pcMessage, ptMod->JUNO_FAILURE_USER_DATA);}
158
159#ifdef __cplusplus
160}
161#endif
162#endif
void(* JUNO_FAILURE_HANDLER_T)(JUNO_STATUS_T tStatus, const char *pcCustomMessage, JUNO_USER_DATA_T *pvUserData)
Failure handler callback signature.
Definition status.h:110
int32_t JUNO_STATUS_T
Canonical status type for LibJuno functions.
Definition status.h:51
void JUNO_USER_DATA_T
Opaque user data type for failure callbacks.
Definition status.h:101