LibJuno 0.22.0
LibJuno is a lightweight C99 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*/
17#ifndef JUNO_STATUS_H
18#define JUNO_STATUS_H
19#ifdef __cplusplus
20extern "C" {
21#endif
42
43typedef void JUNO_USER_DATA_T;
44typedef void (*JUNO_FAILURE_HANDLER_T)(JUNO_STATUS_T tStatus, const char *pcCustomMessage, JUNO_USER_DATA_T *pvUserData);
45
46#ifndef FAIL_MESSAGE_LEN
47#define FAIL_MESSAGE_LEN 256
48#endif
49#define FAIL(tStatus, pfcnFailureHandler, pvFailureUserData, pcMessage)\
50if(pfcnFailureHandler){pfcnFailureHandler(tStatus, pcMessage, pvFailureUserData);}
51
52#define FAIL_MODULE(tStatus, ptMod, pcMessage)\
53if(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);}
54#ifdef __cplusplus
55}
56#endif
57#endif
void(* JUNO_FAILURE_HANDLER_T)(JUNO_STATUS_T tStatus, const char *pcCustomMessage, JUNO_USER_DATA_T *pvUserData)
Definition status.h:44
JUNO_STATUS_TAG
Definition status.h:23
@ JUNO_STATUS_TIMEOUT_ERROR
Definition status.h:40
@ JUNO_STATUS_WRITE_ERROR
Definition status.h:35
@ JUNO_STATUS_REF_IN_USE_ERROR
Definition status.h:38
@ JUNO_STATUS_NULLPTR_ERROR
Definition status.h:26
@ JUNO_STATUS_SUCCESS
Definition status.h:24
@ JUNO_STATUS_DNE_ERROR
Definition status.h:32
@ JUNO_STATUS_TABLE_FULL_ERROR
Definition status.h:31
@ JUNO_STATUS_READ_ERROR
Definition status.h:34
@ JUNO_STATUS_INVALID_REF_ERROR
Definition status.h:37
@ JUNO_STATUS_FILE_ERROR
Definition status.h:33
@ JUNO_STATUS_INVALID_TYPE_ERROR
Definition status.h:29
@ JUNO_STATUS_INVALID_DATA_ERROR
Definition status.h:39
@ JUNO_STATUS_MEMALLOC_ERROR
Definition status.h:27
@ JUNO_STATUS_MEMFREE_ERROR
Definition status.h:28
@ JUNO_STATUS_ERR
Definition status.h:25
@ JUNO_STATUS_INVALID_SIZE_ERROR
Definition status.h:30
@ JUNO_STATUS_CRC_ERROR
Definition status.h:36
enum JUNO_STATUS_TAG JUNO_STATUS_T
void JUNO_USER_DATA_T
Definition status.h:43