2024-07-20 21:42:49 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
enum class ErrorCode {
|
|
|
|
Success,
|
2024-07-27 00:01:38 +00:00
|
|
|
OutOfMemory,
|
2024-07-27 15:25:44 +00:00
|
|
|
IndexOutOfRange,
|
|
|
|
TypeMismatch,
|
2024-07-27 22:13:59 +00:00
|
|
|
ReadError,
|
|
|
|
UnterminatedStringLiteral,
|
2024-07-28 16:54:04 +00:00
|
|
|
InvalidNumericLiteral,
|
|
|
|
NotImplemented,
|
|
|
|
InvalidSymbol,
|
|
|
|
MalformedList,
|
2024-08-01 21:45:16 +00:00
|
|
|
KeyError,
|
2024-08-12 22:05:40 +00:00
|
|
|
EndOfProgram,
|
2024-08-15 00:18:05 +00:00
|
|
|
CompilationError,
|
2024-08-17 22:22:21 +00:00
|
|
|
ArgumentCountMismatch,
|
2024-08-18 19:01:40 +00:00
|
|
|
IOError,
|
2024-08-26 12:16:05 +00:00
|
|
|
Interrupt,
|
2024-08-27 19:19:47 +00:00
|
|
|
AssertionFailed,
|
2024-07-20 21:42:49 +00:00
|
|
|
};
|
2024-08-10 10:17:20 +00:00
|
|
|
|
|
|
|
void seterr(const char* err);
|
|
|
|
const char* geterr(void);
|
|
|
|
|
|
|
|
#define STRINGIZE_NESTED(A) #A
|
|
|
|
#define STRINGIZE(A) STRINGIZE_NESTED(A)
|
|
|
|
|
|
|
|
#define ERROR(code) \
|
|
|
|
(({ \
|
|
|
|
seterr("Error " STRINGIZE(code) " at " __FILE__ ":" STRINGIZE(__LINE__)); \
|
|
|
|
ErrorCode::code; \
|
|
|
|
}))
|