This commit is contained in:
2025-02-18 01:39:26 +00:00
parent 65b0367487
commit ebab50f2c1
24 changed files with 184 additions and 90 deletions
+2 -1
View File
@@ -2,6 +2,7 @@ use core::fmt;
use alloc::{boxed::Box, format, string::String, vec::Vec};
use alloc::string::ToString;
use alloc::borrow::ToOwned;
use crate::std::render::Window;
use crate::{println, print, mknode, std, serial_println};
use async_trait::async_trait;
@@ -361,7 +362,7 @@ impl Application for Calculator {
Self {}
}
async fn run(&mut self, args: Vec<String>) -> Result<(), ShellError> {
async fn run(&mut self, window: Option<Window>, args: Vec<String>) -> Result<(), ShellError> {
if args.len() == 0 {
loop {
print!("enter equation > ");
+2 -2
View File
@@ -1,7 +1,7 @@
use crate::{serial_println, std};
use crate::std::application::{self, Application};
use crate::std::io::{Color, ColorCode, Display, KeyStroke};
use crate::std::render::{ColouredChar, Frame, Position, RenderError};
use crate::std::render::{ColouredChar, Frame, Position, RenderError, Window};
use crate::user::lib::libgui::cg_core::CgComponent;
@@ -169,7 +169,7 @@ impl Application for Editor {
}
}
async fn run(&mut self, _args: Vec<String>) -> Result<(), application::Error> {
async fn run(&mut self, window: Option<Window>, _args: Vec<String>) -> Result<(), application::Error> {
// if let Some(s) = args.get(0) {
// self.buffer = s.lines().map(|l| l.chars().collect()).collect::<Vec<Vec<char>>>()
+2 -2
View File
@@ -5,7 +5,7 @@ use alloc::boxed::Box;
use core::any::Any;
use async_trait::async_trait;
use crate::std::application::{Application, Error};
use crate::std::render::{Frame, Position, Dimensions, ColouredChar, RenderError};
use crate::std::render::{ColouredChar, Dimensions, Frame, Position, RenderError, Window};
use crate::std::io::{Display, KeyStroke, Stdin};
use crate::user::lib::libgui::{
@@ -49,7 +49,7 @@ impl Application for Grapher {
frame: Frame::new(Position::new(1, 1), Dimensions::new(78, 22)).unwrap()
}
}
async fn run(&mut self, args: Vec<String>) -> Result<(), Error> {
async fn run(&mut self, window: Option<Window>, args: Vec<String>) -> Result<(), Error> {
let _d = Display::borrow();
self.frame.frame = vec![vec![ColouredChar::new(' '); self.frame.dimensions.x]; self.frame.dimensions.y];
+2 -1
View File
@@ -1,4 +1,5 @@
pub mod calc;
pub mod editor;
pub mod grapher;
pub mod tasks;
pub mod tasks;
pub mod zxqsh;
+2 -1
View File
@@ -4,6 +4,7 @@ use crate::std::application::{
Error
};
use crate::println;
use crate::std::render::Window;
use lazy_static::lazy_static;
use spin::Mutex;
use async_trait::async_trait;
@@ -27,7 +28,7 @@ pub struct Tasks;
impl Application for Tasks {
fn new() -> Self { Self {} }
async fn run(&mut self, args: Vec<String>) -> Result<(), Error> {
async fn run(&mut self, window: Option<Window>, args: Vec<String>) -> Result<(), Error> {
if args[0].clone() == String::from("add") {
+50
View File
@@ -0,0 +1,50 @@
use alloc::{string::String, vec::Vec, boxed::Box};
use crate::std::{application::{Application, Error}, render::Window};
use async_trait::async_trait;
pub struct ZxqSH {
history: Vec<String>,
idx: u32,
window: Window,
}
#[async_trait]
impl Application for ZxqSH {
fn new() -> Self {
todo!()
}
async fn run(&mut self, window: Option<Window>, _args: Vec<String>) -> Result<(), Error> {
loop {
if let Ok(exit) = self.next().await {
if exit { return Ok(()) }
}
}
}
}
impl ZxqSH {
async fn next(&mut self) -> Result<bool, Error> {
// update cycle for the shell
// TOOD: prompt
// TODO: exit if necessar
// TODO: execute command
// return
Ok(false)
}
async fn execute(&self, command: String) -> Result<(), Error> {
Ok(())
}
}