From f0e25c7a5d8b6562c638b436474df35e59083635 Mon Sep 17 00:00:00 2001 From: zxq5 Date: Fri, 21 Feb 2025 16:13:06 +0000 Subject: [PATCH] started work on lib_application - progress limited as requires alloc support to make further progress --- Cargo.lock | 7 +++++++ Cargo.toml | 2 +- kernel/src/main.rs | 6 +++++- lib/lib_application/Cargo.toml | 7 +++++++ lib/lib_application/src/application.rs | 10 ++++++++++ lib/lib_application/src/frame.rs | 0 lib/lib_application/src/lib.rs | 5 +++++ lib/lib_application/src/window.rs | 14 ++++++++++++++ lib/lib_ascii/src/font.rs | 3 +++ 9 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 lib/lib_application/Cargo.toml create mode 100644 lib/lib_application/src/application.rs create mode 100644 lib/lib_application/src/frame.rs create mode 100644 lib/lib_application/src/lib.rs create mode 100644 lib/lib_application/src/window.rs diff --git a/Cargo.lock b/Cargo.lock index fc3b11b..9dd5c5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,6 +49,13 @@ dependencies = [ "spin", ] +[[package]] +name = "lib_application" +version = "0.1.0" +dependencies = [ + "lib_ascii", +] + [[package]] name = "lib_ascii" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 8b3748c..0d17198 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = [ "lib/lib_serial", "lib/lib_ascii", "kernel" -] +, "lib/lib_application"] resolver = "2" [workspace.package] diff --git a/kernel/src/main.rs b/kernel/src/main.rs index c6ae3fc..9e619b3 100644 --- a/kernel/src/main.rs +++ b/kernel/src/main.rs @@ -4,7 +4,7 @@ use core::arch::asm; use lib_serial::{serial_println, serial_read}; -use lib_ascii::{println, WRITER}; +use lib_ascii::{print, println, WRITER}; use limine::request::{RequestsEndMarker, RequestsStartMarker}; use limine::BaseRevision; @@ -63,6 +63,10 @@ unsafe extern "C" fn kmain() -> ! { \\______/ \\______/ \\_/ \\______| "); + for i in 0u8..128 { + print!("{}", i as char); + } + hcf(); } diff --git a/lib/lib_application/Cargo.toml b/lib/lib_application/Cargo.toml new file mode 100644 index 0000000..ef6aceb --- /dev/null +++ b/lib/lib_application/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "lib_application" +version.workspace = true +edition.workspace = true + +[dependencies] +lib_ascii = { path = "../lib_ascii" } diff --git a/lib/lib_application/src/application.rs b/lib/lib_application/src/application.rs new file mode 100644 index 0000000..285c09e --- /dev/null +++ b/lib/lib_application/src/application.rs @@ -0,0 +1,10 @@ + +pub trait Application { + fn run(&mut self, args: [&'static str; 5]) -> Result<(), Error>; +} + +pub enum Error { + OsError(&'static str), + ApplicationError(&'static str), +} + diff --git a/lib/lib_application/src/frame.rs b/lib/lib_application/src/frame.rs new file mode 100644 index 0000000..e69de29 diff --git a/lib/lib_application/src/lib.rs b/lib/lib_application/src/lib.rs new file mode 100644 index 0000000..e8d59dd --- /dev/null +++ b/lib/lib_application/src/lib.rs @@ -0,0 +1,5 @@ +#![no_std] + +pub mod application; +pub mod frame; +pub mod window; \ No newline at end of file diff --git a/lib/lib_application/src/window.rs b/lib/lib_application/src/window.rs new file mode 100644 index 0000000..1cecb3c --- /dev/null +++ b/lib/lib_application/src/window.rs @@ -0,0 +1,14 @@ + +pub struct Window { + width: usize, + height: usize +} + +impl Window { + pub fn new() -> Self { + Self { + width: 0, + height: 0 + } + } +} \ No newline at end of file diff --git a/lib/lib_ascii/src/font.rs b/lib/lib_ascii/src/font.rs index 0cd6ba4..be7a194 100644 --- a/lib/lib_ascii/src/font.rs +++ b/lib/lib_ascii/src/font.rs @@ -1,3 +1,6 @@ + + + pub static FONT: [u8; 128 * 16] = [ // ASCII 0-31 (Control Characters) - Using simple box patterns // NUL (0)