/[cmucl]/src/pcl/gray-streams.lisp
ViewVC logotype

Diff of /src/pcl/gray-streams.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13.24.1 by rtoy, Mon Feb 8 17:15:53 2010 UTC revision 1.13.24.2 by rtoy, Sat Feb 13 01:28:04 2010 UTC
# Line 22  Line 22 
22    
23  (defgeneric stream-element-type (stream)  (defgeneric stream-element-type (stream)
24    (:documentation    (:documentation
25     "Returns a type specifier for the kind of object returned by the     _N"Returns a type specifier for the kind of object returned by the
26    Stream. Class FUNDAMENTAL-CHARACTER-STREAM provides a default method    Stream. Class FUNDAMENTAL-CHARACTER-STREAM provides a default method
27    which returns CHARACTER."))    which returns CHARACTER."))
28    
# Line 40  Line 40 
40    
41  (defgeneric pcl-open-stream-p (stream)  (defgeneric pcl-open-stream-p (stream)
42    (:documentation    (:documentation
43     "Return true if Stream is not closed.  A default method is provided     _N"Return true if Stream is not closed.  A default method is provided
44    by class FUNDAMENTAL-STREAM which returns true if CLOSE has not been    by class FUNDAMENTAL-STREAM which returns true if CLOSE has not been
45    called on the stream."))    called on the stream."))
46    
# Line 62  Line 62 
62    
63  (defgeneric pcl-close (stream &key abort)  (defgeneric pcl-close (stream &key abort)
64    (:documentation    (:documentation
65     "Closes the given Stream.  No more I/O may be performed, but     _N"Closes the given Stream.  No more I/O may be performed, but
66    inquiries may still be made.  If :Abort is non-nil, an attempt is made    inquiries may still be made.  If :Abort is non-nil, an attempt is made
67    to clean up the side effects of having created the stream."))    to clean up the side effects of having created the stream."))
68    
# Line 83  Line 83 
83  (fmakunbound 'input-stream-p)  (fmakunbound 'input-stream-p)
84    
85  (defgeneric input-stream-p (stream)  (defgeneric input-stream-p (stream)
86    (:documentation "Returns non-nil if the given Stream can perform input operations."))    (:documentation _N"Returns non-nil if the given Stream can perform input operations."))
87    
88  (defmethod input-stream-p ((stream lisp-stream))  (defmethod input-stream-p ((stream lisp-stream))
89    (and (not (eq (lisp-stream-in stream) #'closed-flame))    (and (not (eq (lisp-stream-in stream) #'closed-flame))
# Line 103  Line 103 
103  (fmakunbound 'output-stream-p)  (fmakunbound 'output-stream-p)
104    
105  (defgeneric output-stream-p (stream)  (defgeneric output-stream-p (stream)
106    (:documentation "Returns non-nil if the given Stream can perform output operations."))    (:documentation _N"Returns non-nil if the given Stream can perform output operations."))
107    
108  (defmethod output-stream-p ((stream lisp-stream))  (defmethod output-stream-p ((stream lisp-stream))
109    (and (not (eq (lisp-stream-in stream) #'closed-flame))    (and (not (eq (lisp-stream-in stream) #'closed-flame))
# Line 126  Line 126 
126    
127  (defgeneric stream-read-char (stream)  (defgeneric stream-read-char (stream)
128    (:documentation    (:documentation
129     "This reads one character from the stream.  It returns either a     _N"This reads one character from the stream.  It returns either a
130    character object, or the symbol :EOF if the stream is at end-of-file.    character object, or the symbol :EOF if the stream is at end-of-file.
131    Every subclass of FUNDAMENTAL-CHARACTER-INPUT-STREAM must define a    Every subclass of FUNDAMENTAL-CHARACTER-INPUT-STREAM must define a
132    method for this function."))    method for this function."))
133    
134  (defgeneric stream-unread-char (stream character)  (defgeneric stream-unread-char (stream character)
135    (:documentation    (:documentation
136     "Un-does the last call to STREAM-READ-CHAR, as in UNREAD-CHAR.     _N"Un-does the last call to STREAM-READ-CHAR, as in UNREAD-CHAR.
137    Returns NIL.  Every subclass of FUNDAMENTAL-CHARACTER-INPUT-STREAM    Returns NIL.  Every subclass of FUNDAMENTAL-CHARACTER-INPUT-STREAM
138    must define a method for this function."))    must define a method for this function."))
139    
140  (defgeneric stream-read-char-no-hang (stream)  (defgeneric stream-read-char-no-hang (stream)
141    (:documentation    (:documentation
142     "This is used to implement READ-CHAR-NO-HANG.  It returns either a     _N"This is used to implement READ-CHAR-NO-HANG.  It returns either a
143    character, or NIL if no input is currently available, or :EOF if    character, or NIL if no input is currently available, or :EOF if
144    end-of-file is reached.  The default method provided by    end-of-file is reached.  The default method provided by
145    FUNDAMENTAL-CHARACTER-INPUT-STREAM simply calls STREAM-READ-CHAR; this    FUNDAMENTAL-CHARACTER-INPUT-STREAM simply calls STREAM-READ-CHAR; this
# Line 151  Line 151 
151    
152  (defgeneric stream-peek-char (stream)  (defgeneric stream-peek-char (stream)
153    (:documentation    (:documentation
154     "Used to implement PEEK-CHAR; this corresponds to peek-type of NIL.     _N"Used to implement PEEK-CHAR; this corresponds to peek-type of NIL.
155    It returns either a character or :EOF.  The default method calls    It returns either a character or :EOF.  The default method calls
156    STREAM-READ-CHAR and STREAM-UNREAD-CHAR."))    STREAM-READ-CHAR and STREAM-UNREAD-CHAR."))
157    
# Line 163  Line 163 
163    
164  (defgeneric stream-listen (stream)  (defgeneric stream-listen (stream)
165    (:documentation    (:documentation
166     "Used by LISTEN.  Returns true or false.  The default method uses     _N"Used by LISTEN.  Returns true or false.  The default method uses
167    STREAM-READ-CHAR-NO-HANG and STREAM-UNREAD-CHAR.  Most streams should    STREAM-READ-CHAR-NO-HANG and STREAM-UNREAD-CHAR.  Most streams should
168    define their own method since it will usually be trivial and will    define their own method since it will usually be trivial and will
169    always be more efficient than the default method."))    always be more efficient than the default method."))
# Line 176  Line 176 
176    
177  (defgeneric stream-read-line (stream)  (defgeneric stream-read-line (stream)
178    (:documentation    (:documentation
179     "Used by READ-LINE.  A string is returned as the first value.  The     _N"Used by READ-LINE.  A string is returned as the first value.  The
180    second value is true if the string was terminated by end-of-file    second value is true if the string was terminated by end-of-file
181    instead of the end of a line.  The default method uses repeated    instead of the end of a line.  The default method uses repeated
182    calls to STREAM-READ-CHAR."))    calls to STREAM-READ-CHAR."))
# Line 202  Line 202 
202    
203  (defgeneric stream-clear-input (stream)  (defgeneric stream-clear-input (stream)
204    (:documentation    (:documentation
205     "Implements CLEAR-INPUT for the stream, returning NIL.  The default     _N"Implements CLEAR-INPUT for the stream, returning NIL.  The default
206    method does nothing."))    method does nothing."))
207    
208  (defmethod stream-clear-input ((stream fundamental-character-input-stream))  (defmethod stream-clear-input ((stream fundamental-character-input-stream))
# Line 210  Line 210 
210    
211  (defgeneric stream-read-sequence (stream seq &optional start end)  (defgeneric stream-read-sequence (stream seq &optional start end)
212    (:documentation    (:documentation
213     "Implements READ-SEQUENCE for the stream."))     _N"Implements READ-SEQUENCE for the stream."))
214    
215    
216  ;;; Character output streams.  ;;; Character output streams.
# Line 221  Line 221 
221    
222  (defgeneric stream-write-char (stream character)  (defgeneric stream-write-char (stream character)
223    (:documentation    (:documentation
224     "Writes character to the stream and returns the character.  Every     _N"Writes character to the stream and returns the character.  Every
225    subclass of FUNDAMENTAL-CHARACTER-OUTPUT-STREAM must have a method    subclass of FUNDAMENTAL-CHARACTER-OUTPUT-STREAM must have a method
226    defined for this function."))    defined for this function."))
227    
228  (defgeneric stream-line-column (stream)  (defgeneric stream-line-column (stream)
229    (:documentation    (:documentation
230     "This function returns the column number where the next character     _N"This function returns the column number where the next character
231    will be written, or NIL if that is not meaningful for this stream.    will be written, or NIL if that is not meaningful for this stream.
232    The first column on a line is numbered 0.  This function is used in    The first column on a line is numbered 0.  This function is used in
233    the implementation of PPRINT and the FORMAT ~T directive.  For every    the implementation of PPRINT and the FORMAT ~T directive.  For every
# Line 237  Line 237 
237    
238  ;;; Stream-line-length is a CMUCL extension to Gray streams.  ;;; Stream-line-length is a CMUCL extension to Gray streams.
239  (defgeneric stream-line-length (stream)  (defgeneric stream-line-length (stream)
240    (:documentation "Return the stream line length or Nil."))    (:documentation _N"Return the stream line length or Nil."))
241    
242  (defmethod stream-line-length ((stream fundamental-character-output-stream))  (defmethod stream-line-length ((stream fundamental-character-output-stream))
243    nil)    nil)
244    
245  (defgeneric stream-start-line-p (stream)  (defgeneric stream-start-line-p (stream)
246    (:documentation    (:documentation
247     "This is a predicate which returns T if the stream is positioned at     _N"This is a predicate which returns T if the stream is positioned at
248    the beginning of a line, else NIL.  It is permissible to always return    the beginning of a line, else NIL.  It is permissible to always return
249    NIL.  This is used in the implementation of FRESH-LINE.  Note that    NIL.  This is used in the implementation of FRESH-LINE.  Note that
250    while a value of 0 from STREAM-LINE-COLUMN also indicates the    while a value of 0 from STREAM-LINE-COLUMN also indicates the
# Line 262  Line 262 
262    
263  (defgeneric stream-write-string (stream string &optional start end)  (defgeneric stream-write-string (stream string &optional start end)
264    (:documentation    (:documentation
265     "This is used by WRITE-STRING.  It writes the string to the stream,     _N"This is used by WRITE-STRING.  It writes the string to the stream,
266    optionally delimited by start and end, which default to 0 and NIL.    optionally delimited by start and end, which default to 0 and NIL.
267    The string argument is returned.  The default method provided by    The string argument is returned.  The default method provided by
268    FUNDAMENTAL-CHARACTER-OUTPUT-STREAM uses repeated calls to    FUNDAMENTAL-CHARACTER-OUTPUT-STREAM uses repeated calls to
# Line 282  Line 282 
282    
283  (defgeneric stream-terpri (stream)  (defgeneric stream-terpri (stream)
284    (:documentation    (:documentation
285     "Writes an end of line, as for TERPRI.  Returns NIL.  The default     _N"Writes an end of line, as for TERPRI.  Returns NIL.  The default
286    method does (STREAM-WRITE-CHAR stream #\NEWLINE)."))    method does (STREAM-WRITE-CHAR stream #\NEWLINE)."))
287    
288  (defmethod stream-terpri ((stream fundamental-character-output-stream))  (defmethod stream-terpri ((stream fundamental-character-output-stream))
# Line 290  Line 290 
290    
291  (defgeneric stream-fresh-line (stream)  (defgeneric stream-fresh-line (stream)
292    (:documentation    (:documentation
293     "Outputs a new line to the Stream if it is not positioned at the     _N"Outputs a new line to the Stream if it is not positioned at the
294    begining of a line.  Returns T if it output a new line, nil    begining of a line.  Returns T if it output a new line, nil
295    otherwise. Used by FRESH-LINE. The default method uses    otherwise. Used by FRESH-LINE. The default method uses
296    STREAM-START-LINE-P and STREAM-TERPRI."))    STREAM-START-LINE-P and STREAM-TERPRI."))
# Line 302  Line 302 
302    
303  (defgeneric stream-finish-output (stream)  (defgeneric stream-finish-output (stream)
304    (:documentation    (:documentation
305     "Attempts to ensure that all output sent to the Stream has reached     _N"Attempts to ensure that all output sent to the Stream has reached
306    its destination, and only then returns false. Implements    its destination, and only then returns false. Implements
307    FINISH-OUTPUT.  The default method does nothing."))    FINISH-OUTPUT.  The default method does nothing."))
308    
# Line 311  Line 311 
311    
312  (defgeneric stream-force-output (stream)  (defgeneric stream-force-output (stream)
313    (:documentation    (:documentation
314     "Attempts to force any buffered output to be sent. Implements     _N"Attempts to force any buffered output to be sent. Implements
315    FORCE-OUTPUT.  The default method does nothing."))    FORCE-OUTPUT.  The default method does nothing."))
316    
317  (defmethod stream-force-output ((stream fundamental-output-stream))  (defmethod stream-force-output ((stream fundamental-output-stream))
# Line 319  Line 319 
319    
320  (defgeneric stream-clear-output (stream)  (defgeneric stream-clear-output (stream)
321    (:documentation    (:documentation
322     "Clears the given output Stream. Implements CLEAR-OUTPUT.  The     _N"Clears the given output Stream. Implements CLEAR-OUTPUT.  The
323    default method does nothing."))    default method does nothing."))
324    
325  (defmethod stream-clear-output ((stream fundamental-output-stream))  (defmethod stream-clear-output ((stream fundamental-output-stream))
# Line 327  Line 327 
327    
328  (defgeneric stream-advance-to-column (stream column)  (defgeneric stream-advance-to-column (stream column)
329    (:documentation    (:documentation
330     "Writes enough blank space so that the next character will be     _N"Writes enough blank space so that the next character will be
331    written at the specified column.  Returns true if the operation is    written at the specified column.  Returns true if the operation is
332    successful, or NIL if it is not supported for this stream.  This is    successful, or NIL if it is not supported for this stream.  This is
333    intended for use by by PPRINT and FORMAT ~T.  The default method uses    intended for use by by PPRINT and FORMAT ~T.  The default method uses
# Line 345  Line 345 
345    
346  (defgeneric stream-write-sequence (stream seq &optional start end)  (defgeneric stream-write-sequence (stream seq &optional start end)
347    (:documentation    (:documentation
348     "Implements WRITE-SEQUENCE for the stream."))     _N"Implements WRITE-SEQUENCE for the stream."))
349    
350    
351  ;;; Binary streams.  ;;; Binary streams.
# Line 358  Line 358 
358    
359  (defgeneric stream-read-byte (stream)  (defgeneric stream-read-byte (stream)
360    (:documentation    (:documentation
361     "Used by READ-BYTE; returns either an integer, or the symbol :EOF     _N"Used by READ-BYTE; returns either an integer, or the symbol :EOF
362    if the stream is at end-of-file."))    if the stream is at end-of-file."))
363    
364  (defgeneric stream-write-byte (stream integer)  (defgeneric stream-write-byte (stream integer)
365    (:documentation    (:documentation
366     "Implements WRITE-BYTE; writes the integer to the stream and     _N"Implements WRITE-BYTE; writes the integer to the stream and
367    returns the integer as the result."))    returns the integer as the result."))
368    
369    
# Line 446  Line 446 
446  (provide :gray-streams)  (provide :gray-streams)
447    
448  (setf (getf *herald-items* :gray-streams)  (setf (getf *herald-items* :gray-streams)
449        '("    Gray Streams Protocol Support"))        `(,#'(lambda (stream)
450                 (write-string _"    Gray Streams Protocol Support" stream))))
451    
452    
453    

Legend:
Removed from v.1.13.24.1  
changed lines
  Added in v.1.13.24.2

  ViewVC Help
Powered by ViewVC 1.1.5