diff options
author | Freya Murphy <freya@freyacat.org> | 2024-09-09 12:41:49 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-09-09 12:41:49 -0400 |
commit | 2ed275821676a0d5baea6c7fd843d71c72c2342c (patch) | |
tree | 480297f28e5c42d02a47b3b94027a7abe507d010 /include/merror.h | |
download | mips-2ed275821676a0d5baea6c7fd843d71c72c2342c.tar.gz mips-2ed275821676a0d5baea6c7fd843d71c72c2342c.tar.bz2 mips-2ed275821676a0d5baea6c7fd843d71c72c2342c.zip |
initial mips32 (r2000ish mips32r6) assembler
Diffstat (limited to 'include/merror.h')
-rw-r--r-- | include/merror.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/merror.h b/include/merror.h new file mode 100644 index 0000000..727111d --- /dev/null +++ b/include/merror.h @@ -0,0 +1,37 @@ +/* Copyright (c) 2024 Freya Murphy */ +#ifndef __MERROR_H__ +#define __MERROR_H__ + +/* Error codes + */ +#define M_SUCCESS 0 +#define M_EOF 1 +#define M_ERROR -1 + +#define __DEBUG 1 +#define __WARNING 2 +#define __ERROR 3 + +__attribute__((format(printf, 4, 5))) +void __log_impl_pos(int line, int column, int type, const char *format, ...); +void __log_impl(int type, const char *format, ...); + +#define DEBUG(format, ...) \ + __log_impl(__DEBUG, format, ##__VA_ARGS__) + +#define WARNING(format, ...) \ + __log_impl(__WARNING, format, ##__VA_ARGS__) + +#define ERROR(format, ...) \ + __log_impl(__ERROR, format, ##__VA_ARGS__) + +#define DEBUG_POS(pos, format, ...) \ + __log_impl_pos(pos.y, pos.x, __DEBUG, format, ##__VA_ARGS__) + +#define WARNING_POS(pos, format, ...) \ + __log_impl_pos(pos.y, pos.x, __WARNING, format, ##__VA_ARGS__) + +#define ERROR_POS(pos, format, ...) \ + __log_impl_pos(pos.y, pos.x, __ERROR, format, ##__VA_ARGS__) + +#endif /* __MERROR_H__ */ |