Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

42 changed files with 201 additions and 1446 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
target/
out/

76
Cargo.lock generated
View file

@ -73,9 +73,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "cc"
version = "1.2.14"
version = "1.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9"
checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229"
dependencies = [
"shlex",
]
@ -142,9 +142,9 @@ dependencies = [
[[package]]
name = "equivalent"
version = "1.0.2"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "error-stack"
@ -213,12 +213,12 @@ dependencies = [
[[package]]
name = "hbbytecode"
version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#b6d72dbc69983545108b36856c92566414acd11f"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#18e8a831ab6b710dbdd9b0d6a0880c67df0cec26"
[[package]]
name = "hblang"
version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#b6d72dbc69983545108b36856c92566414acd11f"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#18e8a831ab6b710dbdd9b0d6a0880c67df0cec26"
dependencies = [
"hashbrown",
"hbbytecode",
@ -229,7 +229,7 @@ dependencies = [
[[package]]
name = "hbvm"
version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#b6d72dbc69983545108b36856c92566414acd11f"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#18e8a831ab6b710dbdd9b0d6a0880c67df0cec26"
dependencies = [
"hbbytecode",
]
@ -494,9 +494,9 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "once_cell"
version = "1.20.3"
version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
[[package]]
name = "paste"
@ -539,9 +539,9 @@ dependencies = [
[[package]]
name = "raw-cpuid"
version = "11.4.0"
version = "11.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "529468c1335c1c03919960dfefdb1b3648858c20d7ec2d0663e728e4a717efbc"
checksum = "c6928fa44c097620b706542d428957635951bade7143269085389d42c8a4927e"
dependencies = [
"bitflags 2.8.0",
]
@ -561,7 +561,7 @@ dependencies = [
"fatfs",
"hblang",
"log",
"raw-cpuid 11.4.0",
"raw-cpuid 11.3.0",
"str-reader",
"toml",
"ureq",
@ -569,33 +569,19 @@ dependencies = [
[[package]]
name = "ring"
version = "0.17.9"
version = "0.17.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24"
checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
dependencies = [
"cc",
"cfg-if",
"getrandom",
"libc",
"spin",
"untrusted",
"windows-sys",
]
[[package]]
name = "rlbuild"
version = "0.1.0"
dependencies = [
"rlisp_library",
]
[[package]]
name = "rlisp_library"
version = "0.1.0"
source = "git+https://git.ablecorp.us/able/rlisp.git#a1cef24e513a89f8d4de8a1cb3ede546bc72aeca"
dependencies = [
"hashbrown",
]
[[package]]
name = "rustc_version"
version = "0.4.1"
@ -607,9 +593,9 @@ dependencies = [
[[package]]
name = "rustls"
version = "0.23.23"
version = "0.23.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395"
checksum = "9fb9263ab4eb695e42321db096e3b8fbd715a59b154d5c88d82db2175b681ba7"
dependencies = [
"log",
"once_cell",
@ -707,9 +693,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.14.0"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "spin"
@ -740,9 +726,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
version = "2.0.98"
version = "2.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
dependencies = [
"proc-macro2",
"quote",
@ -778,9 +764,9 @@ checksum = "696941a0aee7e276a165a978b37918fd5d22c55c3d6bda197813070ca9c0f21c"
[[package]]
name = "toml"
version = "0.8.20"
version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148"
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
dependencies = [
"serde",
"serde_spanned",
@ -799,9 +785,9 @@ dependencies = [
[[package]]
name = "toml_edit"
version = "0.22.24"
version = "0.22.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474"
checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee"
dependencies = [
"indexmap",
"serde",
@ -823,9 +809,9 @@ dependencies = [
[[package]]
name = "unicode-ident"
version = "1.0.17"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034"
[[package]]
name = "unicode-xid"
@ -899,9 +885,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "webpki-roots"
version = "0.26.8"
version = "0.26.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9"
checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e"
dependencies = [
"rustls-pki-types",
]
@ -981,9 +967,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
version = "0.7.2"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59690dea168f2198d1a3b0cac23b8063efcd11012f10ae4698f284808c8ef603"
checksum = "7e49d2d35d3fad69b39b94139037ecfb4f359f08958b9c11e7315ce770462419"
dependencies = [
"memchr",
]

View file

@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["dev", "kernel", "repbuild", "rlbuild"]
members = ["dev", "kernel", "repbuild"]
# [profile.release]
# strip = "symbols"

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

@ -0,0 +1 @@

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);
}

View file

@ -1,7 +0,0 @@
[package]
name = "rlbuild"
version = "0.1.0"
edition = "2024"
[dependencies]
rlisp_library = { git="https://git.ablecorp.us/able/rlisp.git"}

View file

@ -1,38 +0,0 @@
;; ! 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

@ -1,9 +0,0 @@
# 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,25 +0,0 @@
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

@ -1,14 +0,0 @@
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
}

View file

@ -1,324 +0,0 @@
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

@ -1,182 +0,0 @@
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

@ -1,71 +0,0 @@
#![feature(slice_take)]
#![allow(special_module_name)]
use std::{
fs::{self, File},
io::Write,
};
use rlisp_library::{
Environ,
Expr::{self, Bool},
RispError, default_env, parse_eval,
};
mod packages;
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.rl");
let mut complete_exprs: Vec<String> = vec![];
let mut left_parens = 0;
let mut idx_of_first_left_paran = 0;
for (i, character) in cfg.chars().enumerate() {
if character == '(' {
if left_parens == 0 {
idx_of_first_left_paran = i;
}
left_parens += 1
}
if character == ')' {
left_parens -= 1;
if left_parens == 0 {
let idx_of_last_right_paran = i + 1;
complete_exprs
.push(cfg[idx_of_first_left_paran..idx_of_last_right_paran].to_string());
}
}
}
if left_parens != 0 {
panic!("unmatched parens. Good luck finding them!");
}
// TODO: Mount the disk image here.
for expr in complete_exprs {
match parse_eval(expr, env) {
Ok(_res) => {}
Err(e) => {
panic!("{:?}", e)
}
}
}
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.
}

View file

@ -1,27 +0,0 @@
#[derive(Debug, Clone)]
pub struct 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,3 +1,8 @@
[toolchain]
channel = "nightly"
# old toolchain
# channel = "nightly-2024-07-27"
# last stable
# channel = "nightly-2024-11-20"
# locking here to prevent compile error in holey-bytes crate
channel = "nightly-2025-01-25"
components = ["rust-src", "llvm-tools"]

View file

@ -1,7 +1,7 @@
//! This is a reserved file for use with the AbleOS Clustering System
HostID := uint
ID := uint
HostID := int
ID := int
FileID := struct {
host_id: HostID,
@ -23,10 +23,6 @@ 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,12 +1,6 @@
acs := @use("acs.hb");
.{ProcessID} := acs
// returns PID
spawn := fn(proc_exe: ^u8, length: uint): ProcessID {
pid_ := @as(uint, @eca(3, 6, proc_exe, length))
pid := ProcessID.new(0, pid_)
return pid
$spawn := fn(proc_exe: ^u8, length: uint): uint {
return @eca(3, 6, proc_exe, length)
}
// returns: 0 if child process, child PID if parent process

View file

@ -20,32 +20,21 @@ main := fn(): void {
return
}
text_label_1 := Label.new_label("kernel : akern 0.2.0", 300)
text_label := 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_4 := Label.new_label("theme : sunset-colors", 300)
text_label_5 := Label.new_label("font : tamsyn@10x20", 300)
text_label.set_color(render.BLACK, render.WHITE)
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_1, font, pos1)
render_label_to_surface(window.surface, text_label, 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

@ -1 +0,0 @@
# adit

View file

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

View file

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

View file

@ -1,74 +0,0 @@
theme := @use("theme.hb")
render := @use("lib:render")
sunset := @use("lib:sunset_proto")
assets := @use("assets.hb")
stn := @use("stn")
Editor := struct {
msg: ?^u8,
// is_shift_pressed: bool = false,
// is_ctrl_pressed: bool = false,
// is_extended: bool = false,
assets: assets.Assets,
line_lines: bool = false,
theme: theme.Theme,
window: sunset.client.Window,
new := fn(): Self {
sunset.client.find_server()
window_width := 800
window_height := 400
window := sunset.client.new(.(.(60, 40), .(window_width, window_height), "Adit"))
if window == null {
stn.log.error("got no window")
die
}
return Self.(null, assets.Assets.new(), true, theme.Theme.new(), window)
}
clear := fn(self: Self): void {
self.window.surface.clear(self.theme.bg_color)
}
frame_sync := fn(self: Self): void {
// +++ Frame Sync +++
_ = sunset.client.send_frame(self.window)
}
theme_render := fn(self: Self): void {
window_width := 800
window_height := 400
line_end := 20
if self.line_lines {
line := 1
loop {
defer line += 1
if line == line_end break
self.window.surface.put_hline(20 * line, 10, window_width - self.theme.padding, self.theme.bg_line_color)
}
}
if self.theme.padding_line {
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()
}
handle_input := fn(self: Self): void {
// input := memory.inb(96)
}
map_keys := fn(scancode: u8): u8 {
// if is_shift_pressed {
// return ps2_table[scancode + 0x40]
// }
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, 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

@ -1,68 +0,0 @@
/*!! expected result: pretty decent notepad app
-----------------
features:
- basic keys
- holding support with DAS
- visible cursor
- l+r arrow key support
- proper insertion and deletion
- shift key support
*/
stn := @use("stn");
.{memory, log, string, math} := stn;
.{Vec2, clamp} := math
sunset := @use("lib:sunset_proto")
render := @use("lib:render")
horizon_api := @use("lib:horizon_api");
.{set_color, render_label_to_surface, Label} := horizon_api.widgets.label
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")
main := fn(): void {
window_width := 800
window_height := 400
editor := Editor.new()
font := render.text.font_from_psf2(@bitcast(&psf), false)
if font == null {
return
}
text_1_label := Label.new_label("main := fn() : void {", window_width - editor.theme.padding)
text_2_label := Label.new_label(" log.error(\"print!\")", window_width - editor.theme.padding)
text_3_label := Label.new_label("}", window_width)
text_1_label.set_color(editor.theme.bg_color, editor.theme.fg_text_color)
text_2_label.set_color(editor.theme.bg_color, editor.theme.fg_text_color)
text_3_label.set_color(editor.theme.bg_color, editor.theme.fg_text_color)
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)
loop {
// +++ Clear +++
// editor.clear()
// +++ Input +++
editor.handle_input()
// +++ RENDER +++
editor.frame_render()
// if editor.line_lines editor.theme_render()
editor.frame_sync()
}
}

View file

@ -1,243 +0,0 @@
.{memory, log, string, math} := @use("stn")
render := @use("lib:render")
/* expected result: pretty decent notepad app
slightly jank
-----------------
features:
- basic keys
- holding support with DAS
- visible cursor
- l+r arrow key support
- proper insertion and deletion
- shift key support
*/
psf := @embed("sysdata:assets/consolefonts/tamsyn/10x20r.psf")
img := @embed("sysdata:assets/wallpaper.qoi")
is_shift_pressed := false
is_ctrl_pressed := false
is_extended := false
$initial_delay := 50
$repeat_delay := 7
$left_arrow := 0x4B
$right_arrow := 0x4D
$up_arrow := 0x48
$down_arrow := 0x50
example := fn(): void {
screen := render.init(true)
window := render.Surface.new(600, 300)
font := render.text.font_from_psf2(@bitcast(&psf), false)
wallpaper := render.image.from(@bitcast(&img))
if font == null {
return
}
if wallpaper == null {
return
}
msg := "sticky note:\n"
msg_len := string.length(msg)
buf := memory.alloc(u8, 4096)
bottom := buf + msg_len
memory.copy(u8, msg, buf, msg_len)
cursor := bottom
draw_window(window, font, buf, cursor)
draw_screen(screen, window, wallpaper)
memory.outb(96, 238)
memory.outb(96, 238)
memory.outb(96, 244)
prev_input := @as(u8, 0xFF)
current_key := @as(u8, 0)
holding_timer := 0
loop {
input := memory.inb(96)
if input != prev_input {
if input == 0xE0 {
is_extended = true
} else {
if (input & 0x80) != 0 {
if (input & 0x7F) == current_key {
current_key = 0
holding_timer = 0
} else if input == 0xAA | input == 0xB6 {
is_shift_pressed = false
} else if input == 0x9D {
is_ctrl_pressed = false
}
is_extended = false
} else {
if is_extended {
current_key = input
holding_timer = 1
cursor = handle_extended_key(input, cursor, bottom, font)
} else {
if input == 0x2A | input == 0x36 {
is_shift_pressed = true
} else if input == 0x1D {
is_ctrl_pressed = true
} else {
current_key = input
holding_timer = 1
cursor = handle_char(map_keys(current_key), cursor, bottom)
}
}
}
}
prev_input = input
}
if current_key != 0 & holding_timer > 0 {
holding_timer += 1
if holding_timer >= initial_delay {
if is_extended {
cursor = handle_extended_key(current_key, cursor, bottom, font)
} else {
cursor = handle_char(map_keys(current_key), cursor, bottom)
}
holding_timer = initial_delay - repeat_delay
}
}
draw_window(window, font, buf, cursor)
draw_screen(screen, window, wallpaper)
if holding_timer > 0 & current_key != 0 {
if (memory.inb(96) & 0x80) != 0 {
current_key = 0
holding_timer = 0
}
}
}
}
handle_extended_key := fn(scancode: u8, cursor: ^u8, bottom: ^u8, font: render.text.Font): ^u8 {
if scancode == left_arrow {
if cursor > bottom {
return cursor - 1
}
} else if scancode == right_arrow {
if *cursor != 0 {
return cursor + 1
}
}
return cursor
}
padding := 3 * @sizeof(render.Color)
draw_window := fn(window: render.Surface, font: render.text.Font, buf: ^u8, cursor: ^u8): void {
window.clear(.(0x88, 0xF4, 0xFC, 0x0))
line := font.height + padding - 1
window.put_rect(.(0, 0), .(window.width - 1, window.height - 1), render.BLACK)
loop if line >= window.height break else {
window.put_hline(line, padding, window.width - padding, render.YELLOW)
line += font.height
}
window.put_text(font, .(padding, padding), render.BLACK, buf)
cursor_offset := cursor - buf
y_pos := padding
x_pos := padding
i := 0
loop if i >= cursor_offset break else {
if *(buf + i) == 10 {
y_pos += font.height + font.line_gap
x_pos = padding
} else {
if x_pos + font.width >= window.width - padding {
y_pos += font.height + font.line_gap
x_pos = padding - font.width
}
x_pos += font.width
}
i += 1
}
window.put_rect(.(x_pos, y_pos), .(1, font.height - 1), render.BLACK)
}
draw_screen := fn(screen: render.Surface, window: render.Surface, wallpaper: render.Surface): void {
screen.put_surface(wallpaper, .(0, 0), false)
screen.put_surface(window, .(100, 100), false)
screen.sync()
}
handle_char := fn(char: u8, cursor: ^u8, bottom: ^u8): ^u8 {
if char == 0 {
return cursor
}
if is_ctrl_pressed & char == 48 {
cursor = bottom
} else if char != 0x8 {
end := cursor
loop if *end == 0 break else {
end += 1
}
if cursor < end {
src := end
dst := end + 1
loop if src < cursor break else {
*dst = *src
dst -= 1
src -= 1
}
};
*cursor = char
return cursor + 1
} else if char == 0xA {
*cursor = 32
cursor += 1;
*cursor = 92
return cursor + 1
} else if cursor > bottom {
if cursor == bottom {
return cursor
}
end := cursor
loop if *end == 0 break else {
end += 1
}
if cursor < end {
src := cursor
dst := cursor - 1
loop if src > end break else {
*dst = *src
dst += 1
src += 1
}
return cursor - 1
} else {
cursor -= 1;
*cursor = 32
return cursor
}
}
return cursor
}
map_keys := fn(scancode: u8): u8 {
if is_shift_pressed {
return ps2_table[scancode + 0x40]
}
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, 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

@ -1,36 +0,0 @@
/*! A Rope is a very special data structure
that can quickly append split and represent a single editors line worth of text.
Inspo:
- https://github.com/kavirajk/rope
*/
Node := struct {
weight: uint,
left: ?^Leaf,
right: ?^Leaf,
}
Leaf := struct {
buf: []u8,
start: uint,
end: uint,
new := fn(str: []u8): Self {
return Self.(str, 0, str.len)
}
weight := fn(self: Self): uint {
return self.end - self.start + 1
}
}
Rope := struct {
node: ?^Node,
leaf: ?^Leaf,
new := fn(str: []u8): Self {
leaf := Leaf.new(str)
return Self.(null, &leaf)
}
}

View file

@ -1,14 +0,0 @@
render := @use("lib:render")
Theme := struct {
bg_color: render.Color = render.Color.(0x88, 0xF4, 0xFC, 0x0),
bg_line_color: render.Color = render.YELLOW,
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 {
return Self.(.(0x88, 0xF4, 0xFC, 0x0), render.YELLOW, render.BLACK, render.RED, 10, true)
}
}

View file

@ -1 +0,0 @@
# ascii_game

View file

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

View file

@ -1,21 +0,0 @@
.{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 +0,0 @@
# rlbuild_test

View file

@ -1,9 +0,0 @@
(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

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

View file

@ -4,17 +4,19 @@ 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

@ -26,13 +26,13 @@ Mouse := struct {
return Self.(@bitcast(center_x), @bitcast(center_y), 3, max_x, max_y)
}
/*
center := fn(self: Self){
center_x := max_x / 2
center_y := max_y / 2
// center := fn(self: Self): Self {
// center_x := self.max_x / 2
// center_y := self.max_y / 2
// return Self.(center_x, center_y, 3, self.max_x, self.max_y)
// }
return Self.(center_x, center_y, 3, max_x, max_y)
}*/
}
main := fn(): int {
@ -55,25 +55,25 @@ main := fn(): int {
// mouse_y := 100
mouse := Mouse.new(screen.width, screen.height)
// mouse.center()
//mouse.center()
text_label := Label.new_label("", 1024)
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

@ -1 +0,0 @@
# test_framework

View file

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

View file

@ -1,35 +0,0 @@
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
}

114
sysdata/system.lisp Normal file
View file

@ -0,0 +1,114 @@
;;;;;;;;;;;
;; Repos ;;
;;;;;;;;;;;
;; This is the core repo that is used for core things like networking ;;
(use-repo core "https://repo.ablecorp.us/core")
;; Add a secondary repo ;;
;; (use-repo able "https://repo.ablecorp.us/able")
;; Set the default pkg-install to be binary ;;
(pkg-defaults binary:true)
;; Install compilers ;;
;; pkg-install <repo> <pkg-name>
;; pkg-name : A string or atom to search.
(pkg-install core hblang2)
;; Install the rust compiler ;;
(pkg-install core rustc)
(pkg-install core clang)
;;;;;;;;;;;;;;;
;; Compilers ;;
;;;;;;;;;;;;;;;
;; Set default compilers to use ;;
;; the dev tool pulls from this ;;
(compilers
hblang: 'hblang2
rust: 'rustc
;; Clang is not supported :thumbsup:
;; c: 'clang
)
;;;;;;;;;;;;;;;;;
;; Boot Loader ;;
;;;;;;;;;;;;;;;;;
(pkg-install core limine)
(def limine_res (resolution 1024 768 24))
(boot-loader
default-entry:1
timeout:0
interface_resolution: 'limine_res)
(boot-loader-entry "ableos"
comment: "Default AbleOS boot entry."
protocol: "limine"
kernel_path: "boot:///kernel_${ARCH}"
kernel_cmdline: ""
resolution: 'limine_res)
(boot-loader-entry "ableos-no-cluster"
comment: "Default AbleOS boot entry."
protocol: "limine"
kernel_path: "boot:///kernel_${ARCH}"
kernel_cmdline: "cluster=false"
resolution: 'limine_res)
;;;;;;;;;;;;;;;;;;;;
;; Kernel Options ;;
;;;;;;;;;;;;;;;;;;;;
;; A kernel package is required
(pkg-install core kernel-rust)
;; Set the kernel to be used by ableOS ;;
;; Maybe set a default if this isn't set? ;;
;; Must be installed already ;;
(kernel 'kernel-rust)
;;;;;;;;;;;;
;; Config ;;
;;;;;;;;;;;;
;; Install packages ;;
(pkg-install core sunset)
(pkg-install core ps2-driver)
;; A list of programs to run on startup ;;
(start '())
;; A list of programs to add to the driver supervisor ;;
(start-driver '(ps2-driver))
;; Set the window system to be used by ableOS ;;
;; Must be installed already ;;
;; adds the window system to the driver supervisor ;;
;; (def window-system (fn (a) (start-driver a)))
(window-system 'sunset)
;;;;;;;;;;;;;;;;
;; Networking ;;
;;;;;;;;;;;;;;;;
(networking
;; set the network hostname
;; TODO Namespace this somehow ;;
(hostname "ableOS")
;; use dhcp to find an ip ;;
(ipv4 dhcp)
(ipv6 dhcp)
;; Set the time server ;;
(ntp "time.nist.gov")
(dns 'router-dns-steal))
;;;;;;;;;;;;;;;;;;;;;;
;; Cluster Software ;;
;;;;;;;;;;;;;;;;;;;;;;
;; Install the cluster software ;;
(pkg-install core cluster)
;; Defaults to false ;;
(cluster enabled:false)

View file

@ -1,76 +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)
;; 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"
@ -41,14 +41,11 @@ path = "boot:///sunset_server.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.sdoom]
# path = "boot:///sdoom.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"