X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fansi-stream.lisp;h=7efbbd106285cb78242138a06b945769656d4a24;hb=9935d377076aacfb8ac397a993bd7eb99c52e4a9;hp=819cd89cb95640b625a26de9eb471aab72778a12;hpb=8eb6f7d3da3960c827b704e23b5a47008274be7d;p=sbcl.git diff --git a/src/code/ansi-stream.lisp b/src/code/ansi-stream.lisp index 819cd89..7efbbd1 100644 --- a/src/code/ansi-stream.lisp +++ b/src/code/ansi-stream.lisp @@ -20,38 +20,38 @@ ;;; considered closed. The functions in the operation slots take ;;; arguments as follows: ;;; -;;; In: Stream, Eof-Errorp, Eof-Value -;;; Bin: Stream, Eof-Errorp, Eof-Value -;;; N-Bin: Stream, Buffer, Start, Numbytes, Eof-Errorp -;;; Out: Stream, Character -;;; Bout: Stream, Integer -;;; Sout: Stream, String, Start, End -;;; Misc: Stream, Operation, &Optional Arg1, Arg2 +;;; In: Stream, Eof-Errorp, Eof-Value +;;; Bin: Stream, Eof-Errorp, Eof-Value +;;; N-Bin: Stream, Buffer, Start, Numbytes, Eof-Errorp +;;; Out: Stream, Character +;;; Bout: Stream, Integer +;;; Sout: Stream, String, Start, End +;;; Misc: Stream, Operation, &Optional Arg1, Arg2 ;;; ;;; In order to save space, some of the less common stream operations ;;; are handled by just one function, the MISC method. This function ;;; is passed a keyword which indicates the operation to perform. ;;; The following keywords are used: -;;; :listen - Return the following values: -;;; t if any input waiting. -;;; :eof if at eof. -;;; nil if no input is available and not at eof. -;;; :unread - Unread the character Arg. -;;; :close - Do any stream specific stuff to close the stream. -;;; The methods are set to closed-flame by the close -;;; function, so that need not be done by this -;;; function. -;;; :clear-input - Clear any unread input +;;; :listen - Return the following values: +;;; t if any input waiting. +;;; :eof if at eof. +;;; nil if no input is available and not at eof. +;;; :unread - Unread the character Arg. +;;; :close - Do any stream specific stuff to close the stream. +;;; The methods are set to closed-flame by the close +;;; function, so that need not be done by this +;;; function. +;;; :clear-input - Clear any unread input ;;; :finish-output, -;;; :force-output - Cause output to happen -;;; :clear-output - Clear any undone output -;;; :element-type - Return the type of element the stream deals with. -;;; :line-length - Return the length of a line of output. -;;; :charpos - Return current output position on the line. -;;; :file-length - Return the file length of a file stream. -;;; :file-position - Return or change the current position of a +;;; :force-output - Cause output to happen +;;; :clear-output - Clear any undone output +;;; :element-type - Return the type of element the stream deals with. +;;; :line-length - Return the length of a line of output. +;;; :charpos - Return current output position on the line. +;;; :file-length - Return the file length of a file stream. +;;; :file-position - Return or change the current position of a ;;; file stream. -;;; :file-name - Return the name of an associated file. +;;; :file-name - Return the name of an associated file. ;;; :interactive-p - Is this an interactive device? ;;; ;;; In order to do almost anything useful, it is necessary to @@ -89,10 +89,13 @@ (deftype ansi-stream-in-buffer () `(simple-array (unsigned-byte 8) (,+ansi-stream-in-buffer-length+))) +(deftype ansi-stream-cin-buffer () + `(simple-array character (,+ansi-stream-in-buffer-length+))) + ;;; base class for ANSI standard streams (as opposed to the Gray ;;; streams extension) (defstruct (ansi-stream (:constructor nil) - (:copier nil)) + (:copier nil)) ;; input buffer ;; @@ -100,20 +103,21 @@ ;; slot must must be NIL, and the IN-INDEX must be ;; +ANSI-STREAM-IN-BUFFER-LENGTH+.) (in-buffer nil :type (or ansi-stream-in-buffer null)) + (cin-buffer nil :type (or ansi-stream-cin-buffer null)) (in-index +ansi-stream-in-buffer-length+ :type index) ;; buffered input functions - (in #'ill-in :type function) ; READ-CHAR function - (bin #'ill-bin :type function) ; byte input function - (n-bin #'ill-bin :type function) ; n-byte input function + (in #'ill-in :type function) ; READ-CHAR function + (bin #'ill-bin :type function) ; byte input function + (n-bin #'ill-bin :type function) ; n-byte input function ;; output functions - (out #'ill-out :type function) ; WRITE-CHAR function - (bout #'ill-bout :type function) ; byte output function - (sout #'ill-out :type function) ; string output function + (out #'ill-out :type function) ; WRITE-CHAR function + (bout #'ill-bout :type function) ; byte output function + (sout #'ill-out :type function) ; string output function ;; other, less-used methods - (misc #'do-nothing :type function)) + (misc #'no-op-placeholder :type function)) (def!method print-object ((x ansi-stream) stream) (print-unreadable-object (x stream :type t :identity t)))