From 1a766c112ce3f39ada74112eee5d8e0e7a0c2649 Mon Sep 17 00:00:00 2001
From: moore <moore>
Date: Thu, 12 Dec 2002 19:09:46 +0000
Subject: [PATCH] Fix a typo in apply-with-bindings.

Add string-stream and file-stream, required by the ANSI spec, as
structure classes.  Make the string streams and fd-stream,
respectively, inherit from them.  Add bootstrap magic.
---
 bootfiles/18d/boot5.lisp | 64 ++++++++++++++++++++++++++++++++++++++++
 code/fd-stream.lisp      | 11 +++++--
 code/multi-proc.lisp     |  5 ++--
 code/stream.lisp         | 16 +++++++---
 4 files changed, 88 insertions(+), 8 deletions(-)
 create mode 100644 bootfiles/18d/boot5.lisp

diff --git a/bootfiles/18d/boot5.lisp b/bootfiles/18d/boot5.lisp
new file mode 100644
index 000000000..a82608fad
--- /dev/null
+++ b/bootfiles/18d/boot5.lisp
@@ -0,0 +1,64 @@
+;;; Add a new superclass, required by the ANSI Spec, to fd-stream
+;;; without causing a blowup in genesis.
+
+(in-package "LISP")
+
+(defstruct (file-stream
+	     (:include lisp-stream)
+	     (:constructor nil)
+	     (:copier nil)))
+
+(handler-bind ((error #'(lambda (c)
+			  (declare (ignore c))
+			  (invoke-restart 'kernel::clobber-it))))
+  (defstruct (fd-stream
+	       (:print-function %print-fd-stream)
+	       (:constructor %make-fd-stream)
+	       (:include file-stream
+			 (misc #'fd-stream-misc-routine)))
+
+    (name nil)				; The name of this stream
+    (file nil)				; The file this stream is for
+    ;;
+    ;; The backup file namestring for the old file, for :if-exists :rename or
+    ;; :rename-and-delete.
+    (original nil :type (or simple-string null))
+    (delete-original nil)		; for :if-exists :rename-and-delete
+    ;;
+    ;; Number of bytes per element.
+    (element-size 1 :type index)
+    (element-type 'base-char)		; The type of element being transfered.
+    (fd -1 :type fixnum)		; The file descriptor
+    ;;
+    ;; Controls when the output buffer is flushed.
+    (buffering :full :type (member :full :line :none))
+    ;;
+    ;; Character position if known.
+    (char-pos nil :type (or index null))
+    ;;
+    ;; T if input is waiting on FD.  :EOF if we hit EOF.
+    (listen nil :type (member nil t :eof))
+    ;;
+    ;; The input buffer.
+    (unread nil)
+    (ibuf-sap nil :type (or system-area-pointer null))
+    (ibuf-length nil :type (or index null))
+    (ibuf-head 0 :type index)
+    (ibuf-tail 0 :type index)
+
+    ;; The output buffer.
+    (obuf-sap nil :type (or system-area-pointer null))
+    (obuf-length nil :type (or index null))
+    (obuf-tail 0 :type index)
+
+    ;; Output flushed, but not written due to non-blocking io.
+    (output-later nil)
+    (handler nil)
+    ;;
+    ;; Timeout specified for this stream, or NIL if none.
+    (timeout nil :type (or index null))
+    ;;
+    ;; Pathname of the file this stream is opened to (returned by PATHNAME.)
+    (pathname nil :type (or pathname null))))
+
+
diff --git a/code/fd-stream.lisp b/code/fd-stream.lisp
index 73f040a03..d6b7d849b 100644
--- a/code/fd-stream.lisp
+++ b/code/fd-stream.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/fd-stream.lisp,v 1.61 2002/08/23 18:31:05 pmai Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.62 2002/12/12 19:09:45 moore Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -32,6 +32,7 @@
 (in-package "LISP")
 
 (export '(file-stream file-string-length stream-external-format))
+#+nil
 (deftype file-stream () 'fd-stream)
 
 
@@ -58,10 +59,16 @@
 
 ;;;; The FD-STREAM structure.
 
+;;;; Superclass defined by the ANSI Spec
+(defstruct (file-stream
+	     (:include lisp-stream)
+	     (:constructor nil)
+	     (:copier nil)))
+
 (defstruct (fd-stream
 	    (:print-function %print-fd-stream)
 	    (:constructor %make-fd-stream)
-	    (:include lisp-stream
+	    (:include file-stream
 		      (misc #'fd-stream-misc-routine)))
 
   (name nil)		      ; The name of this stream
diff --git a/code/multi-proc.lisp b/code/multi-proc.lisp
index 28912f555..4b8c6a072 100644
--- a/code/multi-proc.lisp
+++ b/code/multi-proc.lisp
@@ -5,7 +5,7 @@
 ;;; the Public domain, and is provided 'as is'.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/multi-proc.lisp,v 1.40 2002/02/20 06:40:01 moore Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/multi-proc.lisp,v 1.41 2002/12/12 19:09:45 moore Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -878,7 +878,8 @@
       (progv
 	  (mapcar #'car bindings)
 	  (mapcar #'(lambda (binding)
-		      (eval (cdr binding))))
+		      (eval (cdr binding)))
+		  bindings)
 	(apply function args))
       (apply function args)))
 
diff --git a/code/stream.lisp b/code/stream.lisp
index c86430d0c..ade6c19ce 100644
--- a/code/stream.lisp
+++ b/code/stream.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/stream.lisp,v 1.56 2002/11/19 14:30:57 toy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/stream.lisp,v 1.57 2002/12/12 19:09:46 moore Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -47,6 +47,7 @@
 
 (in-package "LISP")
 
+#+nil
 (deftype string-stream ()
   '(or string-input-stream string-output-stream
        fill-pointer-output-stream))
@@ -1168,10 +1169,17 @@ output to Output-stream"
    sends its output to Output-Stream.  In addition, all input is echoed to
    the output stream")
 
+;;;; Superclass of all string streams
+
+(defstruct (string-stream
+	     (:include lisp-stream)
+	     (:constructor nil)
+	     (:copier nil)))
+
 ;;;; String Input Streams:
 
 (defstruct (string-input-stream
-	     (:include lisp-stream
+	     (:include string-stream
 		       (in #'string-inch)
 		       (bin #'string-binch)
 		       (n-bin #'string-stream-read-n-bytes)
@@ -1260,7 +1268,7 @@ output to Output-stream"
 ;;;; String Output Streams:
 
 (defstruct (string-output-stream
-	    (:include lisp-stream
+	    (:include string-stream
 		      (out #'string-ouch)
 		      (sout #'string-sout)
 		      (misc #'string-out-misc))
@@ -1352,7 +1360,7 @@ output to Output-stream"
 ;;; the CLM, but they are required for the implementation of With-Output-To-String.
 
 (defstruct (fill-pointer-output-stream
- 	    (:include lisp-stream
+ 	    (:include string-stream
 		      (out #'fill-pointer-ouch)
 		      (sout #'fill-pointer-sout)
 		      (misc #'fill-pointer-misc))
-- 
GitLab