libmya
0.1.0
Library to parse Mya language.
Loading...
Searching...
No Matches
src
include
types
err.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
colors.h
"
4
5
#define ERR_CTX_SIZE 3
6
#define ERR_CTX_LINE_WRAP 80
7
8
#define ERR_PREFIX C_RED "Error" C_NORMAL ": "
9
13
typedef
enum
error_code
14
{
15
ERR_OK
= 0,
16
ERR_EMPTY
,
17
ERR_FILE_NOT_FOUND
,
18
ERR_INVALID_CODE
,
19
ERR_INVALID_INDEX
,
20
ERR_MAX_SIZE_EXCEEDED
,
21
}
error_code_t
;
22
23
#define ERROR_IF(expr, then) \
24
{ \
25
error_code_t _err; \
26
if ((_err = (expr)) != ERR_OK) { \
27
then; \
28
} \
29
}
30
31
#define ERROR_RET(expr) ERROR_IF(expr, return _err)
32
#define ERROR_BREAK(expr) ERROR_IF(expr, break)
colors.h
error_code_t
enum error_code error_code_t
Enumeration of error codes.
error_code
error_code
Enumeration of error codes.
Definition
err.h:14
ERR_INVALID_CODE
@ ERR_INVALID_CODE
Definition
err.h:18
ERR_FILE_NOT_FOUND
@ ERR_FILE_NOT_FOUND
Definition
err.h:17
ERR_INVALID_INDEX
@ ERR_INVALID_INDEX
Definition
err.h:19
ERR_OK
@ ERR_OK
Definition
err.h:15
ERR_EMPTY
@ ERR_EMPTY
Definition
err.h:16
ERR_MAX_SIZE_EXCEEDED
@ ERR_MAX_SIZE_EXCEEDED
Definition
err.h:20
Generated by
1.13.2