]> Repositorios git - scryer-prolog.git/commitdiff
recognize [] as equivalent to "" in unify_atom (#1288)
authorMark Thom <[email protected]>
Wed, 23 Feb 2022 06:45:04 +0000 (23:45 -0700)
committerMark Thom <[email protected]>
Wed, 23 Feb 2022 06:45:58 +0000 (23:45 -0700)
src/machine/machine_state_impl.rs
src/machine/system_calls.rs

index 931f0f114374c05aa742a230bea6194da7bd1bee..85fac0315097a7c59cc03a941ba86da945c608ac 100644 (file)
@@ -544,6 +544,9 @@ impl MachineState {
             (HeapCellValueTag::Atom, (name, arity)) => {
                 self.fail = !(arity == 0 && name == atom);
             }
+            (HeapCellValueTag::CStr, cstr_atom) if atom == atom!("[]") => {
+                self.fail = cstr_atom != atom!("");
+            }
             (HeapCellValueTag::Char, c1) => {
                 if let Some(c2) = atom.as_char() {
                     self.fail = c1 != c2;
index becc644e8107b89dcf9bb4cdd687e40317377235..a407d7faed680420efef80ef2add8cf297544b3b 100644 (file)
@@ -2494,9 +2494,10 @@ impl Machine {
             }
         };
 
+        let output = self.machine_st.store(self.machine_st.deref(self.machine_st.registers[3]));
         let atom = self.machine_st.atom_tbl.build_with(&string);
-        self.machine_st.unify_complete_string(atom, self.machine_st.store(self.machine_st.deref(self.machine_st.registers[3])));
 
+        self.machine_st.unify_complete_string(atom, output);
         Ok(())
     }