Teach the unparser to print floating-point vectors.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 18 Jun 1993 02:45:33 +0000 (02:45 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 18 Jun 1993 02:45:33 +0000 (02:45 +0000)
v7/src/runtime/unpars.scm

index 30f4c9d4f5ef268449f4c32ab488534e5e71a16c..3a42552de3463255ce45dd29bbafcb86fc7926c7 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: unpars.scm,v 14.30 1993/03/07 20:56:23 cph Exp $
+$Id: unpars.scm,v 14.31 1993/06/18 02:45:33 gjr Exp $
 
 Copyright (c) 1988-93 Massachusetts Institute of Technology
 
@@ -637,7 +637,25 @@ MIT in each case. |#
 (define (unparse/flonum flonum)
   (if (= (system-vector-length flonum) (system-vector-length 0.0))
       (unparse/number flonum)
-      (unparse/default flonum)))
+      (unparse/floating-vector flonum)))
+
+(define (unparse/floating-vector v)
+  (let ((length ((ucode-primitive floating-vector-length) v)))
+    (*unparse-with-brackets
+     "floating-vector"
+     v
+     (and (not (zero? length))
+         (lambda ()
+           (let ((limit (if (not *unparser-list-breadth-limit*)
+                            length
+                            (min length *unparser-list-breadth-limit*))))
+             (unparse/flonum ((ucode-primitive floating-vector-ref) v 0))
+             (do ((i 1 (1+ i)))
+                 ((>= i limit))
+               (*unparse-char #\Space)
+               (unparse/flonum ((ucode-primitive floating-vector-ref) v i)))
+             (if (< limit length)
+                 (*unparse-string " ..."))))))))
 
 (define (unparse/future future)
   (*unparse-with-brackets 'FUTURE false