Changeset 424
- Timestamp:
- Jan 30, 2004, 11:43:21 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/l1-streams.lisp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-streams.lisp
r384 r424 203 203 t) 204 204 205 (defmethod stream-io-error ((stream stream) error-number context) 206 (error 'simple-stream-error :stream stream 207 :format-control (format nil "~a during ~a" 208 (%strerror error-number) context))) 205 209 206 210 (defmethod instance-initialize :after ((stream input-stream) &key) … … 245 249 (declare (ignore abort)) 246 250 (with-slots ((closed closed)) stream 247 (unless closed248 (setf closed nil))))251 (unless closed 252 (setf closed t)))) 249 253 250 254 … … 822 826 823 827 (defun init-stream-ioblock (stream 824 &key825 insize; integer to allocate inbuf here, nil828 &key 829 insize ; integer to allocate inbuf here, nil 826 830 ; otherwise 827 outsize; integer to allocate outbuf here, nil831 outsize ; integer to allocate outbuf here, nil 828 832 ; otherwise 829 share-buffers-p ; true if input and output833 share-buffers-p ; true if input and output 830 834 ; share a buffer 831 (element-type 'character) 832 device 833 advance-function 834 listen-function 835 eofp-function 836 force-output-function 837 close-function 838 element-shift 839 interactive 840 &allow-other-keys) 835 element-type 836 device 837 advance-function 838 listen-function 839 eofp-function 840 force-output-function 841 close-function 842 element-shift 843 interactive 844 &allow-other-keys) 845 (declare (ignorable element-shift)) 841 846 (let* ((ioblock (or (let* ((ioblock (stream-ioblock stream nil))) 842 (when ioblock843 (setf (ioblock-stream ioblock) stream)844 ioblock))845 (stream-create-ioblock stream))))847 (when ioblock 848 (setf (ioblock-stream ioblock) stream) 849 ioblock)) 850 (stream-create-ioblock stream)))) 846 851 (when insize 847 852 (unless (ioblock-inbuf ioblock) … … 852 857 :bufptr ptr 853 858 :size in-size-in-octets 854 :limit insize)) 855 (setf (ioblock-inbuf-lock ioblock) (make-lock))))) 859 :limit insize)) 860 (setf (ioblock-inbuf-lock ioblock) (make-lock)) 861 (setf (ioblock-element-shift ioblock) (1- (/ in-size-in-octets insize))) 862 ))) 856 863 (if share-buffers-p 857 (if insize858 (progn (setf (ioblock-outbuf ioblock)859 (ioblock-inbuf ioblock))860 (setf (ioblock-outbuf-lock ioblock)861 (ioblock-inbuf-lock ioblock)))862 (error "Can't share buffers unless insize is non-zero and non-null"))864 (if insize 865 (progn (setf (ioblock-outbuf ioblock) 866 (ioblock-inbuf ioblock)) 867 (setf (ioblock-outbuf-lock ioblock) 868 (ioblock-inbuf-lock ioblock))) 869 (error "Can't share buffers unless insize is non-zero and non-null")) 863 870 864 871 (when outsize … … 867 874 (make-heap-buffer element-type outsize) 868 875 (setf (ioblock-outbuf ioblock) 869 (make-io-buffer :buffer buffer 870 :bufptr ptr 871 :count 0 872 :limit outsize 873 :size out-size-in-octets)) 874 (setf (ioblock-outbuf-lock ioblock) (make-lock)))))) 875 (when element-shift 876 (setf (ioblock-element-shift ioblock) element-shift)) 876 (make-io-buffer :buffer buffer 877 :bufptr ptr 878 :count 0 879 :limit outsize 880 :size out-size-in-octets)) 881 (setf (ioblock-outbuf-lock ioblock) (make-lock)) 882 (setf (ioblock-element-shift ioblock) (1- (/ out-size-in-octets outsize))) 883 )))) 884 (when element-type 885 (setf (ioblock-element-type ioblock) element-type)) 886 ; (when element-shift 887 ; (setf (ioblock-element-shift ioblock) element-shift)) 877 888 (when device 878 889 (setf (ioblock-device ioblock) device)) … … 2155 2166 (declare (fixnum n)) 2156 2167 (if (< n 0) 2157 ( error 'simple-stream-error :stream s :format-control (%strerror n))2168 (stream-io-error s (- n) "read") 2158 2169 (if (> n 0) 2159 2170 (setf (io-buffer-count buf) … … 2200 2211 (declare (fixnum written)) 2201 2212 (if (< written 0) 2202 (error 'simple-stream-error 2203 :stream s 2204 :format-control (%strerror written))) 2213 (stream-io-error s (- written) "write")) 2205 2214 (decf octets written) 2206 2215 (unless (zerop octets)
Note:
See TracChangeset
for help on using the changeset viewer.
