Get overlay structure ready
This commit is contained in:
parent
eb025d3902
commit
0057f5ee88
|
@ -1,14 +1 @@
|
|||
pub fn add(left: usize, right: usize) -> usize {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
pub mod types;
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
fn main() {
|
||||
println!("Blubbi");
|
||||
use mkoverlay::types::{OverlaySection, OverlaySlot};
|
||||
|
||||
fn generate_file() -> Vec<OverlaySlot> {
|
||||
let mut slots = Vec::new();
|
||||
let mut slot = OverlaySlot::new("slot_0".to_owned(), String::new());
|
||||
let mut section = OverlaySection::new("main_area".to_owned());
|
||||
|
||||
section.add_file_pattern("bin/PSX-release/src/*.o".to_owned());
|
||||
|
||||
slot.add_section(section);
|
||||
slots.push(slot);
|
||||
|
||||
slots
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("Blubbi: {:?}", generate_file());
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#[derive(Debug)]
|
||||
pub struct OverlaySection {
|
||||
name: String,
|
||||
file_pattern: Vec<String>
|
||||
}
|
||||
|
||||
impl OverlaySection {
|
||||
pub fn new(name: String) -> OverlaySection {
|
||||
OverlaySection{name, file_pattern: Vec::new()}
|
||||
}
|
||||
|
||||
pub fn add_file_pattern(&mut self, file_pattern: String) {
|
||||
self.file_pattern.push(file_pattern);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct OverlaySlot {
|
||||
name: String,
|
||||
start_adr: String,
|
||||
sections: Vec<OverlaySection>
|
||||
}
|
||||
|
||||
impl OverlaySlot {
|
||||
pub fn new(name: String, start_adr: String) -> OverlaySlot {
|
||||
OverlaySlot{name, start_adr, sections: Vec::new()}
|
||||
}
|
||||
|
||||
pub fn add_section(&mut self, section: OverlaySection) {
|
||||
self.sections.push(section);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue