From 6c66c236fba768c6b3443a0acb56c49f9312230e Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Thu, 9 Dec 2021 18:15:52 -0700 Subject: [PATCH] fix printing of CStr's --- src/forms.rs | 7 ------- src/heap_print.rs | 17 +++++++++-------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/forms.rs b/src/forms.rs index 4cda0237..b8042820 100644 --- a/src/forms.rs +++ b/src/forms.rs @@ -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, diff --git a/src/heap_print.rs b/src/heap_print.rs index 7a0c2c5d..9e7e2206 100644 --- a/src/heap_print.rs +++ b/src/heap_print.rs @@ -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()); } -- 2.54.0