Merge branch 'decode_print' of https://gitlab.istic.univ-rennes1.fr/simpleos/burritos into decode_print
This commit is contained in:
@ -82,7 +82,7 @@ impl Section{
|
||||
/*
|
||||
* Representation de l'etat de la mémoire (apres execution.... a confirmer), sous forme de sections
|
||||
*/
|
||||
struct Mem_Checker{
|
||||
pub struct Mem_Checker{
|
||||
pc: usize,
|
||||
sp: usize,
|
||||
sections: Vec<Section>,
|
||||
@ -91,10 +91,13 @@ struct Mem_Checker{
|
||||
|
||||
impl Mem_Checker{
|
||||
|
||||
fn from(path: &String) -> Mem_Checker {
|
||||
pub fn from(path: &String) -> Mem_Checker {
|
||||
|
||||
let file = fs::File::open("test_file_section.txt").expect("Wrong filename");
|
||||
let reader = io::BufReader::new(file);
|
||||
let reader = io::BufReader::new(&file);
|
||||
let reader2 = io::BufReader::new(&file);
|
||||
let lines = reader.lines();
|
||||
let length = reader2.lines().count();
|
||||
|
||||
let mut pc: usize = 0;
|
||||
let mut sp: usize = 0;
|
||||
@ -103,15 +106,15 @@ impl Mem_Checker{
|
||||
let mut tmp_addr_str: String = String::new();
|
||||
let mut tmp_len_str: String = String::new();
|
||||
|
||||
for (i,line) in reader.lines().enumerate() {
|
||||
for (i,line) in lines.enumerate() {
|
||||
|
||||
let current_line = line.unwrap();
|
||||
|
||||
if i == current_line.len()-2 {
|
||||
if i == length-2 {
|
||||
//Lecture de PC
|
||||
pc = string_hex_to_usize(¤t_line);
|
||||
}
|
||||
else if i == current_line.len()-1 {
|
||||
else if i == length-1 {
|
||||
//Lecture SP
|
||||
sp = string_hex_to_usize(¤t_line);
|
||||
}
|
||||
@ -151,7 +154,7 @@ impl Mem_Checker{
|
||||
|
||||
}
|
||||
|
||||
fn fill_memory_from_Mem_Checker(m_c: &Mem_Checker, machine: &mut Machine){
|
||||
pub fn fill_memory_from_Mem_Checker(m_c: &Mem_Checker, machine: &mut Machine){
|
||||
|
||||
machine.sp = m_c.sp;
|
||||
machine.pc = m_c.pc as u64;
|
||||
@ -277,7 +280,6 @@ mod tests {
|
||||
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn test_enum_start_at_zero(){
|
||||
let v = vec![1,2,3];
|
||||
|
Reference in New Issue
Block a user