Initial revision
[sbcl.git] / src / code / lisp-stream.lisp
1 ;;;; the STREAM structure
2
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
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.
11
12 (in-package "SB!IMPL")
13
14 (file-comment
15   "$Header$")
16
17 (eval-when (:compile-toplevel :load-toplevel :execute)
18   (defconstant in-buffer-length 512 "the size of a stream in-buffer"))
19
20 (deftype in-buffer-type ()
21   `(simple-array (unsigned-byte 8) (,in-buffer-length)))
22
23 (defstruct (lisp-stream (:constructor nil))
24   ;; Buffered input.
25   (in-buffer nil :type (or in-buffer-type null))
26   (in-index in-buffer-length :type index)       ; index into IN-BUFFER
27   (in #'ill-in :type function)                  ; READ-CHAR function
28   (bin #'ill-bin :type function)                ; byte input function
29   (n-bin #'ill-bin :type function)              ; n-byte input function
30   (out #'ill-out :type function)                ; WRITE-CHAR function
31   (bout #'ill-bout :type function)              ; byte output function
32   (sout #'ill-out :type function)               ; string output function
33   (misc #'do-nothing :type function))           ; less-used methods
34 (def!method print-object ((x lisp-stream) stream)
35   (print-unreadable-object (x stream :type t :identity t)))