From f011d871ef3af26c8f4e19de2c8d781c601ceffb Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Fri, 11 Oct 2024 00:32:49 +0200 Subject: Add console printing --- asl/print.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 asl/print.hpp (limited to 'asl/print.hpp') diff --git a/asl/print.hpp b/asl/print.hpp new file mode 100644 index 0000000..d82d52b --- /dev/null +++ b/asl/print.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include "asl/format.hpp" + +namespace asl +{ + +namespace print_internals +{ + +// @Todo Make print writers thread safe +writer* get_stdout_writer(); +writer* get_stderr_writer(); + +} // namespace print_internals + +// @Todo Use string_view +template +void print(const char* fmt, const Args&... args) +{ + format(print_internals::get_stdout_writer(), fmt, args...); +} + +// @Todo Use string_view +template +void eprint(const char* fmt, const Args&... args) +{ + format(print_internals::get_stderr_writer(), fmt, args...); +} + +} // namespace asl -- cgit