]> Repositorios git - scryer-prolog.git/commitdiff
correct PStrLocation offset bug in copier.rs
authorMark Thom <[email protected]>
Thu, 20 Feb 2020 17:59:42 +0000 (10:59 -0700)
committerMark Thom <[email protected]>
Thu, 20 Feb 2020 17:59:42 +0000 (10:59 -0700)
src/prolog/heap_iter.rs
src/prolog/machine/copier.rs

index ca0c25a19a91504c239bed77445fc709b5df99c2..e3780b209526caa13a99e61dd83e191d7cf810a6 100644 (file)
@@ -84,7 +84,7 @@ impl<'a> HCPreOrderIterator<'a> {
             Addr::PStrLocation(h, n) => {
                 if let HeapCellValue::PartialString(ref pstr) = &self.machine_st.heap[h] {
                     let s = pstr.block_as_str();
-
+                    
                     if let Some(c) = s[n ..].chars().next() {
                         if pstr.len() > n + c.len_utf8() {                        
                             self.state_stack.push(Addr::PStrLocation(h, n + c.len_utf8()));
index c95208480dd9f1301a78d64dbbe504a188156fd4..1dda5d66d0ef2cb6479ec42d651ceab402e9e275 100644 (file)
@@ -191,7 +191,7 @@ impl<T: CopierTarget> CopyTermState<T> {
         let threshold = self.target.threshold();
 
         self.target[self.scan] =
-            HeapCellValue::Addr(Addr::PStrLocation(threshold, n));
+            HeapCellValue::Addr(Addr::PStrLocation(threshold, 0));
 
         self.scan += 1;