1 #ifndef FREEHDL_KERNEL_ERROR_H
2 #define FREEHDL_KERNEL_ERROR_H
3 
4 // FreeHDL error handler interface.
5 
6 #include <string>
7 
8 #define ERROR_INTEGER_OVERFLOW 100
9 #define ERROR_FLOATING_POINT_OVERFLOW 101
10 #define ERROR_ENUM_OVERFLOW 102
11 #define ERROR_PHYSICAL_OVERFLOW 103
12 #define ERROR_ARRAY_INDEX 104
13 #define ERROR_INCOMPATIBLE_ARRAYS 105
14 #define ERROR_UNKNOWN_COMPONENT 106
15 #define ERROR_DUBLICATE_INSTANCE_NAME 107
16 #define ERROR_ARRAY_INDEX_OUT_OF_BOUNDS 108
17 #define ERROR_SCALAR_OUT_OF_BOUNDS 109
18 #define ERROR_ARRAY_LENGTH_MISMATCH 110
19 #define ERROR_ARRAY_BOUNDS_MISMATCH 111
20 #define ERROR_FILE_IO 112
21 #define ERROR_TEXTIO 113
22 #define ERROR_NO_SOCKETS 114
23 
24 //Event handler internal errors
25 #define ERROR_EVENT_GENERAL_ERROR 200
26 
27 #define ERROR_NOT_SUPPORTED 1000
28 
29 
30 // Prints an error message on the screen and stops program execution
31 void error(const int errnum, const char *str);
32 
33 // Prints string on the screen and stops program execution
34 void error(const char *str);
35 
36 // Prints string on the screen and stops program execution
37 void error(const int errnum);
38 
39 struct type_info_interface;
40 // Prints string on the screen and stops program execution
41 void error(int errnum, type_info_interface *info, void *valuep);
42 
43 // Prints string on the screen
44 void debug(const char *str, const char *file, const int line);
45 
46 
47 #ifdef DEBUG
48 void execute_assert(bool expr, string str);
49 #define v_assert(a,b) execute_assert(a,b,__FILE__,__LINE__)
50 #else
51 #define v_assert(a,b)
52 #endif
53 
54 #endif
55