forked from Rativel/BurritOS
change memory to a vector, it can now be fill
This commit is contained in:
@@ -106,7 +106,7 @@ impl Mem_Checker{
|
||||
|
||||
pub fn from(path: &String) -> Mem_Checker {
|
||||
|
||||
let file = fs::File::open("test_file_section.txt").expect("Wrong filename");
|
||||
let file = fs::File::open(path).expect("Wrong filename");
|
||||
|
||||
let reader = io::BufReader::new(file);
|
||||
let mut lines = reader.lines();
|
||||
@@ -124,7 +124,7 @@ impl Mem_Checker{
|
||||
let current_line = vector.get(i).unwrap_or(&default);
|
||||
|
||||
//Lecture des sections
|
||||
if current_line.contains(' ') {
|
||||
if i % 2 == 0 {
|
||||
//lecture ligne ADDR LEN
|
||||
let next_word_index = current_line.find(' ').unwrap();
|
||||
tmp_addr_str = String::from(¤t_line[0..next_word_index]);
|
||||
@@ -135,7 +135,7 @@ impl Mem_Checker{
|
||||
let section_f = SectionFormat{
|
||||
addr: tmp_addr_str.clone(),
|
||||
len: tmp_len_str.clone(),
|
||||
content: current_line.clone(),
|
||||
content: current_line.clone().replace(" ", ""),
|
||||
};
|
||||
sections.push(Section::from(§ion_f));
|
||||
}
|
||||
@@ -147,8 +147,8 @@ impl Mem_Checker{
|
||||
|
||||
|
||||
pub fn print_Mem_Checker(m_c: &Mem_Checker){
|
||||
println!("PC :: {}", m_c.pc);
|
||||
println!("SP :: {}", m_c.sp);
|
||||
println!("PC :: {:x}", m_c.pc);
|
||||
println!("SP :: {:x}", m_c.sp);
|
||||
|
||||
for(i,s) in m_c.sections.iter().enumerate() {
|
||||
println!("\nSection {}\n", i);
|
||||
|
||||
Reference in New Issue
Block a user