From 8ee4af1a4815fec9a9199f29ba7a95a00efd2596 Mon Sep 17 00:00:00 2001 From: zxq5 Date: Wed, 5 Mar 2025 21:10:36 +0000 Subject: [PATCH] someone broke a mod.rs so i fixed it. --- kernel/src/lib.rs | 4 ++- kernel/src/std/io.rs | 82 -------------------------------------------- 2 files changed, 3 insertions(+), 83 deletions(-) delete mode 100644 kernel/src/std/io.rs diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 718213e..dd69f1b 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -38,7 +38,9 @@ pub mod prelude { pub use crate::{ eprint, eprintln, print, print_log, println, println_log, serial_print, serial_println, - std::io::{_print, _print_err, _print_log, _serial_write}, + debug, debugln, + std::io::{_print, _print_log, _serial_write, _print_err}, + std::debug::_debug, }; } diff --git a/kernel/src/std/io.rs b/kernel/src/std/io.rs deleted file mode 100644 index 10f1f7f..0000000 --- a/kernel/src/std/io.rs +++ /dev/null @@ -1,82 +0,0 @@ -pub use crate::arch::x86_64::drivers::{ - ascii::{_print, _print_err, _print_log}, - serial::_serial_write, -}; -pub mod stdin { - use crate::arch::x86_64::drivers::{ - ascii::WRITER, - keyboard::{ - get_keystroke_async, get_keystroke_optional, KeyStroke, - } - }; - use alloc::string::String; - - /// Reads a line of input from standard input asynchronously, returning a `String` containing - /// the input line. Does not include the newline character at the end of the line. - /// - /// If the user presses the abort key (usually Ctrl+C), the returned string will be empty. - /// - /// This function is currently unimplemented. - pub async fn read_line() -> String { - let mut writer = WRITER.lock(); - - let mut buff = String::new(); - loop { - match get_keystroke_async().await { - KeyStroke::Char(c) => match c { - '\n' => { - writer.write_glyph(c as u8); - return buff; - } - '\r' => { - writer.write_glyph(c as u8); - return buff; - } - '\x08' => { - if !buff.is_empty() { - buff.pop(); - writer.backspace(); - } - } - - c => { - writer.write_glyph(c as u8); - buff.push(c) - } - }, - KeyStroke::Enter => { - writer.write_glyph(b'\n'); - return buff; - } - KeyStroke::Backspace => { - if !buff.is_empty() { - buff.pop(); - writer.backspace(); - } - } - _ => continue, - } - } - } - - /// Reads a character from standard input and blocks the current task until a character is - /// available. - /// - /// # Note - /// - /// This function is not yet implemented. - pub async fn async_keystroke() -> KeyStroke { - get_keystroke_async().await - } - - /// Attempt to read a character from standard input without blocking the current task. - /// - /// If no character is available, returns `None`. - /// - /// # Note - /// - /// This function is not yet implemented. - pub fn keystroke() -> Option { - get_keystroke_optional() - } -}