archeus/include/arc/std/errno.h
2024-01-12 19:48:06 -07:00

34 lines
No EOL
775 B
C

#ifndef ARC_STD_ERRNO_H_
#define ARC_STD_ERRNO_H_
#include <stdint.h>
#define ARC_ERRNO_NULL -0x01
#define ARC_ERRNO_DATA -0x02
#define ARC_ERRNO_COPY -0x03
#define ARC_ERRNO_EXISTS -0x04
#define ARC_ERRNO_OVERFLOW -0x05
#define ARC_ERRNO_INIT -0x06
#ifdef __cplusplus
extern "C" {
#endif
extern int32_t arc_errno;
#ifdef __cplusplus
}
#endif
#ifdef ARC_DEBUG
# include <stdio.h>
# define ARC_DEBUG_LOG(ERR, STR, ...) printf("[ERROR %d] " STR "\n", ERR, __VA_ARGS__)
# define ARC_DEBUG_ERR(STR) printf("[ERROR %d] " STR "\n", arc_errno)
#else
# define ARC_DEBUG_LOG(ERR, STR, ...)
# define ARC_DEBUG_ERR(STR)
#endif
#define ARC_ERR_CHECK(FUNC) FUNC; if(arc_errno){ ARC_DEBUG_LOG(arc_errno, "%s", #FUNC); return; }
#endif //ARC_STD_ERRNO_H_