patching together some broken stuff
This commit is contained in:
parent
c57ef99948
commit
e08eab8627
|
@ -1,4 +1,5 @@
|
||||||
use std::{
|
use std::{
|
||||||
|
fmt::format,
|
||||||
fs::{read_to_string, File},
|
fs::{read_to_string, File},
|
||||||
io::{BufWriter, Write},
|
io::{BufWriter, Write},
|
||||||
process::exit,
|
process::exit,
|
||||||
|
@ -67,21 +68,24 @@ impl Package {
|
||||||
let mut files = vec![];
|
let mut files = vec![];
|
||||||
for (count, file) in file_order.enumerate() {
|
for (count, file) in file_order.enumerate() {
|
||||||
if count != 0 {
|
if count != 0 {
|
||||||
println!("{}", file);
|
|
||||||
files.push(file);
|
files.push(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut bundle = vec![];
|
let mut bundle = vec![];
|
||||||
for file in files {
|
for file in files {
|
||||||
let contents = read_to_string(file).unwrap();
|
let file_path = if file.starts_with("libraries") {
|
||||||
|
format!("sysdata/{}", file)
|
||||||
|
} else {
|
||||||
|
format!("sysdata/programs/{}/{}", self.name, file)
|
||||||
|
};
|
||||||
|
let contents = read_to_string(file_path).unwrap();
|
||||||
bundle.push((file, contents));
|
bundle.push((file, contents));
|
||||||
}
|
}
|
||||||
|
|
||||||
use hblang::{codegen, parser};
|
use hblang::{codegen, parser};
|
||||||
let mut codegen = codegen::Codegen::default();
|
let mut codegen = codegen::Codegen::default();
|
||||||
for (path, content) in bundle.iter() {
|
for (path, content) in bundle.iter() {
|
||||||
println!("A");
|
codegen.files = vec![parser::Ast::new(path, content, &parser::no_loader)];
|
||||||
codegen.files = vec![parser::Ast::new(&path, &content, &parser::no_loader)];
|
|
||||||
codegen.generate();
|
codegen.generate();
|
||||||
}
|
}
|
||||||
let mut buf = BufWriter::new(Vec::new());
|
let mut buf = BufWriter::new(Vec::new());
|
||||||
|
@ -92,7 +96,7 @@ impl Package {
|
||||||
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (),
|
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (),
|
||||||
Err(e) => panic!(),
|
Err(e) => panic!(),
|
||||||
}
|
}
|
||||||
let path = format!("target/test-programs/{}.hbf", self.name);
|
let path = format!("target/programs/{}.hbf", self.name);
|
||||||
let mut file = File::create(path).unwrap();
|
let mut file = File::create(path).unwrap();
|
||||||
file.write_all(&bytes).unwrap();
|
file.write_all(&bytes).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ TERM_BACKDROP={}
|
||||||
// let mut real_modules = modules.clone();
|
// let mut real_modules = modules.clone();
|
||||||
|
|
||||||
modules.into_iter().for_each(|(key, value)| {
|
modules.into_iter().for_each(|(key, value)| {
|
||||||
if value.is_table() && key == "tests" {
|
if value.is_table() {
|
||||||
let path = get_path_without_boot_prefix(
|
let path = get_path_without_boot_prefix(
|
||||||
value.get("path").expect("You must have `path` as a value"),
|
value.get("path").expect("You must have `path` as a value"),
|
||||||
)
|
)
|
||||||
|
@ -280,7 +280,7 @@ TERM_BACKDROP={}
|
||||||
.expect("You must have a `path` as a value"),
|
.expect("You must have a `path` as a value"),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let fpath = format!("target/test-programs/{}", path);
|
let fpath = format!("target/programs/{}", path);
|
||||||
copy_file_to_img(&fpath, &fs);
|
copy_file_to_img(&fpath, &fs);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -312,6 +312,7 @@ TERM_BACKDROP={}
|
||||||
|
|
||||||
fn copy_file_to_img(fpath: &str, fs: &FileSystem<File>) {
|
fn copy_file_to_img(fpath: &str, fs: &FileSystem<File>) {
|
||||||
let path = Path::new(fpath);
|
let path = Path::new(fpath);
|
||||||
|
// println!("{path:?}");
|
||||||
io::copy(
|
io::copy(
|
||||||
&mut File::open(path).expect(&format!("Could not open file {fpath}")),
|
&mut File::open(path).expect(&format!("Could not open file {fpath}")),
|
||||||
&mut fs
|
&mut fs
|
||||||
|
|
|
@ -2,7 +2,7 @@ char := struct {}
|
||||||
|
|
||||||
|
|
||||||
log := fn(log_level: int, message: ^char, message_length: int): int {
|
log := fn(log_level: int, message: ^char, message_length: int): int {
|
||||||
|
@eca(i32,1, 1, 1)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,4 +28,8 @@ trace := fn(message: ^char, message_length: int): int {
|
||||||
|
|
||||||
main := fn(): int {
|
main := fn(): int {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test := fn(): int {
|
||||||
|
@eca(i32, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|
11
sysdata/programs/diskio_driver/meta.toml
Normal file
11
sysdata/programs/diskio_driver/meta.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[package]
|
||||||
|
name = "diskio_driver"
|
||||||
|
authors = ["able"]
|
||||||
|
|
||||||
|
[dependants.libraries]
|
||||||
|
|
||||||
|
[dependants.binaries]
|
||||||
|
hblang.version = "1.0.0"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
command = "hblang libraries/stn/src/lib.hb src/main.hb"
|
|
@ -1,4 +1,3 @@
|
||||||
main := fn(): int {
|
main := fn(): int {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "dev"
|
name = "fb_driver"
|
||||||
authors = ["able"]
|
authors = ["able"]
|
||||||
|
|
||||||
[dependants.libraries]
|
[dependants.libraries]
|
||||||
|
@ -7,5 +7,5 @@ authors = ["able"]
|
||||||
[dependants.binaries]
|
[dependants.binaries]
|
||||||
hblang.version = "1.0.0"
|
hblang.version = "1.0.0"
|
||||||
|
|
||||||
[build.debug]
|
[build]
|
||||||
command = "hblang libraries/stn/src/lib.hb src/main.hbl"
|
command = "hblang libraries/stn/src/lib.hb src/main.hb"
|
||||||
|
|
|
@ -8,4 +8,4 @@ authors = ["able"]
|
||||||
hblang.version = "1.0.0"
|
hblang.version = "1.0.0"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
command = "hblang sysdata/libraries/stn/src/lib.hb sysdata/programs/tests/src/main.hb"
|
command = "hblang libraries/stn/src/lib.hb src/main.hb"
|
||||||
|
|
|
@ -18,5 +18,6 @@ resolution = "1024x768x24"
|
||||||
|
|
||||||
[boot.limine.ableos.modules]
|
[boot.limine.ableos.modules]
|
||||||
[boot.limine.ableos.modules.tests]
|
[boot.limine.ableos.modules.tests]
|
||||||
# TODO: Pull from the programs included here
|
|
||||||
path = "boot:///tests.hbf"
|
path = "boot:///tests.hbf"
|
||||||
|
[boot.limine.ableos.modules.diskio_driver]
|
||||||
|
path = "boot:///diskio_driver.hbf"
|
||||||
|
|
Loading…
Reference in a new issue