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_INDEX
,
19
ERR_MAX_SIZE_EXCEEDED
,
20
}
error_code_t
;
21
22
#define ERROR_IF(expr, then) \
23
{ \
24
error_code_t _err; \
25
if ((_err = (expr)) != ERR_OK) { \
26
then; \
27
} \
28
}
29
30
#define ERROR_RET(expr) ERROR_IF(expr, return _err)
31
#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_FILE_NOT_FOUND
@ ERR_FILE_NOT_FOUND
Definition
err.h:17
ERR_INVALID_INDEX
@ ERR_INVALID_INDEX
Definition
err.h:18
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:19
Generated by
1.13.2