2022-10-27 15:16:54 -06:00
|
|
|
#ifndef ARC_STD_ERRNO_H_
|
|
|
|
|
#define ARC_STD_ERRNO_H_
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2024-05-20 03:46:04 -06:00
|
|
|
#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
|
|
|
|
|
#define ARC_ERRNO_CONNECTION -0x07
|
2022-10-27 15:16:54 -06:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-01-12 19:48:06 -07:00
|
|
|
extern int32_t arc_errno;
|
|
|
|
|
|
2024-08-27 03:23:29 -06:00
|
|
|
#ifdef ARC_DEBUG
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
//this is handy to override for if they user is doing terminal output and wants to change where logs are sent
|
|
|
|
|
extern FILE *arc_errno_log_file;
|
|
|
|
|
|
|
|
|
|
#ifndef ARC_DEBUG_LOG_STREAM_OVERRIDE
|
|
|
|
|
//this functin will be called on start, handy to set the log file to stdout if it is not overrided
|
|
|
|
|
void __attribute__ ((constructor)) ARC_Errno_SetDefaultStream(void);
|
|
|
|
|
#endif // !ARC_DEBUG_LOG_STREAM_OVERRIDE
|
|
|
|
|
#endif // !ARC_DEBUG
|
|
|
|
|
|
2022-10-27 15:16:54 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ARC_DEBUG
|
2024-08-27 03:23:29 -06:00
|
|
|
#define ARC_DEBUG_LOG_ERROR(STR) fprintf(arc_errno_log_file, "[ERROR %d] " STR "\n", arc_errno)
|
|
|
|
|
#define ARC_DEBUG_LOG_ERROR_WITH_VARIABLES(STR, ...) fprintf(arc_errno_log_file, "[ERROR %d] " STR "\n", arc_errno, __VA_ARGS__)
|
2022-10-27 15:16:54 -06:00
|
|
|
#else
|
2024-08-27 03:23:29 -06:00
|
|
|
#define ARC_DEBUG_LOG_ERROR(STR)
|
|
|
|
|
#define ARC_DEBUG_LOG_ERROR_WITH_VARIABLES(STR, ...)
|
|
|
|
|
#endif // !ARC_DEBUG
|
2022-10-27 15:16:54 -06:00
|
|
|
|
2024-08-27 03:23:29 -06:00
|
|
|
#endif // !ARC_STD_ERRNO_H_
|