/[cmucl]/src/code/fd-stream.lisp
ViewVC logotype

Diff of /src/code/fd-stream.lisp

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

revision 1.91.2.1 by rtoy, Sat Sep 19 14:44:52 2009 UTC revision 1.91.2.1.2.2 by rtoy, Fri Sep 25 04:14:36 2009 UTC
# Line 41  Line 41 
41    "List of available buffers.  Each buffer is an sap pointing to    "List of available buffers.  Each buffer is an sap pointing to
42    bytes-per-buffer of memory.")    bytes-per-buffer of memory.")
43    
44    (defvar lisp::*enable-stream-buffer-p* nil)
45    
46  (defconstant bytes-per-buffer (* 4 1024)  (defconstant bytes-per-buffer (* 4 1024)
47    "Number of bytes per buffer.")    "Number of bytes per buffer.")
48    
# Line 1379  Line 1381 
1381                        (or (eq 'unsigned-byte (and (consp type) (car type)))                        (or (eq 'unsigned-byte (and (consp type) (car type)))
1382                            (eq type :default))                            (eq type :default))
1383                        ;; Character streams with :iso8859-1                        ;; Character streams with :iso8859-1
1384                        (and (eq type 'character)                        (and (eq type 'character))))
                            #+unicode  
                            (eql :iso8859-1 (fd-stream-external-format stream)))))  
1385              ;; We only create this buffer for streams of type              ;; We only create this buffer for streams of type
1386              ;; (unsigned-byte 8) or character streams with an external              ;; (unsigned-byte 8) or character streams with an external
1387              ;; format of :iso8859-1.  Because there's no buffer, the              ;; format of :iso8859-1.  Because there's no buffer, the
1388              ;; other element-types will dispatch to the appropriate              ;; other element-types will dispatch to the appropriate
1389              ;; input (output) routine in fast-read-byte/fast-read-char.              ;; input (output) routine in fast-read-byte/fast-read-char.
1390              #+nil              (when *enable-stream-buffer-p*
1391              (setf (lisp-stream-in-buffer stream)                (setf (lisp-stream-in-buffer stream)
1392                    (make-array in-buffer-length                      (make-array in-buffer-length
1393                                :element-type '(unsigned-byte 8)))))                                  :element-type '(unsigned-byte 8))))
1394                (when (and *enable-stream-buffer-p*
1395                           (eq type 'character))
1396                  ;; For character streams, we create the string-buffer
1397                  ;; and indices so we can have fast character streams.
1398                  ;; Also with character streams, the in-buffer index is
1399                  ;; handled differently, so we need to initialize it.
1400                  (setf (lisp-stream-string-buffer stream)
1401                        (make-string (1+ in-buffer-length)))
1402                  (setf (lisp-stream-string-buffer-len stream) 0)
1403                  (setf (lisp-stream-string-index stream) 0))))
1404          (setf input-size size)          (setf input-size size)
1405          (setf input-type type)))          (setf input-type type)))
1406    
# Line 1497  Line 1507 
1507       #-unicode       #-unicode
1508       (setf (fd-stream-unread stream) arg1)       (setf (fd-stream-unread stream) arg1)
1509       #+unicode       #+unicode
1510       (if (zerop (fd-stream-last-char-read-size stream))       (cond ((lisp-stream-string-buffer stream)
1511           (setf (fd-stream-unread stream) arg1)              (if (zerop (lisp-stream-string-index stream))
1512           (decf (fd-stream-ibuf-head stream)                  (setf (fd-stream-unread stream) arg1)
1513                 (fd-stream-last-char-read-size stream)))                  (decf (lisp-stream-string-index stream))))
1514               (t
1515                (if (zerop (fd-stream-last-char-read-size stream))
1516                    (setf (fd-stream-unread stream) arg1)
1517                    (decf (fd-stream-ibuf-head stream)
1518                          (fd-stream-last-char-read-size stream)))))
1519       ;; Paul says:       ;; Paul says:
1520       ;;       ;;
1521       ;; Not needed for unicode when unreading is implemented by backing up in       ;; Not needed for unicode when unreading is implemented by backing up in

Legend:
Removed from v.1.91.2.1  
changed lines
  Added in v.1.91.2.1.2.2

  ViewVC Help
Powered by ViewVC 1.1.5