Heap bonus!

This commit is contained in:
2018-05-23 14:22:01 +02:00
parent 7e044abb53
commit a652dc1a17
6 changed files with 120 additions and 3 deletions

View File

@@ -12,6 +12,9 @@ use Result;
use std::sync::Mutex;
use std::rc::Rc;
#[cfg(feature = "bonus:heap")]
use heap::Heap;
const MAGIC_HEADER:u32 = 0x1DEA_DFAD;
const ANTI_BS_SIZE:usize = 0xFFFF;
@@ -23,6 +26,9 @@ pub struct Machine {
pub frame: Vec<Frame>,
pub net: NetStack,
#[cfg(feature = "bonus:heap")]
pub heap: Heap,
pub stream_in: Box<Read>,
pub stream_out: Rc<Mutex<Write>>,
@@ -36,9 +42,13 @@ impl Machine {
pool,
block,
frame: vec![Frame::new(ANTI_BS_SIZE)],
net: NetStack::new(),
stream_in: Box::new(::std::io::stdin()),
stream_out: Rc::new(Mutex::new(::std::io::stdout())),
net: NetStack::new(),
#[cfg(feature = "bonus:heap")]
heap: Heap::new(),
}
}