swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "kint.h" |
| 4 | |
swissChili | 9bd74de | 2021-06-15 20:30:48 -0700 | [diff] [blame] | 5 | #define RESET "\033[0m" |
| 6 | #define INFO "[\033[96m INFO " RESET "] " |
| 7 | #define OKAY "[\033[92m OK " RESET "] " |
swissChili | b7ef65d | 2021-07-17 12:51:52 -0700 | [diff] [blame] | 8 | #define WARN "[\033[93m WARN " RESET "] " |
swissChili | 9bd74de | 2021-06-15 20:30:48 -0700 | [diff] [blame] | 9 | #define ERROR "[\033[91m ERROR " RESET "] " |
| 10 | #define DEBUG "[\033[93m DEBUG " RESET "] " |
swissChili | b58ab67 | 2022-01-17 21:18:01 -0800 | [diff] [blame] | 11 | #define BRKPT "[\033[96m BRKPT " RESET "] " |
| 12 | #define REACHED_HERE FORMAT_AT(__FILE__, __LINE__) |
| 13 | #define FORMAT_AT(file, line) "@" file ":%d\n", line |
swissChili | 9bd74de | 2021-06-15 20:30:48 -0700 | [diff] [blame] | 14 | |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 15 | void kprintf(const char *format, ...); |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 16 | void kassert_int(bool condition, const char *message, const char *file, |
| 17 | const int line); |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 18 | |
| 19 | #define kassert(cond, msg) kassert_int((cond), (msg), __FILE__, __LINE__) |
swissChili | 9bd74de | 2021-06-15 20:30:48 -0700 | [diff] [blame] | 20 | #define kpanic(msg) \ |
| 21 | kassert(false, msg); \ |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 22 | __builtin_unreachable() |