export module turtle.io; import coral; import coral.files; import turtle; export namespace turtle { enum class log_level { notice, warning, error, }; struct event_loop { bool poll() { return false; } static int run(coral::slice const & title, coral::closure execute) { event_loop loop{title}; return execute(loop); } private: static constexpr coral::usize title_max = 256; coral::u8 title_buffer[256]; event_loop(coral::slice const & title) { coral::copy(this->title_buffer, title.sliced(0, coral::min(title.length, title_max)).as_bytes()); } }; struct system_allocator : public coral::allocator { enum class thread_safety { none, mutex, }; system_allocator(thread_safety allocator_thread_safety) { // TODO: optimize allocator with thread-unsafe variant. } coral::u8 * reallocate(coral::u8 * maybe_allocation, coral::usize requested_size) override { if (maybe_allocation != nullptr) coral::unreachable(); return nullptr; } void deallocate(void * allocation) override { if (allocation != nullptr) coral::unreachable(); } }; };