1
0
Fork 0
forked from AbleOS/ableos

Compare commits

...

9 commits

26 changed files with 818 additions and 359 deletions
Cargo.lock
kernel/src/arch/x86_64
rlbuild
sysdata
libraries/stn/src
programs
ablefetch/src
ascii_game
horizon_testing_program/src
render_example/src
rlbuild_test
test_framework
system.lispsystem.rlsystem_config.toml

2
Cargo.lock generated
View file

@ -591,7 +591,7 @@ dependencies = [
[[package]]
name = "rlisp_library"
version = "0.1.0"
source = "git+https://git.ablecorp.us/able/rlisp.git#e349916bb67ad74ca5f868da57c733d00d97397f"
source = "git+https://git.ablecorp.us/able/rlisp.git#a1cef24e513a89f8d4de8a1cb3ede546bc72aeca"
dependencies = [
"hashbrown",
]

View file

@ -1 +0,0 @@

38
rlbuild/assets/pkg.rl Normal file
View file

@ -0,0 +1,38 @@
;; ! hbpkg.rli ! ;;
;; package name & version, non-optional.
(package
"example"
;; Major Minor Patch
(version 1 0 1)
:authors ("AbleTheAbove")
:tags ("a" "b" "c")
(deps
;; first item after name is always source.
(lily "https://git.ablecorp.us/lily-org/lily.git"
;; semantic version. min & max both optional.
;; if version is string, exact match will be used.
;; if version is "0.x", then the latest of "0.x.y" will be used
:version (:min "0.0.2" :max "0.0.5")
)
(libexample "./src/lib.hb")
(third-dep
;; Repo lookup refers to the rlrepo project
(repo :core "third-dep")
)
(some_clib "https://example.org/clib.git"
:commit "ABCDEFGH" ;; optional
:branch "trunk" ;; optional
;; optional, probably not required if specifying commit.
:hash "abcdefghijklmnopqrstuvwxyz123456"
)
)
)

View file

@ -0,0 +1,25 @@
use rlisp_library::*;
pub fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
env.data.insert(
"system-install".to_string(),
Expr::Func(|_args: &[Expr]| -> Result<Expr, RispError> {
println!("probably the kernel is installed by now");
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"use-repo-path".to_string(),
Expr::Func(|_args: &[Expr]| -> Result<Expr, RispError> {
let repo_name = _args.first().unwrap();
println!("{:?}", _args);
Ok(Expr::Bool(true))
}),
);
env
}

View file

@ -0,0 +1,14 @@
use rlisp_library::*;
mod ext;
mod old;
pub fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
let mut env = ext::extend_environ(env);
let mut env = old::extend_environ(env);
env
}

324
rlbuild/src/environ/old.rs Normal file
View file

@ -0,0 +1,324 @@
use std::{
fs::{self, File},
io::Write,
};
use rlisp_library::{
Environ,
Expr::{self, Bool},
RispError, default_env, parse_eval,
};
pub
fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
env.data.insert(
"quit".to_string(),
Expr::Func(|_args: &[Expr]| -> Result<Expr, RispError> {
// TODO: let this function take in arguments
println!("Exiting.");
std::process::exit(0);
#[allow(unreachable_code)]
Err(RispError::Reason("Cannot exit process".to_string()))
}),
);
env.data.insert(
"print".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let mut stri = String::new();
for arg in args {
let fmted = match arg {
Expr::Str(string) => {
let string = string.clone();
// string.pop();
// string.remove(0);
format!("{}", string)
}
_ => {
format!("{}", arg)
}
};
stri.push_str(&fmted);
if args.len() > 1 {
stri.push_str(" ")
}
}
print!("{}", stri);
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"println".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let mut stri = String::new();
for arg in args {
let fmted = match arg {
Expr::Str(string) => {
let string = string.clone();
// string.pop();
// string.remove(0);
format!("{}", string)
}
_ => {
format!("{}", arg)
}
};
stri.push_str(&fmted);
if args.len() > 1 {
stri.push_str(" ")
}
}
println!("{}", stri);
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"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 => "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"");
let path = format!("out/boot/limine/BOOTX64.EFI");
let mut x64_file = File::create(&path).unwrap();
std::fs::copy("limine/BOOTX64.EFI", &path).unwrap(); // Copy foo.txt to bar.txt
let path = format!("out/boot/limine/BOOTAA64.EFI");
let mut x64_file = File::create(&path).unwrap();
std::fs::copy("limine/BOOTAA64.EFI", &path).unwrap(); // Copy foo.txt to bar.txt
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"pkg-install".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let repo_name = &args[0].clone();
let pkg_name = &args[1].clone();
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();
// If package is from :src repo, copy source files
if repo_name.to_string() == ":src" {
// Try original name first
let src_path = format!("sysdata/programs/{}", pkg_name_str);
println!("Checking source path: {}", src_path);
// If not found, try with dashes converted to underscores
let underscored_name = pkg_name_str.replace('-', "_");
let src_path_alt = format!("sysdata/programs/{}", underscored_name);
let (found_path, found_name) = if fs::metadata(&src_path).is_ok() {
(src_path, pkg_name_str.clone())
} else if fs::metadata(&src_path_alt).is_ok() {
println!("Found source directory with underscored name at {}", src_path_alt);
(src_path_alt, underscored_name)
} else {
return Err(RispError::Reason(format!(
"Source directory not found for package {} at {} or {}",
pkg_name_str, src_path, src_path_alt
)));
};
println!("Found source directory at {}", found_path);
// Copy all files from src directory
for entry in fs::read_dir(&found_path).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
if path.is_file() {
let file_name = path.file_name().unwrap().to_str().unwrap();
let dest_path = format!("out/programs/{}/{}", pkg_name_str, file_name);
println!("Copying {} to {}", path.display(), dest_path);
fs::copy(&path, &dest_path).unwrap();
}
}
// Copy contents of src directory if it exists
let src_src_path = format!("sysdata/programs/{}/src", found_name);
println!("Checking src directory at {}", src_src_path);
if fs::metadata(&src_src_path).is_ok() {
println!("Found src directory at {}", src_src_path);
for entry in fs::read_dir(&src_src_path).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
if path.is_file() {
let file_name = path.file_name().unwrap().to_str().unwrap();
let dest_path = format!("out/programs/{}/src/{}", pkg_name_str, file_name);
println!("Copying {} to {}", path.display(), dest_path);
fs::copy(&path, &dest_path).unwrap();
}
}
}
// Check if meta.rl exists in source, if not generate one
let meta_src_path = format!("sysdata/programs/{}/meta.rl", found_name);
let meta_dest_path = format!("out/programs/{}/meta.rl", pkg_name_str);
if !fs::metadata(&meta_src_path).is_ok() {
println!("Generating meta.rl for {}", pkg_name_str);
let mut file = File::create(&meta_dest_path).unwrap();
let meta_content = format!(
"(package \"{}\"\n (version 1 0 0)\n :authors (\"\")\n :tags ()\n (deps))\n",
pkg_name_str
);
file.write_all(meta_content.as_bytes()).unwrap();
}
}
let path = format!("out/programs/{}/app.axe", pkg_name_str);
let mut file = File::create(path).unwrap();
let _ = file.write_all(b"");
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"pkg-configure".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let pkg_name = &args[0].clone();
let mut pkg_name_str = pkg_name.to_string();
pkg_name_str.remove(0);
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 mut file = File::create(path).unwrap();
let _ = file.write_all(b"()");
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"drivers".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let mut stri = String::new();
for arg in args {
let fmted = match arg {
Expr::Str(string) => {
let string = string.clone();
format!("{}", string)
}
_ => {
format!("{}", arg)
}
};
stri.push_str(&fmted);
if args.len() > 1 {
stri.push_str(" ")
}
}
println!("Drivers {}", stri);
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"services".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let mut stri = String::new();
for arg in args {
let fmted = match arg {
Expr::Str(string) => {
let string = string.clone();
format!("{}", string)
}
_ => {
format!("{}", arg)
}
};
stri.push_str(&fmted);
if args.len() > 1 {
stri.push_str(" ")
}
}
println!("Services {}", stri);
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"reincarnation-server".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let reinc = &args[0].clone();
println!("Reincarnation Server {}", reinc);
Ok(Expr::Bool(true))
}),
);
env
}

View file

@ -0,0 +1,182 @@
use std::{fs, File};
use rlisp_library::{Environ, Expr, RispError, parse_eval};
use crate::packages::{Package, Dependency};
pub fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
// Function to create a package
env.data.insert(
"package".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
if args.len() < 5 {
return Err(RispError::Reason("package requires name, authors, version, dependencies, and build command".to_string()));
}
let name = match &args[0] {
Expr::Str(s) => s.clone(),
_ => return Err(RispError::Reason("package name must be a string".to_string())),
};
let authors = match &args[1] {
Expr::List(l) => l.iter()
.map(|a| match a {
Expr::Str(s) => s.clone(),
_ => return Err(RispError::Reason("authors must be strings".to_string())),
})
.collect(),
_ => return Err(RispError::Reason("authors must be a list".to_string())),
};
let version = match &args[2] {
Expr::Str(s) => s.clone(),
_ => return Err(RispError::Reason("version must be a string".to_string())),
};
let dependencies = match &args[3] {
Expr::List(l) => l.iter()
.map(|d| match d {
Expr::List(dep_list) => {
if dep_list.len() != 2 {
return Err(RispError::Reason("dependency must have type and source".to_string()));
}
let dep_type = match &dep_list[0] {
Expr::Symbol(s) => s.clone(),
_ => return Err(RispError::Reason("dependency type must be a symbol".to_string())),
};
let source = match &dep_list[1] {
Expr::Str(s) => s.clone(),
_ => return Err(RispError::Reason("dependency source must be a string".to_string())),
};
match dep_type.as_str() {
"library" => Ok(Dependency::Library { source }),
"binary" => Ok(Dependency::Binary { source }),
"source" => Ok(Dependency::Source { source }),
_ => Err(RispError::Reason(format!("Unknown dependency type: {}", dep_type))),
}
}
_ => Err(RispError::Reason("dependency must be a list".to_string())),
})
.collect::<Result<Vec<Dependency>, RispError>>()?,
_ => return Err(RispError::Reason("dependencies must be a list".to_string())),
};
let build_command = match &args[4] {
Expr::Str(s) => s.clone(),
_ => return Err(RispError::Reason("build command must be a string".to_string())),
};
let package = Package::new(name, authors, version, dependencies, build_command);
// Store the package in the environment
env.data.insert(
"current_package".to_string(),
Expr::Custom(Box::new(package))
);
Ok(Expr::Bool(true))
}),
);
// Function to get the current package
env.data.insert(
"get-package".to_string(),
Expr::Func(|_args: &[Expr]| -> Result<Expr, RispError> {
match env.data.get("current_package") {
Some(pkg) => Ok(pkg.clone()),
None => Err(RispError::Reason("No package is currently defined".to_string())),
}
}),
);
// Package installation function
env.data.insert(
"pkg-install".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
if args.len() != 2 {
return Err(RispError::Reason("pkg-install requires repo name and package name".to_string()));
}
let repo_name = match &args[0] {
Expr::Str(s) => s.clone(),
_ => return Err(RispError::Reason("repo name must be a string".to_string())),
};
let pkg_name = match &args[1] {
Expr::Str(s) => s.clone(),
_ => return Err(RispError::Reason("package name must be a string".to_string())),
};
println!("Installing package {} from repo {}", pkg_name, repo_name);
// Create package directory structure
let pkg_dir = format!("out/programs/{}", pkg_name);
fs::create_dir_all(&pkg_dir).unwrap();
fs::create_dir_all(format!("{}/src", pkg_dir)).unwrap();
// If package is from :src repo, copy source files
if repo_name == ":src" {
// Try original name first
let src_path = format!("sysdata/programs/{}", pkg_name);
let underscored_name = pkg_name.replace('-', "_");
let src_path_alt = format!("sysdata/programs/{}", underscored_name);
let (found_path, found_name) = if fs::metadata(&src_path).is_ok() {
(src_path, pkg_name.clone())
} else if fs::metadata(&src_path_alt).is_ok() {
println!("Found source directory with underscored name at {}", src_path_alt);
(src_path_alt, underscored_name)
} else {
return Err(RispError::Reason(format!(
"Source directory not found for package {} at {} or {}",
pkg_name, src_path, src_path_alt
)));
};
// Copy all files from source directory
for entry in fs::read_dir(&found_path).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
if path.is_file() {
let file_name = path.file_name().unwrap().to_str().unwrap();
let dest_path = format!("{}/{}", pkg_dir, file_name);
println!("Copying {} to {}", path.display(), dest_path);
fs::copy(&path, &dest_path).unwrap();
}
}
// Copy contents of src directory if it exists
let src_src_path = format!("sysdata/programs/{}/src", found_name);
if fs::metadata(&src_src_path).is_ok() {
for entry in fs::read_dir(&src_src_path).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
if path.is_file() {
let file_name = path.file_name().unwrap().to_str().unwrap();
let dest_path = format!("{}/src/{}", pkg_dir, file_name);
println!("Copying {} to {}", path.display(), dest_path);
fs::copy(&path, &dest_path).unwrap();
}
}
}
// Read and evaluate meta.rl directly
let meta_path = format!("sysdata/programs/{}/meta.rl", found_name);
if let Ok(meta_content) = fs::read_to_string(&meta_path) {
println!("Evaluating meta.rl for package {}", pkg_name);
if let Err(e) = parse_eval(&meta_content, &mut env.clone()) {
println!("Warning: Failed to evaluate meta.rl: {}", e);
}
} else {
println!("Warning: No meta.rl found for package {}", pkg_name);
}
// Create empty app.axe file
let app_path = format!("{}/app.axe", pkg_dir);
File::create(app_path).unwrap();
}
Ok(Expr::Bool(true))
}),
);
env
}

View file

@ -13,262 +13,15 @@ use rlisp_library::{
};
mod packages;
fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
env.data.insert(
"quit".to_string(),
Expr::Func(|_args: &[Expr]| -> Result<Expr, RispError> {
// TODO: let this function take in arguments
println!("Exiting.");
std::process::exit(0);
#[allow(unreachable_code)]
Err(RispError::Reason("Cannot exit process".to_string()))
}),
);
env.data.insert(
"print".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let mut stri = String::new();
for arg in args {
let fmted = match arg {
Expr::Str(string) => {
let string = string.clone();
// string.pop();
// string.remove(0);
format!("{}", string)
}
_ => {
format!("{}", arg)
}
};
stri.push_str(&fmted);
if args.len() > 1 {
stri.push_str(" ")
}
}
print!("{}", stri);
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"println".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let mut stri = String::new();
for arg in args {
let fmted = match arg {
Expr::Str(string) => {
let string = string.clone();
// string.pop();
// string.remove(0);
format!("{}", string)
}
_ => {
format!("{}", arg)
}
};
stri.push_str(&fmted);
if args.len() > 1 {
stri.push_str(" ")
}
}
println!("{}", stri);
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"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 => "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))
}),
);
env.data.insert(
"pkg-install".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let repo_name = &args[0].clone();
let pkg_name = &args[1].clone();
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"");
// TODO: build the code with the hblang compiler.
// TODO: use the meta.rli to map dependencies.
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"pkg-configure".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let pkg_name = &args[0].clone();
let mut pkg_name_str = pkg_name.to_string();
pkg_name_str.remove(0);
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 mut file = File::create(path).unwrap();
let _ = file.write_all(b"()");
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"drivers".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let mut stri = String::new();
for arg in args {
let fmted = match arg {
Expr::Str(string) => {
let string = string.clone();
format!("{}", string)
}
_ => {
format!("{}", arg)
}
};
stri.push_str(&fmted);
if args.len() > 1 {
stri.push_str(" ")
}
}
println!("Drivers {}", stri);
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"services".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let mut stri = String::new();
for arg in args {
let fmted = match arg {
Expr::Str(string) => {
let string = string.clone();
// string.pop();
// string.remove(0);
format!("{}", string)
}
_ => {
format!("{}", arg)
}
};
stri.push_str(&fmted);
if args.len() > 1 {
stri.push_str(" ")
}
}
println!("Services {}", stri);
Ok(Expr::Bool(true))
}),
);
env.data.insert(
"reincarnation-server".to_string(),
Expr::Func(|args: &[Expr]| -> Result<Expr, RispError> {
let reinc = &args[0].clone();
println!("Reincarnation Server {}", reinc);
Ok(Expr::Bool(true))
}),
);
env
}
mod environ;
use environ::extend_environ;
fn main() {
let env = &mut default_env();
let env = &mut extend_environ(env.clone());
// let env = &mut
let cfg = include_str!("../../sysdata/system.lisp");
let cfg = include_str!("../../sysdata/system.rl");
let mut complete_exprs: Vec<String> = vec![];
let mut left_parens = 0;
@ -308,11 +61,11 @@ fn main() {
}
}
let path = format!("out/system/config.rl");
let mut file = File::create(path).unwrap();
let path = format!("out/system/config.rl");
let _ = file.write_all(cfg.as_bytes());
let mut file = File::create(path).unwrap();
let _ = file.write_all(cfg.as_bytes());
// TODO: unmount the disk image here.
}

View file

@ -1,24 +1,27 @@
pub enum GitOrRepo {
Git(String),
Repo(String)
}
#[derive(Debug, Clone)]
pub struct Package {
name: String,
authors: Vec<String>,
tags: Vec<String>,
version: u8,
depends: Vec<(String, String)>,
git_or_repo: GitOrRepo,
}
impl Package{
pub name: String,
pub authors: Vec<String>,
pub version: String,
pub dependencies: Vec<Dependency>,
pub build_command: String,
}
#[derive(Debug, Clone)]
pub enum Dependency {
Library { source: String },
Binary { source: String },
Source { source: String },
}
impl Package {
pub fn new(name: String, authors: Vec<String>, version: String, dependencies: Vec<Dependency>, build_command: String) -> Self {
Self {
name,
authors,
version,
dependencies,
build_command,
}
}
}

View file

@ -1,7 +1,7 @@
//! This is a reserved file for use with the AbleOS Clustering System
HostID := int
ID := int
HostID := uint
ID := uint
FileID := struct {
host_id: HostID,
@ -23,6 +23,10 @@ BufferID := struct {
ProcessID := struct {
host_id: HostID,
id: ID,
new := fn(hid: uint, pid: uint): Self {
return Self.(hid, pid)
}
}
WindowID := struct {

View file

@ -1,6 +1,12 @@
acs := @use("acs.hb");
.{ProcessID} := acs
// returns PID
$spawn := fn(proc_exe: ^u8, length: uint): uint {
return @eca(3, 6, proc_exe, length)
spawn := fn(proc_exe: ^u8, length: uint): ProcessID {
pid_ := @as(uint, @eca(3, 6, proc_exe, length))
pid := ProcessID.new(0, pid_)
return pid
}
// returns: 0 if child process, child PID if parent process

View file

@ -20,21 +20,32 @@ main := fn(): void {
return
}
text_label := Label.new_label("kernel : akern 0.2.0", 300)
text_label_1 := Label.new_label("kernel : akern 0.2.0", 300)
text_label_2 := Label.new_label("os : ableos", 300)
text_label_3 := Label.new_label("wm : sunset", 300)
text_label.set_color(render.BLACK, render.WHITE)
text_label_4 := Label.new_label("theme : sunset-colors", 300)
text_label_5 := Label.new_label("font : tamsyn@10x20", 300)
text_label_1.set_color(render.BLACK, render.WHITE)
text_label_2.set_color(render.BLACK, render.WHITE)
text_label_3.set_color(render.BLACK, render.WHITE)
text_label_4.set_color(render.BLACK, render.WHITE)
text_label_5.set_color(render.BLACK, render.WHITE)
pos1 := Vec2(uint).(1, 1)
pos2 := Vec2(uint).(1, 20)
pos3 := Vec2(uint).(1, 40)
pos4 := Vec2(uint).(1, 60)
pos5 := Vec2(uint).(1, 80)
render_label_to_surface(window.surface, text_label, font, pos1)
render_label_to_surface(window.surface, text_label_1, font, pos1)
render_label_to_surface(window.surface, text_label_2, font, pos2)
render_label_to_surface(window.surface, text_label_3, font, pos3)
render_label_to_surface(window.surface, text_label_4, font, pos4)
render_label_to_surface(window.surface, text_label_5, font, pos5)
loop {
// stn.log.info("AAAA")
_ = sunset.client.send_frame(window)

View file

@ -0,0 +1 @@
# ascii_game

View file

@ -0,0 +1,11 @@
[package]
name = "ascii_game"
authors = [""]
[dependants.libraries]
[dependants.binaries]
hblang.version = "1.0.0"
[build]
command = "hblang src/main.hb"

View file

@ -0,0 +1,21 @@
.{log} := @use("stn")
sunset := @use("lib:sunset_proto")
render := @use("lib:render")
main := fn(): int {
sunset.client.find_server()
window := sunset.client.new(.(.(400, 400), .(200, 200), "Ascii Game"))
if window == null {
log.error("got no window")
return 0
}
loop {
window.surface.clear(render.BLACK)
_ = sunset.client.send_frame(window)
}
return 0
}

View file

@ -29,7 +29,7 @@ main := fn(): int {
instance := ignim.instance.void_instance()
// // TODO: recursively follow this https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance
// TODO: recursively follow this https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance
ret := ignim.instance.create_instance(&create_info, 0, &instance)
if ret == errors.IncompatibleDriver {
log.error("Driver Incompatible with Vulkan")

View file

@ -1 +1 @@
.{example: main} := @use("./examples/intouch.hb")
.{example: main} := @use("./examples/drag-and-drop.hb")

View file

@ -0,0 +1 @@
# rlbuild_test

View file

@ -0,0 +1,9 @@
(package "name"
:authors ("able")
:version "0.1.0"
(depends
(repo-lookup :src "rlbuild-test")
(repo-lookup :src "hblang")
)
(build "hblang src/main.hb")
)

View file

@ -0,0 +1,3 @@
main := fn(): int {
return 0
}

View file

@ -0,0 +1 @@
# test_framework

View file

@ -0,0 +1,11 @@
[package]
name = "test_framework"
authors = [""]
[dependants.libraries]
[dependants.binaries]
hblang.version = "1.0.0"
[build]
command = "hblang src/main.hb"

View file

@ -0,0 +1,35 @@
stn := @use("stn")
main := fn(): int {
exe := u8.[
0x15, 145, 210,
0, 0, 0, 0,
2, 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,
85, 0
]
test(@bitcast(&exe), 49)
loop{}
return 0
}
assert_eq := fn(lhs: bool, rhs: bool): bool {
lhs == rhs
}
assert_neq := fn(lhs: bool, rhs: bool): bool {
lhs != rhs
}
test := fn(exe_data: ^u8, exe_size: uint): uint {
// TODO: Spawn new process
pid := @inline(stn.process.spawn, exe_data, exe_size)
stn.log.info("PID")
return 0
}

View file

@ -1,69 +0,0 @@
;; If passed into a use-repo function this will
;; download source code and build it.
(def use-sources true)
;; Set to false so that binaries are downloaded.
(def use-binaries false)
(def system-path "sample")
;;;;;;;;;;;;;;;;;;
;; REPOSITORIES ;;
;;;;;;;;;;;;;;;;;;
(use-repo 'core "https://repo.ablecorp.us/core" use-sources)
;; another repo example.
(use-repo 'games "https://repo.ablecorp.us/games" use-binaries)
(use-repo 'personal "https://repo.ablecorp.us/able-personal" use-sources)
;;;;;;;;;;;;;;;;
;; BOOTLOADER ;;
;;;;;;;;;;;;;;;;
(def resolution (fn (x y fps) (println x "x" y "@" fps)))
(pkg-install 'core 'bootloader-limine)
(pkg-configure 'bootloader-limine
'comment "Default"
'kernel 'kernel-rust
'boot-protocol "limine"
'verbose true
'resolution 1024 768 24
'timeout 10)
(bootloader-install 'bootloader-limine)
;;;;;;;;;;;;;
;; DRIVERS ;;
;;;;;;;;;;;;;
(pkg-install 'core 'ps2-driver)
(pkg-install 'core 'ata-pio)
;;;;;;;;;;;;;;
;; SERVICES ;;
;;;;;;;;;;;;;;
(pkg-install 'core 'vfsaur)
(pkg-install 'core 'angels-halo)
(pkg-configure 'angels-halo)
(pkg-install 'core 'sunset)
(pkg-install 'core 'cluster)
;; Init System
(pkg-install 'core 'genesis)
;; Typically drivers should not have dependencies. Thus simplifing dependency solving.
;; Services might have dependencies on drivers or other services that can be auto-started even if you don't specify them
(pkg-configure 'genesis
(reincarnation-server 'angels-halo)
(drivers 'ata-pio 'serial)
(services 'sunset 'vfsaur 'fat32))
;;;;;;;;;;;;
;; KERNEL ;;
;;;;;;;;;;;;
(pkg-install 'core 'kernel-rust)
;; Set the program to be launched to init the system.
(pkg-configure 'kernel-rust
'init-system 'genesis)

76
sysdata/system.rl Normal file
View file

@ -0,0 +1,76 @@
;; If passed into a use-repo function this will
;; download source code and build it.
(def use-sources true)
;; Set to false so that binaries are downloaded.
(def use-binaries false)
(def system-path "sample")
;;;;;;;;;;;;;;;;;;
;; REPOSITORIES ;;
;;;;;;;;;;;;;;;;;;
(use-repo :core "https://repo.ablecorp.us/core" use-sources)
;; another repo example.
(use-repo :games "https://repo.ablecorp.us/games" use-binaries)
(use-repo :personal "https://repo.ablecorp.us/able-personal" use-sources)
;; Treat a path like a repo
(use-repo-path :src "sysdata/")
;;;;;;;;;;;;;;;;
;; BOOTLOADER ;;
;;;;;;;;;;;;;;;;
(def resolution (fn (x y fps) (println x "x" y "@" fps)))
(pkg-install :core :bootloader-limine)
(pkg-configure :bootloader-limine
:comment "Default"
:kernel :kernel-rust
:boot-protocol "limine"
:verbose true
:resolution 1024 768 24
:timeout 10)
(bootloader-install :bootloader-limine)
;;;;;;;;;;;;;
;; DRIVERS ;;
;;;;;;;;;;;;;
(pkg-install :core :ps2-driver)
(pkg-install :core :ata-pio)
(pkg-install :src :rlbuild-test)
;;;;;;;;;;;;;;
;; SERVICES ;;
;;;;;;;;;;;;;;
(pkg-install :core :vfsaur)
(pkg-install :core :angels-halo)
(pkg-configure :angels-halo)
(pkg-install :core :sunset)
(pkg-install :core :cluster)
;; Init System
(pkg-install :core :genesis)
;; Typically drivers should not have dependencies. Thus simplifing dependency solving.
;; Services might have dependencies on drivers or other services that can be auto-started even if you don:t specify them
(pkg-configure :genesis
(reincarnation-server :angels-halo)
(drivers :ata-pio :serial)
(services :sunset :vfsaur :fat32))
;;;;;;;;;;;;
;; KERNEL ;;
;;;;;;;;;;;;
(system-install :core :kernel-rust)
;; Set the program to be launched to init the system.

View file

@ -29,8 +29,8 @@ resolution = "1024x768x24"
[boot.limine.ableos.modules.sunset_server]
path = "boot:///sunset_server.hbf"
[boot.limine.ableos.modules.ps2_mouse_driver]
path = "boot:///ps2_mouse_driver.hbf"
# [boot.limine.ableos.modules.ps2_mouse_driver]
# path = "boot:///ps2_mouse_driver.hbf"
# [boot.limine.ableos.modules.ps2_keyboard_driver]
# path = "boot:///ps2_keyboard_driver.hbf"
@ -44,8 +44,8 @@ path = "boot:///ps2_mouse_driver.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"