~ chicken-core (chicken-5) a10bf8df7a3bb191d259b1e9df59d586f35b1bf4


commit a10bf8df7a3bb191d259b1e9df59d586f35b1bf4
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sun Sep 25 14:23:11 2011 +0200
Commit:     Christian Kellermann <ckeen@pestilenz.org>
CommitDate: Sun Sep 25 19:33:48 2011 +0200

    pretty printer shows blobs readably
    
    Signed-off-by: Christian Kellermann <ckeen@pestilenz.org>

diff --git a/extras.scm b/extras.scm
index 151ca95a..bb9e4343 100644
--- a/extras.scm
+++ b/extras.scm
@@ -380,11 +380,15 @@
 	       (out (get-output-string o) col) ) )
 	    ((port? obj) (out (string-append "#<port " (##sys#slot obj 3) ">") col))
 	    ((##core#inline "C_bytevectorp" obj)
-	     (if (##core#inline "C_permanentp" obj)
-		 (out "#<static blob of size" col)
-		 (out "#<blob of size " col) )
-	     (out (number->string (##core#inline "C_block_size" obj)) col)
-	     (out ">" col) )
+	     (out "#${" col)
+	     (let ((len (##sys#size obj)))
+	       (do ((i 0 (fx+ i 1)))
+		   ((fx>= i len))
+		 (let ((b (##sys#byte obj i)))
+		   (when (fx< b 16)
+		     (out "0" col))
+		   (out (##sys#number->string b 16) col)))
+	       (out "}" col)))
 	    ((##core#inline "C_lambdainfop" obj)
 	     (out "#<lambda info " col)
 	     (out (##sys#lambda-info->string obj) col)
Trap