diff --git a/repbuild/src/dev.rs b/repbuild/src/dev.rs index e779c5624..3dc6d0e87 100644 --- a/repbuild/src/dev.rs +++ b/repbuild/src/dev.rs @@ -1,4 +1,5 @@ use std::{ + fmt::format, fs::{read_to_string, File}, io::{BufWriter, Write}, process::exit, @@ -67,21 +68,24 @@ impl Package { 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(); + 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)); } 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.files = vec![parser::Ast::new(path, content, &parser::no_loader)]; codegen.generate(); } let mut buf = BufWriter::new(Vec::new()); @@ -92,7 +96,7 @@ impl Package { Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (), 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(); file.write_all(&bytes).unwrap(); } diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index 0418a1e21..ab98df891 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -241,7 +241,7 @@ TERM_BACKDROP={} // let mut real_modules = modules.clone(); modules.into_iter().for_each(|(key, value)| { - if value.is_table() && key == "tests" { + if value.is_table() { let path = get_path_without_boot_prefix( 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"), ) .unwrap(); - let fpath = format!("target/test-programs/{}", path); + let fpath = format!("target/programs/{}", path); copy_file_to_img(&fpath, &fs); } }); @@ -312,6 +312,7 @@ TERM_BACKDROP={} fn copy_file_to_img(fpath: &str, fs: &FileSystem) { let path = Path::new(fpath); + // println!("{path:?}"); io::copy( &mut File::open(path).expect(&format!("Could not open file {fpath}")), &mut fs diff --git a/sysdata/libraries/stn/src/lib.hb b/sysdata/libraries/stn/src/lib.hb index 09bb90ff1..663c3b2da 100644 --- a/sysdata/libraries/stn/src/lib.hb +++ b/sysdata/libraries/stn/src/lib.hb @@ -2,7 +2,7 @@ char := struct {} log := fn(log_level: int, message: ^char, message_length: int): int { - + @eca(i32,1, 1, 1) return 0; } @@ -28,4 +28,8 @@ trace := fn(message: ^char, message_length: int): int { main := fn(): int { return 0; -} \ No newline at end of file +} + +test := fn(): int { + @eca(i32, 1, 1, 1); +} diff --git a/sysdata/programs/diskio_driver/meta.toml b/sysdata/programs/diskio_driver/meta.toml new file mode 100644 index 000000000..dc316524b --- /dev/null +++ b/sysdata/programs/diskio_driver/meta.toml @@ -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" diff --git a/sysdata/programs/diskio_driver/src/main.hb b/sysdata/programs/diskio_driver/src/main.hb index f07022822..cd84536e8 100644 --- a/sysdata/programs/diskio_driver/src/main.hb +++ b/sysdata/programs/diskio_driver/src/main.hb @@ -1,4 +1,3 @@ main := fn(): int { - return 0; } \ No newline at end of file diff --git a/sysdata/programs/fb_driver/meta.toml b/sysdata/programs/fb_driver/meta.toml index 362ee3792..f96168e34 100644 --- a/sysdata/programs/fb_driver/meta.toml +++ b/sysdata/programs/fb_driver/meta.toml @@ -1,5 +1,5 @@ [package] -name = "dev" +name = "fb_driver" authors = ["able"] [dependants.libraries] @@ -7,5 +7,5 @@ authors = ["able"] [dependants.binaries] hblang.version = "1.0.0" -[build.debug] -command = "hblang libraries/stn/src/lib.hb src/main.hbl" +[build] +command = "hblang libraries/stn/src/lib.hb src/main.hb" diff --git a/sysdata/programs/tests/meta.toml b/sysdata/programs/tests/meta.toml index a4396a5bc..c68328900 100644 --- a/sysdata/programs/tests/meta.toml +++ b/sysdata/programs/tests/meta.toml @@ -8,4 +8,4 @@ authors = ["able"] hblang.version = "1.0.0" [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" diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 8b2a1905b..e6e738c0a 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -18,5 +18,6 @@ resolution = "1024x768x24" [boot.limine.ableos.modules] [boot.limine.ableos.modules.tests] -# TODO: Pull from the programs included here path = "boot:///tests.hbf" +[boot.limine.ableos.modules.diskio_driver] +path = "boot:///diskio_driver.hbf"