/[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.4 by rtoy, Fri Sep 25 18:13:11 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                           (not (eq :iso8859-1 (fd-stream-external-format stream))))
1397                  ;; For character streams, we create the string-buffer so
1398                  ;; we can convert all available octets at once instead
1399                  ;; of for each character.  The string is one element
1400                  ;; longer than in-buffer-length to leave room for
1401                  ;; unreading.
1402                  ;;
1403                  ;; For ISO8859-1, we don't want this because it's very
1404                  ;; easy and quick to convert octets to iso8859-1.  (See
1405                  ;; FAST-READ-CHAR.)
1406                  (setf (lisp-stream-string-buffer stream)
1407                        (make-string (1+ in-buffer-length)))
1408                  (setf (lisp-stream-string-buffer-len stream) 0)
1409                  (setf (lisp-stream-string-index stream) 0))))
1410          (setf input-size size)          (setf input-size size)
1411          (setf input-type type)))          (setf input-type type)))
1412    
# Line 1497  Line 1513 
1513       #-unicode       #-unicode
1514       (setf (fd-stream-unread stream) arg1)       (setf (fd-stream-unread stream) arg1)
1515       #+unicode       #+unicode
1516       (if (zerop (fd-stream-last-char-read-size stream))       (cond ((lisp-stream-string-buffer stream)
1517           (setf (fd-stream-unread stream) arg1)              (if (zerop (lisp-stream-string-index stream))
1518           (decf (fd-stream-ibuf-head stream)                  (setf (fd-stream-unread stream) arg1)
1519                 (fd-stream-last-char-read-size stream)))                  (decf (lisp-stream-string-index stream))))
1520               (t
1521                (if (zerop (fd-stream-last-char-read-size stream))
1522                    (setf (fd-stream-unread stream) arg1)
1523                    (decf (fd-stream-ibuf-head stream)
1524                          (fd-stream-last-char-read-size stream)))))
1525       ;; Paul says:       ;; Paul says:
1526       ;;       ;;
1527       ;; 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.4

  ViewVC Help
Powered by ViewVC 1.1.5