correct char_type/2 (#2132)

This commit is contained in:
Mark
2023-10-24 15:35:37 -06:00
parent f80dff851b
commit f10d7c05f9

View File

@@ -2929,10 +2929,9 @@ impl Machine {
} }
); );
self.machine_st.fail = true; // This predicate fails by default.
read_heap_cell!(a2, read_heap_cell!(a2,
(HeapCellValueTag::Atom, (chars, _arity)) => { (HeapCellValueTag::Atom, (chars, _arity)) => {
self.machine_st.fail = true; // This predicate fails by default.
macro_rules! macro_check { macro_rules! macro_check {
($id:ident, $name:expr) => { ($id:ident, $name:expr) => {
if $id!(c) && chars == $name { if $id!(c) && chars == $name {
@@ -3003,19 +3002,17 @@ impl Machine {
let atom = AtomTable::build_with(&self.machine_st.atom_tbl, &c.to_uppercase().to_string()); let atom = AtomTable::build_with(&self.machine_st.atom_tbl, &c.to_uppercase().to_string());
let upper_str = string_as_cstr_cell!(atom); let upper_str = string_as_cstr_cell!(atom);
unify!(self.machine_st, reg, upper_str); unify!(self.machine_st, reg, upper_str);
self.machine_st.fail = false;
} }
(atom!("to_lower"), 1) => { (atom!("to_lower"), 1) => {
let reg = self.machine_st.deref(self.machine_st.heap[s+1]); let reg = self.machine_st.deref(self.machine_st.heap[s+1]);
let atom = AtomTable::build_with(&self.machine_st.atom_tbl, &c.to_lowercase().to_string()); let atom = AtomTable::build_with(&self.machine_st.atom_tbl, &c.to_lowercase().to_string());
let lower_str = string_as_cstr_cell!(atom); let lower_str = string_as_cstr_cell!(atom);
unify!(self.machine_st, reg, lower_str); unify!(self.machine_st, reg, lower_str);
self.machine_st.fail = false;
} }
_ => { _ => {
unreachable!() unreachable!()
} }
}; }
} }
_ => { _ => {
unreachable!() unreachable!()