LibJuno
1.0.1
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
#ifndef JUNO_STATUS_H
41
#define JUNO_STATUS_H
42
#include <stdint.h>
43
#ifdef __cplusplus
44
extern
"C"
{
45
#endif
49
typedef
int32_t
JUNO_STATUS_T
;
56
#define JUNO_STATUS_SUCCESS 0
58
#define JUNO_STATUS_ERR 1
60
#define JUNO_STATUS_NULLPTR_ERROR 2
62
#define JUNO_STATUS_MEMALLOC_ERROR 3
64
#define JUNO_STATUS_MEMFREE_ERROR 4
66
#define JUNO_STATUS_INVALID_TYPE_ERROR 5
68
#define JUNO_STATUS_INVALID_SIZE_ERROR 6
70
#define JUNO_STATUS_TABLE_FULL_ERROR 7
72
#define JUNO_STATUS_DNE_ERROR 8
74
#define JUNO_STATUS_FILE_ERROR 9
76
#define JUNO_STATUS_READ_ERROR 10
78
#define JUNO_STATUS_WRITE_ERROR 11
80
#define JUNO_STATUS_CRC_ERROR 12
82
#define JUNO_STATUS_INVALID_REF_ERROR 13
84
#define JUNO_STATUS_REF_IN_USE_ERROR 14
86
#define JUNO_STATUS_INVALID_DATA_ERROR 15
88
#define JUNO_STATUS_TIMEOUT_ERROR 16
90
#define JUNO_STATUS_OOB_ERROR 17
96
typedef
void
JUNO_USER_DATA_T
;
104
typedef
void (*
JUNO_FAILURE_HANDLER_T
)(
JUNO_STATUS_T
tStatus,
const
char
*pcCustomMessage,
JUNO_USER_DATA_T
*pvUserData);
105
109
#ifndef JUNO_FAIL_MESSAGE_LEN
110
#define JUNO_FAIL_MESSAGE_LEN 256
111
#endif
123
#define JUNO_FAIL(tStatus, pfcnFailureHandler, pvFailureUserData, pcMessage) \
124
if(pfcnFailureHandler){pfcnFailureHandler(tStatus, pcMessage, pvFailureUserData);}
125
138
#define JUNO_FAIL_MODULE(tStatus, ptMod, pcMessage) \
139
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);}
140
149
#define JUNO_FAIL_ROOT(tStatus, ptMod, pcMessage) \
150
if(ptMod && ptMod->JUNO_FAILURE_HANDLER){ptMod->JUNO_FAILURE_HANDLER(tStatus, pcMessage, ptMod->JUNO_FAILURE_USER_DATA);}
151
152
#ifdef __cplusplus
153
}
154
#endif
155
#endif
JUNO_FAILURE_HANDLER_T
void(* JUNO_FAILURE_HANDLER_T)(JUNO_STATUS_T tStatus, const char *pcCustomMessage, JUNO_USER_DATA_T *pvUserData)
Failure handler callback signature.
Definition
status.h:104
JUNO_STATUS_T
int32_t JUNO_STATUS_T
Canonical status type for LibJuno functions.
Definition
status.h:49
JUNO_USER_DATA_T
void JUNO_USER_DATA_T
Opaque user data type for failure callbacks.
Definition
status.h:96
include
juno
status.h
Generated by
1.9.8