forked from koniifer/ableos
Probably this works on someone elses machine.
This commit is contained in:
parent
a511e99606
commit
b427ae1c27
|
@ -1,2 +1,2 @@
|
||||||
[alias]
|
[alias]
|
||||||
repbuild = "run --manifest-path ./repbuild/Cargo.toml --"
|
repbuild = "run --manifest-path ./repbuild/Cargo.toml -r --"
|
||||||
|
|
152
Cargo.lock
generated
152
Cargo.lock
generated
|
@ -45,8 +45,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"const-random",
|
|
||||||
"getrandom",
|
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"version_check",
|
"version_check",
|
||||||
"zerocopy 0.7.34",
|
"zerocopy 0.7.34",
|
||||||
|
@ -193,26 +191,6 @@ dependencies = [
|
||||||
"toml 0.5.9",
|
"toml 0.5.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "const-random"
|
|
||||||
version = "0.1.18"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
|
|
||||||
dependencies = [
|
|
||||||
"const-random-macro",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "const-random-macro"
|
|
||||||
version = "0.1.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
|
|
||||||
dependencies = [
|
|
||||||
"getrandom",
|
|
||||||
"once_cell",
|
|
||||||
"tiny-keccak",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -254,12 +232,6 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crunchy"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_more"
|
name = "derive_more"
|
||||||
version = "0.99.17"
|
version = "0.99.17"
|
||||||
|
@ -455,26 +427,37 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbasm"
|
name = "hbbytecode"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
dependencies = [
|
|
||||||
"paste",
|
|
||||||
"rhai",
|
|
||||||
"with_builtin_macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbbytecode"
|
name = "hbbytecode"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hblang"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
|
dependencies = [
|
||||||
|
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hbvm"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
|
dependencies = [
|
||||||
|
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbvm"
|
name = "hbvm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbbytecode",
|
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -598,15 +581,6 @@ dependencies = [
|
||||||
"hashbrown 0.12.3",
|
"hashbrown 0.12.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "instant"
|
|
||||||
version = "0.1.12"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ipnet"
|
name = "ipnet"
|
||||||
version = "2.9.0"
|
version = "2.9.0"
|
||||||
|
@ -638,7 +612,7 @@ dependencies = [
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
"hashbrown 0.14.2",
|
"hashbrown 0.14.2",
|
||||||
"hbvm",
|
"hbvm 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)",
|
||||||
"kiam",
|
"kiam",
|
||||||
"limine",
|
"limine",
|
||||||
"log",
|
"log",
|
||||||
|
@ -832,7 +806,7 @@ dependencies = [
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"error-stack",
|
"error-stack",
|
||||||
"fatfs",
|
"fatfs",
|
||||||
"hbasm",
|
"hblang",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"str-reader",
|
"str-reader",
|
||||||
"toml 0.5.11",
|
"toml 0.5.11",
|
||||||
|
@ -878,34 +852,6 @@ dependencies = [
|
||||||
"winreg",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rhai"
|
|
||||||
version = "1.18.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a7d88770120601ba1e548bb6bc2a05019e54ff01b51479e38e64ec3b59d4759"
|
|
||||||
dependencies = [
|
|
||||||
"ahash 0.8.11",
|
|
||||||
"bitflags 2.4.1",
|
|
||||||
"instant",
|
|
||||||
"num-traits",
|
|
||||||
"once_cell",
|
|
||||||
"rhai_codegen",
|
|
||||||
"smallvec",
|
|
||||||
"smartstring",
|
|
||||||
"thin-vec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rhai_codegen"
|
|
||||||
version = "2.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "59aecf17969c04b9c0c5d21f6bc9da9fec9dd4980e64d1871443a476589d8c86"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.38",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ring"
|
name = "ring"
|
||||||
version = "0.17.5"
|
version = "0.17.5"
|
||||||
|
@ -1058,23 +1004,6 @@ dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "smallvec"
|
|
||||||
version = "1.13.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "smartstring"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"static_assertions",
|
|
||||||
"version_check",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "socket2"
|
name = "socket2"
|
||||||
version = "0.4.10"
|
version = "0.4.10"
|
||||||
|
@ -1104,12 +1033,6 @@ dependencies = [
|
||||||
"lock_api",
|
"lock_api",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "static_assertions"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "str-reader"
|
name = "str-reader"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
|
@ -1159,21 +1082,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thin-vec"
|
|
||||||
version = "0.2.13"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a38c90d48152c236a3ab59271da4f4ae63d678c5d7ad6b7714d7cb9760be5e4b"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tiny-keccak"
|
|
||||||
version = "2.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
|
|
||||||
dependencies = [
|
|
||||||
"crunchy",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
|
@ -1562,26 +1470,6 @@ dependencies = [
|
||||||
"windows-sys",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "with_builtin_macros"
|
|
||||||
version = "0.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a59d55032495429b87f9d69954c6c8602e4d3f3e0a747a12dea6b0b23de685da"
|
|
||||||
dependencies = [
|
|
||||||
"with_builtin_macros-proc_macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "with_builtin_macros-proc_macros"
|
|
||||||
version = "0.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "15bd7679c15e22924f53aee34d4e448c45b674feb6129689af88593e129f8f42"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x2apic"
|
name = "x2apic"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
|
|
|
@ -9,8 +9,8 @@ derive_more = "0.99"
|
||||||
error-stack = "0.4"
|
error-stack = "0.4"
|
||||||
fatfs = "0.3"
|
fatfs = "0.3"
|
||||||
toml = "0.5.2"
|
toml = "0.5.2"
|
||||||
hbasm.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git"
|
# hbasm.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git"
|
||||||
# hblang.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git"
|
hblang.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git"
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.11"
|
version = "0.11"
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
use std::process::exit;
|
use std::{
|
||||||
|
fs::{read_to_string, File},
|
||||||
|
io::{BufWriter, Write},
|
||||||
|
process::exit,
|
||||||
|
};
|
||||||
|
|
||||||
|
use error_stack::Report;
|
||||||
|
|
||||||
|
use crate::Error;
|
||||||
pub struct Package {
|
pub struct Package {
|
||||||
name: String,
|
name: String,
|
||||||
|
binaries: Vec<String>,
|
||||||
|
build_cmd: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Package {
|
impl Package {
|
||||||
|
@ -20,13 +30,71 @@ impl Package {
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
|
|
||||||
let mut data: Value = toml::from_str(&contents).unwrap();
|
let mut data: Value = toml::from_str(&contents).unwrap();
|
||||||
let name = data
|
let mut name = data
|
||||||
.get("package")
|
.get("package")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get("name")
|
.get("name")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string();
|
.to_string();
|
||||||
|
name.pop();
|
||||||
|
name.remove(0);
|
||||||
|
|
||||||
Self { name }
|
let dependants = data.get("dependants").unwrap();
|
||||||
|
let bin_table = dependants.get("binaries").unwrap().as_table().unwrap();
|
||||||
|
let mut binaries = vec![];
|
||||||
|
|
||||||
|
for (count, (name, table)) in bin_table.into_iter().enumerate() {
|
||||||
|
// if count != 0 {
|
||||||
|
println!("{}", name);
|
||||||
|
binaries.push(name.clone());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
let build_table = data.get("build").unwrap();
|
||||||
|
|
||||||
|
let mut build_cmd: String = build_table.get("command").unwrap().as_str().unwrap().into();
|
||||||
|
build_cmd.remove(0);
|
||||||
|
// build_cmd.pop();
|
||||||
|
|
||||||
|
Self {
|
||||||
|
name,
|
||||||
|
binaries,
|
||||||
|
build_cmd,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn build(&self) {
|
||||||
|
if self.binaries.contains(&"hblang".to_string()) {
|
||||||
|
let file_order = self.build_cmd.split_ascii_whitespace();
|
||||||
|
let mut files = vec![];
|
||||||
|
for (count, file) in file_order.enumerate() {
|
||||||
|
if count != 0 {
|
||||||
|
println!("{}", file);
|
||||||
|
files.push(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut bundle = vec![];
|
||||||
|
for file in files {
|
||||||
|
let contents = read_to_string(file).unwrap();
|
||||||
|
bundle.push((file, contents));
|
||||||
|
}
|
||||||
|
|
||||||
|
use hblang::{codegen, parser};
|
||||||
|
let mut codegen = codegen::Codegen::default();
|
||||||
|
for (path, content) in bundle.iter() {
|
||||||
|
println!("A");
|
||||||
|
codegen.files = vec![parser::Ast::new(&path, &content, &parser::no_loader)];
|
||||||
|
codegen.generate();
|
||||||
|
}
|
||||||
|
let mut buf = BufWriter::new(Vec::new());
|
||||||
|
codegen.dump(&mut buf);
|
||||||
|
let bytes = buf.into_inner().unwrap();
|
||||||
|
match std::fs::create_dir("target/programs") {
|
||||||
|
Ok(_) => (),
|
||||||
|
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (),
|
||||||
|
Err(e) => panic!(),
|
||||||
|
}
|
||||||
|
let path = format!("target/test-programs/{}.hbf", self.name);
|
||||||
|
let mut file = File::create(path).unwrap();
|
||||||
|
file.write_all(&bytes).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,8 +117,8 @@ fn assemble() -> Result<(), Error> {
|
||||||
.map_err(Report::from)
|
.map_err(Report::from)
|
||||||
.change_context(Error::Io)?;
|
.change_context(Error::Io)?;
|
||||||
|
|
||||||
hbasm::assembler(&mut out, |engine| engine.run_file(entry.path()))
|
// hbasm::assembler(&mut out, |engine| engine.run_file(entry.path()))
|
||||||
.map_err(|e| report!(Error::Assembler).attach_printable(e.to_string()))?;
|
// .map_err(|e| report!(Error::Assembler).attach_printable(e.to_string()))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -139,9 +139,9 @@ fn get_fs() -> Result<FileSystem<impl ReadWriteSeek>, io::Error> {
|
||||||
|
|
||||||
let fs = FileSystem::new(img, FsOptions::new())?;
|
let fs = FileSystem::new(img, FsOptions::new())?;
|
||||||
|
|
||||||
let p = Package::load_from_file(
|
// TODO: Do not hard code these here
|
||||||
"/home/able/Projects/ableos/sysdata/programs/tests/meta.toml".to_owned(),
|
let p = Package::load_from_file("sysdata/programs/tests/meta.toml".to_owned());
|
||||||
);
|
p.build();
|
||||||
|
|
||||||
// Read the contents of the file using a `match` block
|
// Read the contents of the file using a `match` block
|
||||||
// to return the `data: Ok(c)` as a `String`
|
// to return the `data: Ok(c)` as a `String`
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
/*
|
char := struct {}
|
||||||
Refer to the spec in "spec/Logging Service spec.md"
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
log := fn(log_level: int, message: ^char, message_length: int): int {
|
log := fn(log_level: int, message: ^char, message_length: int): int {
|
||||||
|
@ -26,4 +24,8 @@ debug := fn(message: ^char, message_length: int): int {
|
||||||
|
|
||||||
trace := fn(message: ^char, message_length: int): int {
|
trace := fn(message: ^char, message_length: int): int {
|
||||||
log(4, message, message_length)
|
log(4, message, message_length)
|
||||||
|
}
|
||||||
|
|
||||||
|
main := fn(): int {
|
||||||
|
return 0;
|
||||||
}
|
}
|
|
@ -8,4 +8,4 @@ authors = ["able"]
|
||||||
hblang.version = "1.0.0"
|
hblang.version = "1.0.0"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
command = "hblang libraries/stn/src/lib.hb src/main.hbl"
|
command = "hblang sysdata/libraries/stn/src/lib.hb sysdata/programs/tests/src/main.hb"
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
main := fn(): int {
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -17,32 +17,6 @@ resolution = "1024x768x24"
|
||||||
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules]
|
[boot.limine.ableos.modules]
|
||||||
# [boot.limine.ableos.modules.failure]
|
[boot.limine.ableos.modules.tests]
|
||||||
# path = "boot:///failure.hbf"
|
# TODO: Pull from the programs included here
|
||||||
|
path = "boot:///tests.hbf"
|
||||||
# [boot.limine.ableos.modules.ecall]
|
|
||||||
# path = "boot:///ecall.hbf"
|
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.sds_test]
|
|
||||||
# path = "boot:///sds_test.hbf"
|
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.main]
|
|
||||||
# path = "boot:///main.hbf"
|
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.keyboard_driver]
|
|
||||||
# path = "boot:///keyboard_driver.hbf"
|
|
||||||
# cmd_line = "arch=${ARCH}"
|
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.vfs_test]
|
|
||||||
# path = "boot:///vfs_test.hbf"
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules.bin]
|
|
||||||
path = "boot:///bin.hbf"
|
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.limine_framebuffer_driver]
|
|
||||||
# path = "boot:///limine_framebuffer_driver.hbf"
|
|
||||||
# cmd_line = "height=10 width=10 arch=${ARCH}"
|
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.serial_driver]
|
|
||||||
# path = "boot:///serial_driver.hbf"
|
|
||||||
# cmd_line = "arch=${ARCH}"
|
|
||||||
|
|
Loading…
Reference in a new issue