-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy patherrors.h
110 lines (96 loc) · 2.92 KB
/
errors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* Description: Errors module of the Chaos Programming Language's source
*
* Copyright (c) 2019-2021 Chaos Language Development Authority <[email protected]>
*
* License: GNU General Public License v3.0
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>
*
* Authors: M. Mert Yildiran <[email protected]>
*/
#ifndef KAOS_ERRORS_H
#define KAOS_ERRORS_H
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <setjmp.h>
#include <string.h>
#include "../utilities/language.h"
#include "function.h"
enum ExitCode {
E_SUCCESS,
E_SYNTAX_ERROR,
E_UNKNOWN_VARIABLE_TYPE,
E_VARIABLE_ALREADY_DEFINED,
E_UNDEFINED_VARIABLE,
E_MEMORY_ALLOCATION_FOR_LIST_FAILED,
E_ILLEGAL_ELEMENT_TYPE_FOR_TYPED_LIST,
E_VARIABLE_IS_NOT_AN_LIST,
E_INDEX_OUT_OF_RANGE,
E_ILLEGAL_VARIABLE_TYPE_FOR_VARIABLE,
E_VARIABLE_IS_NOT_A_DICTIONARY,
E_UNDEFINED_KEY,
E_UNRECOGNIZED_COMPLEX_DATA_TYPE,
E_ILLEGAL_VARIABLE_TYPE_FOR_FUNCTION,
E_UNDEFINED_FUNCTION,
E_MEMORY_ALLOCATION_FOR_FUNCTION_FAILED,
E_UNEXPECTED_VALUE_TYPE,
E_FUNCTION_DID_NOT_RETURN_ANYTHING,
E_MODULE_IS_EMPTY_OR_NOT_EXISTS_ON_PATH,
E_NO_VARIABLE_WITH_ID,
E_INDEX_OUT_OF_RANGE_STRING,
E_ILLEGAL_CHARACTER_ASSIGNMENT_FOR_STRING,
E_NOT_A_CHARACTER,
E_PROGRAM_FILE_DOES_NOT_EXISTS_ON_PATH,
E_INCORRECT_FUNCTION_ARGUMENT_COUNT,
E_NOT_A_LIST,
E_NOT_A_DICT,
E_RAISED_FROM_AN_EXTENSION,
E_ILLEGAL_VARIABLE_TYPE_FOR_FUNCTION_PARAMETER,
E_UNEXPECTED_ACCESSOR_DATA_TYPE,
E_INVALID_OPTION,
E_NEGATIVE_ITERATION_COUNT,
E_BREAK_CALL_OUTSIDE_LOOP,
E_BREAK_CALL_MULTILINE_LOOP,
E_STACK_OVERFLOW,
E_PREEMPTIVE
};
extern void freeEverything();
#ifndef CHAOS_COMPILER
extern void absorbError();
#endif
#ifndef CHAOS_COMPILER
extern bool is_interactive;
#endif
extern jmp_buf InteractiveShellErrorAbsorber;
void throw_error_base(
unsigned short code,
char *str1,
char *str2,
long long lld1,
unsigned long long llu1,
_Function* function
);
typedef struct {
unsigned short code;
char *str1;
char *str2;
long long lld1;
unsigned long long llu1;
_Function* function;
} throw_error_args;
void throw_error_var(throw_error_args in);
#define throw_error(...) throw_error_var((throw_error_args){__VA_ARGS__});
int InteractiveShellErrorAbsorber_ws_col;
#endif