1
0
Fork 0
forked from AbleOS/ableos

minor fixes

This commit is contained in:
Able 2025-02-19 03:48:16 -06:00
parent 1837fe5826
commit 01e5d8064f
14 changed files with 161 additions and 70 deletions
kernel
ktest_macro/src
src
rlbuild
sysdata

View file

@ -5,21 +5,21 @@ extern crate syn;
use {
proc_macro::TokenStream,
quote::quote,
syn::{parse::Parse, parse_macro_input, Expr, ItemFn, Token}
syn::{parse::Parse, parse_macro_input, Expr, ItemFn, Token},
};
struct KtestInput {
lhs: Expr,
lhs: Expr,
_comma: Token![,],
rhs: Expr,
rhs: Expr,
}
impl Parse for KtestInput {
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
Ok(Self {
lhs: input.parse()?,
lhs: input.parse()?,
_comma: input.parse()?,
rhs: input.parse()?,
rhs: input.parse()?,
})
}
}
@ -83,4 +83,4 @@ pub fn ktest(_attr: TokenStream, item: TokenStream) -> TokenStream {
};
TokenStream::from(out)
}
}

View file

@ -1,8 +1,8 @@
pub use ktest_macro::*;
use {
alloc::string::String,
log::{error, info},
alloc::string::String,
log::{error, info},
};
extern "C" {
@ -19,8 +19,8 @@ pub fn test_main() {
let mut current_test = &__ktest_start as *const fn() -> Result<String, String>;
let test_end = &__ktest_end as *const fn() -> Result<String, String>;
let mut pass = 0;
let mut fail = 0;
let mut pass = 0;
let mut fail = 0;
while current_test < test_end {
let test_fn = *current_test;
@ -30,7 +30,7 @@ pub fn test_main() {
Ok(name) => {
info!("Test: {} passed", name);
pass += 1;
},
}
Err(name) => {
error!("Test: {} failed", name);
fail += 1;
@ -47,5 +47,5 @@ pub fn test_main() {
#[ktest]
pub fn trivial_assertion() {
ktest_eq!(1, 1);
ktest_neq!(0, 1);
ktest_neq!(0, 1);
}

9
rlbuild/readme.md Normal file
View file

@ -0,0 +1,9 @@
# RLBuild
## Repos
rlbuild was built with the ability to point to multiple repos to fetch packages
repos have a url in the format
repos.ablecorp.us/<repo_name>/<?sub_repo_name>/<pkg_name>

View file

@ -1,7 +1,10 @@
#![feature(slice_take)]
#![allow(special_module_name)]
use std::{fs::{self, File}, io::Write};
use std::{
fs::{self, File},
io::Write,
};
use rlisp_library::{
Environ,
@ -9,6 +12,10 @@ use rlisp_library::{
RispError, default_env, parse_eval,
};
mod packages;
fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
env.data.insert(
"quit".to_string(),
@ -83,21 +90,55 @@ fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
"use-repo".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let repo_name = &args[0].clone();
let mut repo_name_str = repo_name.to_string();
repo_name_str.remove(0);
let repo_url = &args[1].clone();
let use_sources = &args[2].clone();
let msg = match use_sources {
Bool(b) => match b {
true => "building from sources.",
false => "downloading binaries.",
true => "build_from_src = true",
false => "build_from_src = false",
},
_ => {
panic!("AHHH");
}
};
let path = format!("out/system/repos");
fs::create_dir_all(path).unwrap();
let path = format!("out/system/repos/{}.repo", repo_name_str);
println!("repo name {} repo url {} {}", repo_name, repo_url, msg);
let mut file = File::create(path).unwrap();
let msg = format!("url = {}\n{}", repo_url, msg);
let _ = file.write(msg.as_bytes());
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"bootloader-install".to_string(),
Expr::Func(|_args: &[Expr]| -> Result<Expr, RispError> {
// let loader_name = &args[1].clone();
// let mut loader_name_str = loader_name.to_string();
// loader_name_str.remove(0);
let path = format!("out/boot/limine");
fs::create_dir_all(path).unwrap();
let path = format!("out/boot/limine/config.rl");
let mut file = File::create(path).unwrap();
let _ = file.write_all(b"()");
let path = format!("out/boot/limine/limine.conf");
let mut file = File::create(path).unwrap();
let _ = file.write_all(b"");
Ok(Expr::Bool(true))
}),
);
@ -105,13 +146,28 @@ fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
env.data.insert(
"pkg-install".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let repo_name = &args[0].clone();
let repo_name = &args[0].clone();
let pkg_name = &args[1].clone();
// let root_package_path = env.data.get("system-path").unwrap();
let mut pkg_name_str = pkg_name.to_string();
pkg_name_str.remove(0);
println!(
"installing package {} from repo {}",
pkg_name_str, repo_name
);
let path = format!("out/programs/{}", pkg_name_str);
fs::create_dir_all(path).unwrap();
let path = format!("out/programs/{}/src", pkg_name_str);
fs::create_dir_all(path).unwrap();
let path = format!("out/programs/{}/app.axe", pkg_name_str);
let mut file = File::create(path).unwrap();
let _ = file.write_all(b"");
println!("installing package {} from repo {}", pkg_name, repo_name);
let path = format!("out/programs/{}", pkg_name);
fs::create_dir_all(path).unwrap();
// TODO: build the code with the hblang compiler.
// TODO: use the meta.rli to map dependencies.
@ -124,17 +180,18 @@ fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
"pkg-configure".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let pkg_name = &args[0].clone();
let repo_name = &args[1].clone();
println!("{}", repo_name);
let mut pkg_name_str = pkg_name.to_string();
pkg_name_str.remove(0);
println!("configuring package {}", pkg_name);
println!("installing package {}.", pkg_name_str);
let path = format!("out/programs/{}/config.rl", pkg_name_str);
println!("configuring package {}", pkg_name_str);
// TODO: build the code with the hblang compiler.
// TODO: use the meta.rli to map dependencies.
let path = format!("out/programs/{}/config.rl", pkg_name);
let mut file = File::create(path).unwrap();
let _ = file.write_all(b"()");
let mut file = File::create(path).unwrap();
let _ = file.write_all(b"()");
Ok(Expr::Bool(true))
}),
@ -251,5 +308,11 @@ fn main() {
}
}
let path = format!("out/system/config.rl");
let mut file = File::create(path).unwrap();
let _ = file.write_all(cfg.as_bytes());
// TODO: unmount the disk image here.
}

24
rlbuild/src/packages.rs Normal file
View file

@ -0,0 +1,24 @@
pub enum GitOrRepo {
Git(String),
Repo(String)
}
pub struct Package {
name: String,
authors: Vec<String>,
tags: Vec<String>,
version: u8,
depends: Vec<(String, String)>,
git_or_repo: GitOrRepo,
}
impl Package{
}

View file

@ -3,9 +3,9 @@ render := @use("lib:render")
psf := @embed("sysdata:assets/consolefonts/tamsyn/10x20r.psf")
Assets := struct {
font: render.text.Font
font: render.text.Font,
new := fn():Self {
new := fn(): Self {
font := render.text.font_from_psf2(@bitcast(&psf), false)
if font == null {
die

View file

@ -4,7 +4,6 @@ sunset := @use("lib:sunset_proto")
assets := @use("assets.hb")
stn := @use("stn")
Editor := struct {
msg: ?^u8,
@ -16,7 +15,6 @@ Editor := struct {
theme: theme.Theme,
window: sunset.client.Window,
new := fn(): Self {
sunset.client.find_server()
@ -25,16 +23,16 @@ Editor := struct {
window := sunset.client.new(.(.(60, 40), .(window_width, window_height), "Adit"))
if window == null {
stn.log.error("got no window")
die
die
}
return Self.(null, assets.Assets.new() true, theme.Theme.new(), window)
return Self.(null, assets.Assets.new(), true, theme.Theme.new(), window)
}
clear := fn(self:Self):void{
// self.window.surface.clear(self.theme.bg_color)
clear := fn(self: Self): void {
self.window.surface.clear(self.theme.bg_color)
}
frame_sync := fn(self: Self):void {
frame_sync := fn(self: Self): void {
// +++ Frame Sync +++
_ = sunset.client.send_frame(self.window)
}
@ -52,14 +50,13 @@ Editor := struct {
}
}
if self.theme.padding_line {
self.window.surface.put_vline(10, 20, 20 * line_end -20, self.theme.fg_padding_line_color)
self.window.surface.put_vline(10, 20, 20 * line_end - 20, self.theme.fg_padding_line_color)
}
}
frame_render := fn(self: Self): void {
// TODO: Render text here with a loop to iterate through Ropes.
if self.line_lines self.theme_render()
}
@ -71,7 +68,7 @@ Editor := struct {
// if is_shift_pressed {
// return ps2_table[scancode + 0x40]
// }
return ps2_table[scancode]
}
return ps2_table[scancode]
}
}
ps2_table := u8.[0x0, 0x1B, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x2D, 0x3D, 0x8, 0x9, 0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6F, 0x70, 0x5B, 0x5D, 0xA, 0x0, 0x61, 0x73, 0x64, 0x66, 0x67, 0x68, 0x6A, 0x6B, 0x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64, 0x66, 0x67, 0x68, 0x6A, 0x6B, 0x6C, 0x3B, 0x27, 0x60, 0x0, 0x5C, 0x7A, 0x78, 0x63, 0x76, 0x62, 0x6E, 0x6D, 0x2C, 0x2E, 0x2F, 0x0, 0x2A, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1B, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29, 0x5F, 0x2B, 0x8, 0x9, 0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4F, 0x50, 0x7B, 0x7D, 0xA, 0x0, 0x41, 0x53, 0x44, 0x46, 0x47, 0x48, 0x4A, 0x4B, 0x4C, 0x3A, 0x22, 0x7E, 0x0, 0x7C, 0x5A, 0x58, 0x43, 0x56, 0x42, 0x4E, 0x4D, 0x3C, 0x3E, 0x3F, 0x0, 0x0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

View file

@ -21,7 +21,6 @@ rope := @use("rope.hb")
theme := @use("theme.hb");
.{Theme} := theme
psf := @embed("sysdata:assets/consolefonts/tamsyn/10x20r.psf")
img := @embed("sysdata:assets/wallpaper.qoi");
.{Editor} := @use("editor.hb")
@ -46,10 +45,10 @@ main := fn(): void {
pos_1 := Vec2(uint).(10, 1)
pos_2 := Vec2(uint).(10, 1 + 20)
pos_3 := Vec2(uint).(10, 1 + 40)
line_end := 20
editor.window.surface.clear(editor.theme.bg_color)
render_label_to_surface(editor.window.surface, text_1_label, font, pos_1)
render_label_to_surface(editor.window.surface, text_2_label, font, pos_2)
render_label_to_surface(editor.window.surface, text_3_label, font, pos_3)
@ -61,7 +60,6 @@ main := fn(): void {
// +++ Input +++
editor.handle_input()
// +++ RENDER +++
editor.frame_render()
// if editor.line_lines editor.theme_render()

View file

@ -33,4 +33,4 @@ Rope := struct {
leaf := Leaf.new(str)
return Self.(null, &leaf)
}
}
}

View file

@ -6,9 +6,9 @@ Theme := struct {
fg_text_color: render.Color = render.BLACK,
fg_padding_line_color: render.Color = render.RED,
padding: uint = 10,
padding_line: bool= true,
new := fn():Self{
padding_line: bool = true,
new := fn(): Self {
return Self.(.(0x88, 0xF4, 0xFC, 0x0), render.YELLOW, render.BLACK, render.RED, 10, true)
}
}

View file

@ -4,19 +4,17 @@ render := @use("lib:render")
stn := @use("stn");
.{log} := stn;
Tools := struct {
pen_size: u8 = 10,
bg_colour: render.Color = render.WHITE,
pen_colour: render.Color = render.BLACK,
}
main := fn(): void {
tools := Tools.{}
sunset.client.find_server()
window := sunset.client.new(.(.(600, 400), .(200, 200), "Sketch Pad"))
if window == null {
log.error("got no window")

View file

@ -61,19 +61,19 @@ main := fn(): int {
text_label.set_color(sunset.server.DECO_COLOUR, render.BLACK)
loop {
mouse_event := intouch.recieve_mouse_event()
if mouse_event != null {
mouse.x = clamp(int, mouse.x + mouse_event.x_change, mouse.cursor_width + 1, @bitcast(screen.width - mouse.cursor_width - 1))
mouse.y = clamp(int, mouse.y - mouse_event.y_change, mouse.cursor_width + 1, @bitcast(screen.height - mouse.cursor_width - 1))
// mouse_event := intouch.recieve_mouse_event()
// if mouse_event != null {
// mouse.x = clamp(int, mouse.x + mouse_event.x_change, mouse.cursor_width + 1, @bitcast(screen.width - mouse.cursor_width - 1))
// mouse.y = clamp(int, mouse.y - mouse_event.y_change, mouse.cursor_width + 1, @bitcast(screen.height - mouse.cursor_width - 1))
if mouse_event.left {
text_label.set_label_text("LEFT CLICK")
} else if mouse_event.middle {
text_label.set_label_text("MIDDLE CLICK")
} else if mouse_event.right {
text_label.set_label_text("RIGHT CLICK")
}
}
// if mouse_event.left {
// text_label.set_label_text("LEFT CLICK")
// } else if mouse_event.middle {
// text_label.set_label_text("MIDDLE CLICK")
// } else if mouse_event.right {
// text_label.set_label_text("RIGHT CLICK")
// }
// }
{
screen.put_surface(wallpaper, .(0, 0), false)

View file

@ -29,6 +29,7 @@
'resolution 1024 768 24
'timeout 10)
(bootloader-install 'bootloader-limine)
;;;;;;;;;;;;;
;; DRIVERS ;;
@ -43,6 +44,7 @@
(pkg-install 'core 'vfsaur)
(pkg-install 'core 'angels-halo)
(pkg-configure 'angels-halo)
(pkg-install 'core 'sunset)
(pkg-install 'core 'cluster)

View file

@ -38,17 +38,17 @@ path = "boot:///ps2_mouse_driver.hbf"
# [boot.limine.ableos.modules.ps2_driver]
# path = "boot:///ps2_driver.hbf"
[boot.limine.ableos.modules.sunset_client]
path = "boot:///sunset_client.hbf"
# [boot.limine.ableos.modules.sunset_client]
# path = "boot:///sunset_client.hbf"
[boot.limine.ableos.modules.adit]
path = "boot:///adit.hbf"
[boot.limine.ableos.modules.ablefetch]
path = "boot:///ablefetch.hbf"
# [boot.limine.ableos.modules.ablefetch]
# path = "boot:///ablefetch.hbf"
[boot.limine.ableos.modules.sketchpad]
path = "boot:///sketchpad.hbf"
# [boot.limine.ableos.modules.sketchpad]
# path = "boot:///sketchpad.hbf"
# [boot.limine.ableos.modules.angels_halo]
# path = "boot:///angels_halo.hbf"