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,7 +5,7 @@ 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 {

View file

@ -30,7 +30,7 @@ pub fn test_main() {
Ok(name) => {
info!("Test: {} passed", name);
pass += 1;
},
}
Err(name) => {
error!("Test: {} failed", name);
fail += 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))
}),
);
@ -107,12 +148,27 @@ fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
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, repo_name);
let path = format!("out/programs/{}", pkg_name);
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"");
// TODO: build the code with the hblang compiler.
// TODO: use the meta.rli to map dependencies.
@ -124,18 +180,19 @@ 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"()");
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()
@ -27,14 +25,14 @@ Editor := struct {
stn.log.error("got no window")
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()
}

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")
@ -61,7 +60,6 @@ main := fn(): void {
// +++ Input +++
editor.handle_input()
// +++ RENDER +++
editor.frame_render()
// if editor.line_lines editor.theme_render()

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,
padding_line: bool = true,
new := fn():Self{
new := fn(): Self {
return Self.(.(0x88, 0xF4, 0xFC, 0x0), render.YELLOW, render.BLACK, render.RED, 10, true)
}
}

View file

@ -4,12 +4,10 @@ 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 {

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"