/[cmucl]/src/code/macros.lisp
ViewVC logotype

Diff of /src/code/macros.lisp

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

revision 1.51 by dtc, Wed Sep 3 20:27:08 1997 UTC revision 1.52 by pw, Sat Sep 13 20:28:10 1997 UTC
# Line 1391  Line 1391 
1391  (defmacro with-input-from-string ((var string &key index start end) &body (forms decls))  (defmacro with-input-from-string ((var string &key index start end) &body (forms decls))
1392    "Binds the Var to an input stream that returns characters from String and    "Binds the Var to an input stream that returns characters from String and
1393    executes the body.  See manual for details."    executes the body.  See manual for details."
1394    `(let ((,var    ;; The once-only inhibits compiler note for unreachable code when 'end' is true.
1395            ,(cond ((null end)    (once-only ((string string))
1396                    `(make-string-input-stream ,string ,(or start 0)))      `(let ((,var
1397                   ((symbolp end)              ,(cond ((null end)
1398                    `(if ,end                      `(make-string-input-stream ,string ,(or start 0)))
1399                         (make-string-input-stream ,string ,(or start 0) ,end)                     ((symbolp end)
1400                       (make-string-input-stream ,string ,(or start 0))))                      `(if ,end
1401                   (t                           (make-string-input-stream ,string ,(or start 0) ,end)
1402                    `(make-string-input-stream ,string ,(or start 0) ,end)))))                           (make-string-input-stream ,string ,(or start 0))))
1403       ,@decls                     (t
1404       (unwind-protect                      `(make-string-input-stream ,string ,(or start 0) ,end)))))
1405         (progn ,@forms)         ,@decls
1406         (close ,var)         (unwind-protect
1407         ,@(if index `((setf ,index (string-input-stream-current ,var)))))))             (progn ,@forms)
1408             (close ,var)
1409             ,@(if index `((setf ,index (string-input-stream-current ,var))))))))
1410    
1411    
1412  (defmacro with-output-to-string ((var &optional string) &body (forms decls))  (defmacro with-output-to-string ((var &optional string) &body (forms decls))

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52

  ViewVC Help
Powered by ViewVC 1.1.5