Raymond Toy pushed to branch master at cmucl / cmucl

Commits:

3 changed files:

Changes:

  • src/i18n/locale/cmucl.pot
    ... ... @@ -21155,6 +21155,13 @@ msgid ""
    21155 21155
     "  which returns CHARACTER."
    
    21156 21156
     msgstr ""
    
    21157 21157
     
    
    21158
    +#: src/pcl/gray-streams.lisp
    
    21159
    +msgid ""
    
    21160
    +"Set the type specifier of the kind of object returned by the\n"
    
    21161
    +"  STREAM. There is no default method as this is optional and only\n"
    
    21162
    +"  needed for bivalent streams."
    
    21163
    +msgstr ""
    
    21164
    +
    
    21158 21165
     #: src/pcl/gray-streams.lisp
    
    21159 21166
     msgid ""
    
    21160 21167
     "Return true if Stream is not closed.  A default method is provided\n"
    
    ... ... @@ -21169,6 +21176,17 @@ msgid ""
    21169 21176
     "  to clean up the side effects of having created the stream."
    
    21170 21177
     msgstr ""
    
    21171 21178
     
    
    21179
    +#: src/pcl/gray-streams.lisp
    
    21180
    +msgid "Convert pathspec (a pathname, string or stream) into a pathname."
    
    21181
    +msgstr ""
    
    21182
    +
    
    21183
    +#: src/pcl/gray-streams.lisp
    
    21184
    +msgid ""
    
    21185
    +"Return the pathname for the actual file described by the filespec.\n"
    
    21186
    +"  An error of type file-error is signalled if no such file exists,\n"
    
    21187
    +"  or the pathname is wild."
    
    21188
    +msgstr ""
    
    21189
    +
    
    21172 21190
     #: src/pcl/gray-streams.lisp
    
    21173 21191
     msgid ""
    
    21174 21192
     "This reads one character from the stream.  It returns either a\n"
    

  • src/pcl/gray-streams-class.lisp
    ... ... @@ -21,7 +21,9 @@
    21 21
     ;;; Bootstrap the fundamental-stream class.
    
    22 22
     (let ((pcl::*pcl-class-boot* 'fundamental-stream))
    
    23 23
       (defclass fundamental-stream (standard-object stream)
    
    24
    -    ()
    
    24
    +    ((open-p
    
    25
    +      :initform t
    
    26
    +      :accessor stream-open-p))
    
    25 27
         (:documentation "Base class for all CLOS streams")))
    
    26 28
     
    
    27 29
     ;;; Define the stream classes.
    

  • src/pcl/gray-streams.lisp
    ... ... @@ -26,6 +26,12 @@
    26 26
       Stream. Class FUNDAMENTAL-CHARACTER-STREAM provides a default method
    
    27 27
       which returns CHARACTER."))
    
    28 28
     
    
    29
    +(defgeneric (setf stream-element-type) (new-value stream)
    
    30
    +  (:documentation
    
    31
    +   _N"Set the type specifier of the kind of object returned by the
    
    32
    +  STREAM. There is no default method as this is optional and only
    
    33
    +  needed for bivalent streams."))
    
    34
    +
    
    29 35
     (defmethod stream-element-type ((stream lisp-stream))
    
    30 36
       (funcall (lisp-stream-misc stream) stream :element-type))
    
    31 37
     
    
    ... ... @@ -48,7 +54,7 @@
    48 54
       (not (eq (lisp-stream-in stream) #'closed-flame)))
    
    49 55
     
    
    50 56
     (defmethod pcl-open-stream-p ((stream fundamental-stream))
    
    51
    -  nil)
    
    57
    +  (stream-open-p stream))
    
    52 58
     
    
    53 59
     (when (find-class 'stream:simple-stream nil)
    
    54 60
       (defmethod pcl-open-stream-p ((stream stream:simple-stream))
    
    ... ... @@ -71,6 +77,11 @@
    71 77
         (funcall (lisp-stream-misc stream) stream :close abort))
    
    72 78
       t)
    
    73 79
     
    
    80
    +(defmethod pcl-close ((stream fundamental-stream) &key abort)
    
    81
    +  (declare (ignore abort))
    
    82
    +  (setf (stream-open-p stream) nil)
    
    83
    +  t)
    
    84
    +
    
    74 85
     (when (find-class 'stream:simple-stream nil)
    
    75 86
       (defmethod pcl-close ((stream stream:simple-stream) &key abort)
    
    76 87
         (stream:device-close stream abort)))
    
    ... ... @@ -85,6 +96,10 @@
    85 96
     (defgeneric input-stream-p (stream)
    
    86 97
       (:documentation _N"Returns non-nil if the given Stream can perform input operations."))
    
    87 98
     
    
    99
    +(defmethod input-stream-p (stream)
    
    100
    +  (declare (ignore stream))
    
    101
    +  nil)
    
    102
    +
    
    88 103
     (defmethod input-stream-p ((stream lisp-stream))
    
    89 104
       (and (not (eq (lisp-stream-in stream) #'closed-flame))
    
    90 105
            (or (not (eq (lisp-stream-in stream) #'ill-in))
    
    ... ... @@ -105,6 +120,10 @@
    105 120
     (defgeneric output-stream-p (stream)
    
    106 121
       (:documentation _N"Returns non-nil if the given Stream can perform output operations."))
    
    107 122
     
    
    123
    +(defmethod output-stream-p (stream)
    
    124
    +  (declare (ignore stream))
    
    125
    +  nil)
    
    126
    +
    
    108 127
     (defmethod output-stream-p ((stream lisp-stream))
    
    109 128
       (and (not (eq (lisp-stream-in stream) #'closed-flame))
    
    110 129
            (or (not (eq (lisp-stream-out stream) #'ill-out))
    
    ... ... @@ -117,6 +136,30 @@
    117 136
       (defmethod output-stream-p ((stream stream:simple-stream))
    
    118 137
         (stream::%output-stream-p stream)))
    
    119 138
     
    
    139
    +
    
    140
    +
    
    141
    +(defgeneric pcl-pathname (pathspec)
    
    142
    +  (:documentation _N"Convert pathspec (a pathname, string or stream) into a pathname."))
    
    143
    +
    
    144
    +(let ((func #'pathname))
    
    145
    +  (defmethod pcl-pathname (pathspec)
    
    146
    +    (funcall func pathspec)))
    
    147
    +
    
    148
    +(setf (fdefinition 'pathname) #'pcl-pathname)
    
    149
    +
    
    150
    +
    
    151
    +
    
    152
    +(defgeneric pcl-truename (filespec)
    
    153
    +  (:documentation _N"Return the pathname for the actual file described by the filespec.
    
    154
    +  An error of type file-error is signalled if no such file exists,
    
    155
    +  or the pathname is wild."))
    
    156
    +
    
    157
    +(let ((func #'truename))
    
    158
    +  (defmethod pcl-truename (filespec)
    
    159
    +    (funcall func filespec)))
    
    160
    +
    
    161
    +(setf (fdefinition 'truename) #'pcl-truename)
    
    162
    +
    
    120 163
     
    
    121 164
     ;;; Character input streams.
    
    122 165
     ;;;
    
    ... ... @@ -205,13 +248,43 @@
    205 248
        _N"Implements CLEAR-INPUT for the stream, returning NIL.  The default
    
    206 249
       method does nothing."))
    
    207 250
     
    
    208
    -(defmethod stream-clear-input ((stream fundamental-character-input-stream))
    
    251
    +(defmethod stream-clear-input ((stream fundamental-input-stream))
    
    209 252
       nil)
    
    210 253
     
    
    211 254
     (defgeneric stream-read-sequence (stream seq &optional start end)
    
    212 255
       (:documentation
    
    213 256
        _N"Implements READ-SEQUENCE for the stream."))
    
    214 257
     
    
    258
    +(defmethod stream-read-sequence
    
    259
    +    ((stream fundamental-character-input-stream) sequence &optional start end)
    
    260
    +  (prog ((pos (or start 0))
    
    261
    +         (end (or end (length sequence)))
    
    262
    +         value)
    
    263
    +     (declare (fixnum pos end))
    
    264
    +   next
    
    265
    +     (when (< pos end)
    
    266
    +       (setf value (stream-read-char stream))
    
    267
    +       (unless (eq value :eof)
    
    268
    +         (setf (elt sequence pos) value)
    
    269
    +         (incf pos)
    
    270
    +         (go next)))
    
    271
    +     (return pos)))
    
    272
    +
    
    273
    +(defmethod stream-read-sequence
    
    274
    +    ((stream fundamental-binary-input-stream) sequence &optional start end)
    
    275
    +  (prog ((pos (or start 0))
    
    276
    +         (end (or end (length sequence)))
    
    277
    +         value)
    
    278
    +     (declare (fixnum pos end))
    
    279
    +   next
    
    280
    +     (when (< pos end)
    
    281
    +       (setf value (stream-read-byte stream))
    
    282
    +       (unless (eq value :eof)
    
    283
    +         (setf (elt sequence pos) value)
    
    284
    +         (incf pos)
    
    285
    +         (go next)))
    
    286
    +     (return pos)))
    
    287
    +
    
    215 288
     
    
    216 289
     ;;; Character output streams.
    
    217 290
     ;;;
    
    ... ... @@ -350,6 +423,30 @@
    350 423
       (:documentation
    
    351 424
        _N"Implements WRITE-SEQUENCE for the stream."))
    
    352 425
     
    
    426
    +(defmethod stream-write-sequence
    
    427
    +    ((stream fundamental-character-output-stream) sequence &optional start end)
    
    428
    +  (prog ((pos (or start 0))
    
    429
    +         (end (or end (length sequence))))
    
    430
    +     (declare (fixnum pos end))
    
    431
    +   next
    
    432
    +     (when (< pos end)
    
    433
    +       (stream-write-char stream (elt sequence pos))
    
    434
    +       (incf pos)
    
    435
    +       (go next)))
    
    436
    +  sequence)
    
    437
    +
    
    438
    +(defmethod stream-write-sequence
    
    439
    +    ((stream fundamental-binary-output-stream) sequence &optional start end)
    
    440
    +  (prog ((pos (or start 0))
    
    441
    +         (end (or end (length sequence))))
    
    442
    +     (declare (fixnum pos end))
    
    443
    +   next
    
    444
    +     (when (< pos end)
    
    445
    +       (stream-write-byte stream (elt sequence pos))
    
    446
    +       (incf pos)
    
    447
    +       (go next)))
    
    448
    +  sequence)
    
    449
    +
    
    353 450
     (defgeneric stream-file-position (stream)
    
    354 451
       (:documentation
    
    355 452
        _N"Implements FILE-POSITION for the stream."))