use crate::core::{Core, CoreExt, SiteId, Status};
use crate::{Register, Site};
impl<Id: SiteId, Cx: CoreExt, const CALL_STACK_SIZE: usize> Core<Id, Cx, CALL_STACK_SIZE> {
pub fn co(&self) -> Status { self.co }
pub fn set_co(&mut self, co: Status) { self.co = co; }
pub fn cf(&self) -> u64 { self.cf }
pub fn has_failed(&self) -> bool { self.cf > 0 }
pub fn ck(&self) -> Status { self.ck }
#[must_use]
pub(crate) fn fail_ck(&mut self) -> bool {
self.ck = Status::Fail;
self.cf += 1;
self.ch
}
pub fn reset_ck(&mut self) { self.ck = Status::Ok }
pub fn cp(&self) -> u16 { self.cs.len() as u16 }
pub fn push_cs(&mut self, from: Site<Id>) -> Option<u16> {
self.cs.push(from).ok()?;
Some(self.cp())
}
pub fn pop_cs(&mut self) -> Option<Site<Id>> { self.cs.pop() }
pub fn cl(&self) -> Option<u64> { self.cl }
pub fn acc_complexity(&mut self, complexity: u64) -> bool {
self.ca = self.ca.saturating_add(complexity);
self.cl().map(|lim| self.ca < lim).unwrap_or(true)
}
pub fn get(&self, reg: Cx::Reg) -> Option<<Cx::Reg as Register>::Value> { self.cx.get(reg) }
}