#pragma once #include class Console { public: virtual void write(char c) = 0; virtual void write(ViewIterator& msg) = 0; static void set(Console* ptr); static Console* get(); }; template void printk(const T& a) { if (auto* c = Console::get()) { if constexpr (is_same()) { c->write(a); } else if constexpr (requires { StringView(a); }) { StringView v(a); auto iter = v.begin(); c->write(iter); } else if constexpr (requires { IntegerView(a); }) { IntegerView v(a); auto iter = v.begin(); c->write(iter); } else c->write(a); } } template void printk(const T& a, const Args&... x) { printk(a); printk(x...); } extern "C" __attribute__((__noreturn__)) void abort();