#ifndef HITLS_APP_ERRDECODE_H
#define HITLS_APP_ERRDECODE_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint64_t code;
const char *library;
const char *function;
const char *reason;
const char *fullDescription;
} ErrorEntry;
typedef struct {
uint64_t fullCode;
int32_t library;
int32_t function;
int32_t reason;
const char *libName;
const char *funcName;
const char *reasonStr;
} ErrorCodeFields;
typedef struct {
int32_t verboseMode;
int32_t stackMode;
int32_t hexMode;
int32_t helpMode;
int32_t stdinMode;
char **errorCodes;
int32_t numCodes;
} CommandOptions;
typedef enum {
FORMAT_DECIMAL,
FORMAT_HEX_WITH_PREFIX,
FORMAT_HEX_WITHOUT_PREFIX,
FORMAT_INVALID
} ErrorCodeFormat;
#define ERR_LIB_SHIFT 24
#define ERR_FUNC_SHIFT 12
#define ERR_LIB_MASK 0xFFU
#define ERR_FUNC_MASK 0xFFFU
#define ERR_REASON_MASK 0xFFFU
static inline int32_t ErrGetLib(uint64_t code)
{
return (int32_t)(((code) >> ERR_LIB_SHIFT) & ERR_LIB_MASK);
}
static inline int32_t ErrGetFunc(uint64_t code)
{
return (int32_t)(((code) >> ERR_FUNC_SHIFT) & ERR_FUNC_MASK);
}
static inline int32_t ErrGetReason(uint64_t code)
{
return (int32_t)((code) & ERR_REASON_MASK);
}
int32_t HITLS_ErrdecodeMain(int32_t argc, char *argv[]);
#ifdef __cplusplus
}
#endif
#endif