Add new procedure `with-output-string-port'.
authorChris Hanson <org/chris-hanson/cph>
Thu, 13 Sep 1990 22:31:59 +0000 (22:31 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 13 Sep 1990 22:31:59 +0000 (22:31 +0000)
v7/src/runtime/runtime.pkg
v7/src/runtime/strout.scm
v8/src/runtime/runtime.pkg

index 1813fde7ddc334d8fb0da7cbd626ca24c47d1665..b5919a802bc62bd048f4b66773669a2924d712fe 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/runtime.pkg,v 14.75 1990/09/11 22:33:37 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/runtime.pkg,v 14.76 1990/09/13 22:31:38 cph Exp $
 
 Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology
 
@@ -1858,6 +1858,7 @@ MIT in each case. |#
   (files "strout")
   (parent ())
   (export ()
+         with-string-output-port
          with-output-to-string)
   (initialization (initialize-package!)))
 
index 452085b74405e6b9d8e192a428b324b26adb5ff6..44bd7be61ebd2f1e396b477934e02f125c16ba7a 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/Attic/strout.scm,v 14.3 1988/10/15 17:19:25 cph Rel $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/Attic/strout.scm,v 14.4 1990/09/13 22:31:59 cph Rel $
 
-Copyright (c) 1988 Massachusetts Institute of Technology
+Copyright (c) 1988, 1990 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -36,7 +36,7 @@ MIT in each case. |#
 ;;; package: (runtime string-output)
 
 (declare (usual-integrations))
-\f
+
 (define (initialize-package!)
   (set! output-string-template
        (make-output-port `((PRINT-SELF ,operation/print-self)
@@ -45,10 +45,15 @@ MIT in each case. |#
                          false)))
 
 (define (with-output-to-string thunk)
+  (with-string-output-port
+   (lambda (port)
+     (with-output-to-port port thunk))))
+
+(define (with-string-output-port generator)
   (apply string-append
         (reverse!
          (let ((port (output-port/copy output-string-template '())))
-           (with-output-to-port port thunk)
+           (generator port)
            (output-port/state port)))))
 
 (define output-string-template)
index a31cb57cd83d106e3cadcb31ca6e6dadeb13689f..03490d361440bea1246b77bad6ff56697eee86bb 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/runtime.pkg,v 14.75 1990/09/11 22:33:37 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/runtime.pkg,v 14.76 1990/09/13 22:31:38 cph Exp $
 
 Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology
 
@@ -1858,6 +1858,7 @@ MIT in each case. |#
   (files "strout")
   (parent ())
   (export ()
+         with-string-output-port
          with-output-to-string)
   (initialization (initialize-package!)))