From de53cf2f3ec0f4b8cebb4ce5afead577402cec76 Mon Sep 17 00:00:00 2001 From: toy <toy> Date: Mon, 6 Jan 2003 22:27:16 +0000 Subject: [PATCH] o Was not properly printing out, readably, zero-dimensional arrays like (make-array '(0 0 0)). o Read wasn't reading in things like #3a() properly Bugs noted by Paul Dietz. Fixes from Gerd Moellmann. --- code/pprint.lisp | 4 ++-- code/print.lisp | 5 ++--- code/sharpm.lisp | 26 ++++++++++++++------------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/code/pprint.lisp b/code/pprint.lisp index 2dfd1f8c6..8612ec1d4 100644 --- a/code/pprint.lisp +++ b/code/pprint.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/pprint.lisp,v 1.32 2002/10/07 14:31:05 toy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/pprint.lisp,v 1.33 2003/01/06 22:27:16 toy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1119,7 +1119,7 @@ (stringp array) (bit-vector-p array)) (output-ugly-object array stream)) - ((and *print-readably* (not (eq (array-element-type array) 't))) + (*print-readably* (pprint-raw-array stream array)) ((vectorp array) (pprint-vector stream array)) diff --git a/code/print.lisp b/code/print.lisp index be53b3020..de3b73d67 100644 --- a/code/print.lisp +++ b/code/print.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/print.lisp,v 1.83 2002/10/07 14:31:05 toy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/print.lisp,v 1.84 2003/01/06 22:27:16 toy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1078,8 +1078,7 @@ (defun output-array-guts (array stream) (with-array-data ((data array) (start) (end)) (declare (ignore end)) - (cond ((and *print-readably* - (not (eq (array-element-type array) t))) + (cond (*print-readably* (write-string "#A(" stream) (output-object (array-element-type array) stream) (write-char #\Space) diff --git a/code/sharpm.lisp b/code/sharpm.lisp index b9255ad67..6b7fed140 100644 --- a/code/sharpm.lisp +++ b/code/sharpm.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/sharpm.lisp,v 1.22 2001/03/04 20:12:42 pw Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/sharpm.lisp,v 1.23 2003/01/06 22:27:16 toy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -175,9 +175,9 @@ (cond (dimensions (collect ((dims)) (let* ((contents (read stream t nil t)) - (seq contents)) - (dotimes (axis dimensions - (make-array (dims) :initial-contents contents)) + (seq contents) + (zero-axis nil)) + (dotimes (axis dimensions) (unless (typep seq 'sequence) (%reader-error stream "#~DA axis ~D is not a sequence:~% ~S" @@ -185,19 +185,21 @@ (let ((len (length seq))) (dims len) (unless (= axis (1- dimensions)) - (when (zerop len) - (%reader-error stream - "#~DA axis ~D is empty, but is not ~ - the last dimension." - dimensions axis)) - (setq seq (elt seq 0)))))))) + (cond ((zerop len) + (setq zero-axis axis)) + (zero-axis + (%reader-error stream + "#~DA axis ~D is empty, but axis ~ + ~D is non-empty." + dimensions zero-axis axis)) + (t + (setq seq (elt seq 0))))))) + (make-array (dims) :initial-contents contents)))) (t (destructuring-bind (element-type dims contents) (read stream t nil t) (make-array dims :element-type element-type :initial-contents contents))))) - - (defun sharp-S (stream sub-char numarg) (ignore-numarg sub-char numarg) -- GitLab