1 ;;;; the STREAM structure
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB!IMPL")
14 ;;; the size of a stream in-buffer
16 ;;; KLUDGE: The EVAL-WHEN wrapper isn't needed except when using CMU
17 ;;; CL as a cross-compilation host. Without it, cmucl-2.4.19 issues
18 ;;; full WARNINGs (not just STYLE-WARNINGs!) when processing this
19 ;;; file, and when processing other files which use LISP-STREAM.
21 (eval-when (:compile-toplevel :load-toplevel :execute)
22 (defconstant +in-buffer-length+ 512))
24 (deftype in-buffer-type ()
25 `(simple-array (unsigned-byte 8) (,+in-buffer-length+)))
27 (defstruct (lisp-stream (:constructor nil)
30 (in-buffer nil :type (or in-buffer-type null))
31 (in-index +in-buffer-length+ :type index) ; index into IN-BUFFER
32 (in #'ill-in :type function) ; READ-CHAR function
33 (bin #'ill-bin :type function) ; byte input function
34 (n-bin #'ill-bin :type function) ; n-byte input function
35 (out #'ill-out :type function) ; WRITE-CHAR function
36 (bout #'ill-bout :type function) ; byte output function
37 (sout #'ill-out :type function) ; string output function
38 (misc #'do-nothing :type function)) ; less-used methods
39 (def!method print-object ((x lisp-stream) stream)
40 (print-unreadable-object (x stream :type t :identity t)))