diff options
Diffstat (limited to 'kern/include')
| -rw-r--r-- | kern/include/kern/error.hpp | 13 | ||||
| -rw-r--r-- | kern/include/kern/print.hpp | 26 |
2 files changed, 39 insertions, 0 deletions
diff --git a/kern/include/kern/error.hpp b/kern/include/kern/error.hpp new file mode 100644 index 0000000..e58b9f1 --- /dev/null +++ b/kern/include/kern/error.hpp @@ -0,0 +1,13 @@ +#ifndef TEACHOS_KERN_ERROR_HPP +#define TEACHOS_KERN_ERROR_HPP + +#include <source_location> +#include <string_view> + +namespace teachos +{ + [[noreturn]] + auto panic(std::string_view message, std::source_location = std::source_location::current()) -> void; +} + +#endif diff --git a/kern/include/kern/print.hpp b/kern/include/kern/print.hpp new file mode 100644 index 0000000..fc9b5d6 --- /dev/null +++ b/kern/include/kern/print.hpp @@ -0,0 +1,26 @@ + +#ifndef TEACHOS_KERN_PRINT_HPP +#define TEACHOS_KERN_PRINT_HPP + +#include <string_view> + +namespace teachos +{ + + using print_handler = auto(std::string_view) -> void; + using println_handler = auto(std::string_view) -> void; + + auto print(std::string_view text) -> void; + auto println(std::string_view text) -> void; + + auto print_error(std::string_view text) -> void; + auto println_error(std::string_view text) -> void; + + auto set_print_handler(print_handler handler) -> print_handler *; + auto set_println_handler(println_handler handler) -> print_handler *; + auto set_print_error_handler(print_handler handler) -> print_handler *; + auto set_println_error_handler(println_handler handler) -> print_handler *; + +} // namespace teachos + +#endif |
