From bd3ca4d05f17c009c6a202330a20af920548d9b0 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 7 Oct 2019 00:34:47 -0400 Subject: [PATCH] Change debug printer to print vectors correctly. --- src/microcode/debug.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/microcode/debug.c b/src/microcode/debug.c index 0d22b2865..5ce4353aa 100644 --- a/src/microcode/debug.c +++ b/src/microcode/debug.c @@ -162,6 +162,20 @@ print_list (outf_channel stream, SCHEME_OBJECT pair) outf (stream, ")"); } +static void +print_vector (outf_channel stream, SCHEME_OBJECT vector) +{ + outf (stream, "#("); + unsigned long end = (VECTOR_LENGTH (vector)); + for (unsigned long i = 0; i < end; i++) + { + if (i > 0) + outf (stream, " "); + print_object (stream, (VECTOR_REF (vector, i))); + } + outf (stream, ")"); +} + static void print_return_name (outf_channel stream, SCHEME_OBJECT Ptr) { @@ -363,18 +377,6 @@ print_objects (SCHEME_OBJECT * objects, int n) } outf_flush_error(); } - -/* This is useful because `print_object' doesn't print the contents of - vectors. The reason that it doesn't is because vectors are used to - represent named structures, and most named structures don't want to - be printed out explicitly. */ - -void -Print_Vector (SCHEME_OBJECT vector) -{ - print_objects - ((MEMORY_LOC (vector, 1)), (OBJECT_DATUM (VECTOR_LENGTH (vector)))); -} static void print_expression (outf_channel stream, @@ -528,6 +530,10 @@ print_object (outf_channel stream, SCHEME_OBJECT obj) print_list (stream, obj); return; + case TC_VECTOR: + print_vector (stream, obj); + return; + case TC_FALSE: print_simple (stream, obj); return; -- 2.25.1