add open/3, write_term/3

This commit is contained in:
Mark Thom
2020-05-04 14:50:26 -06:00
parent 407094cdcb
commit 0d7a9f32d6
9 changed files with 308 additions and 92 deletions

View File

@@ -405,3 +405,26 @@ macro_rules! ar_reg {
ArithmeticTerm::Reg($r)
};
}
macro_rules! atom_from {
($self:expr, $indices:expr, $e:expr) => {
match $e {
Addr::Con(h) if $self.heap.atom_at(h) => {
match &$self.heap[h] {
HeapCellValue::Atom(ref atom, _) => {
atom.clone()
}
_ => {
unreachable!()
}
}
}
Addr::Char(c) => {
clause_name!(c.to_string(), $indices.atom_tbl.clone())
}
_ => {
unreachable!()
}
}
}
}