Changeset 5406
- Timestamp:
- Oct 23, 2006, 4:40:30 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/l1-streams.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-streams.lisp
r5398 r5406 4188 4188 (defun string-output-stream-ioblock-write-simple-string (ioblock string start-char num-chars) 4189 4189 (declare (simple-string string) 4190 (fixnum start-char num-chars)) 4190 (fixnum start-char num-chars) 4191 (optimize (speed 3) (safety 0))) 4191 4192 (let* ((out (string-output-stream-ioblock-string ioblock)) 4192 4193 (index (string-output-stream-ioblock-index ioblock)) … … 4198 4199 (let* ((newlen (+ need need)) 4199 4200 (new (make-string newlen))) 4200 (declare (fixnum newlen)) 4201 (%copy-ivector-to-ivector out 0 new 0 (the fixnum (ash len 2))) 4201 (declare (fixnum newlen) (simple-string new)) 4202 (dotimes (i len) 4203 (setf (schar new i) (schar out i))) 4202 4204 (setq out new) 4203 4205 (setf (string-output-stream-ioblock-string ioblock) new))) 4204 (%copy-ivector-to-ivector string 4205 (the fixnum (ash start-char 2)) 4206 out 4207 (the fixnum (ash index 2)) 4208 (the fixnum (ash num-chars 2))) 4209 (setf (string-output-stream-ioblock-index ioblock) need) 4210 (let* ((end (+ start-char num-chars)) 4211 (nlpos (position #\newline string :start start-char :end end :from-end t))) 4212 (declare (fixnum end)) 4213 (if nlpos 4214 (setf (ioblock-charpos ioblock) (the fixnum (- end (the fixnum nlpos)))) 4215 (incf (ioblock-charpos ioblock) num-chars))) 4216 num-chars)) 4206 (do* ((src start-char (1+ src)) 4207 (dest index (1+ dest)) 4208 (nlpos nil) 4209 (end (+ start-char num-chars))) 4210 ((= src end) 4211 (setf (string-output-stream-ioblock-index ioblock) need) 4212 (if nlpos 4213 (setf (ioblock-charpos ioblock) (the fixnum (- end (the fixnum nlpos)))) 4214 (incf (ioblock-charpos ioblock) num-chars)) 4215 num-chars) 4216 (let* ((char (schar string src))) 4217 (if (eql char #\Newline) 4218 (setq nlpos src)) 4219 (setf (schar out dest) char))))) 4220 4217 4221 4218 4222 (defmethod stream-position ((stream string-output-stream) &optional newpos) … … 5352 5356 5353 5357 5354 (defresource *string-output-stream-pool* 5355 :constructor (make-string-output-stream) 5356 :initializer 'stream-clear-output) 5358 5357 5359 5358 5360 ;;;File streams.
Note:
See TracChangeset
for help on using the changeset viewer.
