Ignore:
Timestamp:
May 13, 2008, 1:56:14 PM (13 years ago)
Author:
gz
Message:

Compiler macros for write-string -> write-simple-string, and some common cases of format.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-1/l1-io.lisp

    r9408 r9464  
    9393        (stream-write-string stream string start end)))
    9494  string))
     95
     96(defun write-simple-string (string output-stream start end)
     97  "Write the characters of the subsequence of simple-string STRING bounded by START
     98and END to OUTPUT-STREAM."
     99  (let* ((stream (%real-print-stream output-stream))
     100         (string (the simple-string string))) ;; typecheck at high safety.
     101    (if (typep stream 'basic-stream)
     102      (let* ((ioblock (basic-stream-ioblock stream))
     103             (start (or start 0)))
     104        (with-ioblock-output-locked (ioblock)
     105          (if (and (eq start 0) (null end))
     106            (funcall (ioblock-write-simple-string-function ioblock)
     107                     ioblock string 0 (length string))
     108            (let* ((end (check-sequence-bounds string start end)))
     109              (funcall (ioblock-write-simple-string-function ioblock)
     110                       ioblock string start  (%i- end start))))))
     111      (if (and (not start) (not end))
     112        (stream-write-string stream string)
     113        (stream-write-string stream string start end)))
     114    string))
    95115
    96116(defun write-line (string &optional output-stream
Note: See TracChangeset for help on using the changeset viewer.