]> Repositorios git - scryer-prolog.git/commitdiff
fix printing of CStr's
authorMark Thom <[email protected]>
Fri, 10 Dec 2021 01:15:52 +0000 (18:15 -0700)
committerMark Thom <[email protected]>
Fri, 7 Jan 2022 04:44:41 +0000 (21:44 -0700)
src/forms.rs
src/heap_print.rs

index 4cda02370a1d306f13c642c92189e293b0ec0f1e..b8042820afb837b5440ea9bfaada884df66d4523 100644 (file)
@@ -833,13 +833,6 @@ impl PredicateSkeleton {
         }
     }
 
-    #[inline]
-    pub(crate) fn reset(&mut self) {
-        self.core.clause_clause_locs.clear();
-        self.core.clause_assert_margin = 0;
-        self.clauses.clear();
-    }
-
     pub(crate) fn target_pos_of_clause_clause_loc(
         &self,
         clause_clause_loc: usize,
index 7a0c2c5db7bb674716bc11bb4b56f50819d00647..9e7e2206647ab6f486e01be90e9a410198bad84e 100644 (file)
@@ -1125,8 +1125,11 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
             return self.push_list(max_depth);
         }
 
+        // let end_h = heap_pstr_iter.focus();
+        // let end_cell = self.iter.heap[end_h];
+
         let end_h = heap_pstr_iter.focus();
-        let end_cell = self.iter.heap[end_h];
+        let end_cell = heap_pstr_iter.focus;
 
         self.remove_list_children(focus);
 
@@ -1142,8 +1145,8 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
         }
 
         if self.ignore_ops {
-            if !self.print_string_as_functor(end_h, max_depth) {
-                if end_cell.get_tag() == HeapCellValueTag::CStr {
+            if !self.print_string_as_functor(focus, max_depth) {
+                if end_cell == empty_list_as_cell!() { // end_cell.get_tag() == HeapCellValueTag::CStr {
                     append_str!(self, "[]");
                 } else {
                     if self.outputter.ends_with(",") {
@@ -1182,21 +1185,19 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
 
             if self.max_depth > 0 && iter.next().is_some() {
                 self.state_stack.push(TokenOrRedirect::Atom(atom!("...")));
+                self.state_stack.push(TokenOrRedirect::HeadTailSeparator);
             } else {
                 if iter.cycle_detected() {
                     self.iter.heap[end_h].set_forwarding_bit(true);
                 }
 
-                if end_cell.get_tag() == HeapCellValueTag::CStr {
-                    self.state_stack.push(TokenOrRedirect::Atom(atom!("[]")));
-                } else {
+                if end_cell != empty_list_as_cell!() {
                     self.state_stack.push(TokenOrRedirect::FunctorRedirect(max_depth));
+                    self.state_stack.push(TokenOrRedirect::HeadTailSeparator);
                     self.iter.push_stack(end_h);
                 }
             }
 
-            self.state_stack.push(TokenOrRedirect::HeadTailSeparator);
-
             if self.outputter.ends_with(",") {
                 self.outputter.truncate(self.outputter.len() - ','.len_utf8());
             }