diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2025-12-19 11:55:48 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2025-12-19 11:55:48 +0100 |
| commit | e22c2dcad410504c65d8ccba0ab66d96cf0c61a1 (patch) | |
| tree | 1539ac3cca05ee763fcb0f490ff72c783d52ac7d /libs | |
| parent | de96b0588ab680e1002c12df7ea7900d7eb71cf8 (diff) | |
| download | teachos-e22c2dcad410504c65d8ccba0ab66d96cf0c61a1.tar.xz teachos-e22c2dcad410504c65d8ccba0ab66d96cf0c61a1.zip | |
kstd: clean up OS interface split
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/kstd/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | libs/kstd/include/kstd/bits/print_sink.hpp | 19 | ||||
| -rw-r--r-- | libs/kstd/include/kstd/os/error.hpp (renamed from libs/kstd/include/kstd/bits/os.hpp) | 4 | ||||
| -rw-r--r-- | libs/kstd/include/kstd/os/print.hpp | 14 | ||||
| -rw-r--r-- | libs/kstd/include/kstd/print | 15 | ||||
| -rw-r--r-- | libs/kstd/src/libc/stdlib.cpp | 2 | ||||
| -rw-r--r-- | libs/kstd/src/os/error.cpp (renamed from libs/kstd/src/bits/os.cpp) | 4 |
7 files changed, 48 insertions, 18 deletions
diff --git a/libs/kstd/CMakeLists.txt b/libs/kstd/CMakeLists.txt index 0814a5b..1f140f6 100644 --- a/libs/kstd/CMakeLists.txt +++ b/libs/kstd/CMakeLists.txt @@ -8,9 +8,11 @@ set(KSTD_LIBC_SYMBOLS ) target_sources("kstd" PRIVATE - "src/bits/os.cpp" "src/libc/stdlib.cpp" "src/libc/string.cpp" + + "src/os/error.cpp" + "src/mutex.cpp" ) @@ -22,12 +24,14 @@ target_sources("kstd" PUBLIC "include/kstd/bits/format_specs.hpp" "include/kstd/bits/format_string.hpp" "include/kstd/bits/formatter.hpp" - "include/kstd/bits/os.hpp" "include/kstd/bits/shared_ptr.hpp" "include/kstd/bits/unique_ptr.hpp" "include/kstd/ext/bitfield_enum" + "include/kstd/os/error.hpp" + "include/kstd/os/print.hpp" + "include/kstd/asm_ptr" "include/kstd/format" "include/kstd/memory" diff --git a/libs/kstd/include/kstd/bits/print_sink.hpp b/libs/kstd/include/kstd/bits/print_sink.hpp new file mode 100644 index 0000000..0e0955c --- /dev/null +++ b/libs/kstd/include/kstd/bits/print_sink.hpp @@ -0,0 +1,19 @@ +#ifndef KSTD_BITS_PRINT_SINK_HPP +#define KSTD_BITS_PRINT_SINK_HPP + +// IWYU pragma: private, include <kstd/print> + +#include <kstd/format> + +namespace kstd +{ + + enum struct print_sink + { + stdout, + stderr, + }; + +} // namespace kstd + +#endif
\ No newline at end of file diff --git a/libs/kstd/include/kstd/bits/os.hpp b/libs/kstd/include/kstd/os/error.hpp index 0474f16..9d43fb1 100644 --- a/libs/kstd/include/kstd/bits/os.hpp +++ b/libs/kstd/include/kstd/os/error.hpp @@ -1,5 +1,5 @@ -#ifndef KSTD_OS_HPP -#define KSTD_OS_HPP +#ifndef KSTD_OS_ERROR_HPP +#define KSTD_OS_ERROR_HPP #include <source_location> #include <string_view> diff --git a/libs/kstd/include/kstd/os/print.hpp b/libs/kstd/include/kstd/os/print.hpp new file mode 100644 index 0000000..f189042 --- /dev/null +++ b/libs/kstd/include/kstd/os/print.hpp @@ -0,0 +1,14 @@ +#ifndef KSTD_OS_PRINT_HPP +#define KSTD_OS_PRINT_HPP + +#include "kstd/bits/formatter.hpp" +#include "kstd/bits/print_sink.hpp" + +#include <string_view> + +namespace kstd::os +{ + auto vprint(print_sink sink, std::string_view format, kstd::format_args args) -> void; +} // namespace kstd::os + +#endif
\ No newline at end of file diff --git a/libs/kstd/include/kstd/print b/libs/kstd/include/kstd/print index df42997..ffafda9 100644 --- a/libs/kstd/include/kstd/print +++ b/libs/kstd/include/kstd/print @@ -1,26 +1,17 @@ #ifndef KSTD_PRINT #define KSTD_PRINT +#include "bits/print_sink.hpp" // IWYU pragma: export +#include "os/print.hpp" + #include <kstd/format> #include <array> -#include <string_view> #include <type_traits> namespace kstd { - enum struct print_sink - { - stdout, - stderr, - }; - - namespace os - { - auto vprint(print_sink sink, std::string_view format, kstd::format_args args) -> void; - } // namespace os - //! @qualifier kernel-defined //! Format the given string using the given arguments and print it to the currently active output device. //! diff --git a/libs/kstd/src/libc/stdlib.cpp b/libs/kstd/src/libc/stdlib.cpp index a0f062a..4a5c91f 100644 --- a/libs/kstd/src/libc/stdlib.cpp +++ b/libs/kstd/src/libc/stdlib.cpp @@ -1,4 +1,4 @@ -#include "kstd/bits/os.hpp" +#include "kstd/os/error.hpp" namespace kstd::libc { diff --git a/libs/kstd/src/bits/os.cpp b/libs/kstd/src/os/error.cpp index e6edbfd..b82158d 100644 --- a/libs/kstd/src/bits/os.cpp +++ b/libs/kstd/src/os/error.cpp @@ -1,10 +1,12 @@ -#include "kstd/bits/os.hpp" +#include "kstd/os/error.hpp" namespace kstd::os { + [[gnu::weak, noreturn]] auto abort() -> void { os::panic("Abort called."); } + } // namespace kstd::os
\ No newline at end of file |
