pub fn print_stack<'a>(
        &mut self, chunk: &Chunk, i: usize,
        scopes: &mut Vec<RefCell<HashMap<String, Rc<RefCell<Value>>>>>,
        global_functions: &mut RefCell<HashMap<String, Chunk>>,
        running: Arc<AtomicBool>, no_remove: bool,
    ) {
        let mut window_height: i32 = 0;
        let dim_opt = term_size::dimensions();
        match dim_opt {
            Some((_, h)) => {
                window_height = h.try_into().unwrap();
            }
            _ => {}
        }
        let mut lines_to_print = window_height - 1;

        let mut stack_backup = Vec::new();
        while self.stack.len() > 0 {
            let value_rr = self.stack.remove(0);
            lines_to_print = self.print_stack_value(
                &value_rr,
                chunk,
                i,
                scopes,
                global_functions,
                0,
                false,
                window_height,
                lines_to_print,
                running.clone(),
            );
            if lines_to_print == -1 {
                if !no_remove {
                    self.stack.clear();
                }
                return;
            }
            stack_backup.push(value_rr);
        }
        if no_remove {
            self.stack = stack_backup;
        }
    }
/// Takes the current chunk, the instruction index, the set of
/// scopes, the map of global functions, the running flag, and a
/// boolean indicating whether the stack needs to be cleared after
/// the stack is printed.  Prints the stack to standard output.
Takes the current chunk, the instruction index, the set of
scopes, the map of global functions, the running flag, and a
boolean indicating whether the stack needs to be cleared after
the stack is printed.  Prints the stack to standard output.
Takes the current chunk the instruction index the set of scopes the map of global functions the running flag and a boolean indicating whether the stack needs to be cleared after the stack is printed . Prints the stack to standard output .
pub fn print_stack<'a>(
        &mut self, chunk: &Chunk, i: usize,
        scopes: &mut Vec<RefCell<HashMap<String, Rc<RefCell<Value>>>>>,
        global_functions: &mut RefCell<HashMap<String, Chunk>>,
        running: Arc<AtomicBool>, no_remove: bool,
    ) {
        let mut window_height: i32 = 0;
        let dim_opt = term_size::dimensions();
        match dim_opt {
            Some((_, h)) => {
                window_height = h.try_into().unwrap();
            }
            _ => {}
        }
        let mut lines_to_print = window_height - 1;
        let mut stack_backup = Vec::new();
        while self.stack.len() > 0 {
            let value_rr = self.stack.remove(0);
            lines_to_print = self.print_stack_value(
                &value_rr,
                chunk,
                i,
                scopes,
                global_functions,
                0,
                false,
                window_height,
                lines_to_print,
                running.clone(),
            );
            if lines_to_print == -1 {
                if !no_remove {
                    self.stack.clear();
                }
                return;
            }
            stack_backup.push(value_rr);
        }
        if no_remove {
            self.stack = stack_backup;
        }
    }
pub fn print_stack < ' a > ( & mut self , chunk : & Chunk , i : usize , scopes : & mut Vec < RefCell < HashMap < String , Rc < RefCell < Value > > > > > , global_functions : & mut RefCell < HashMap < String , Chunk > > , running : Arc < AtomicBool > , no_remove : bool , ) { let mut window_height : i32 = 0 ; let dim_opt = term_size :: dimensions ( ) ; match dim_opt { Some ( ( _ , h ) ) => { window_height = h . try_into ( ) . unwrap ( ) ; } _ => { } } let mut lines_to_print = window_height - 1 ; let mut stack_backup = Vec :: new ( ) ; while self . stack . len ( ) > 0 { let value_rr = self . stack . remove ( 0 ) ; lines_to_print = self . print_stack_value ( & value_rr , chunk , i , scopes , global_functions , 0 , false , window_height , lines_to_print , running . clone ( ) , ) ; if lines_to_print == - 1 { if ! no_remove { self . stack . clear ( ) ; } return ; } stack_backup . push ( value_rr ) ; } if no_remove { self . stack = stack_backup ; } }
Takes the current chunk, the instruction index, the set of
scopes, the map of global functions, the running flag, and a
boolean indicating whether the stack needs to be cleared after
the stack is printed.
Takes the current chunk the instruction index the set of scopes the map of global functions the running flag and a boolean indicating whether the stack needs to be cleared after the stack is printed .
&mut self
chunk
&Chunk
i
usize
scopes
&mut Vec<RefCell<HashMap<String, Rc<RefCell<Value>>>>>
global_functions
&mut RefCell<HashMap<String, Chunk>>
running
Arc<AtomicBool>
no_remove
bool