Added binary file support.
authorHenry M. Wu <edu/mit/csail/zurich/mhwu>
Tue, 26 May 1992 23:08:56 +0000 (23:08 +0000)
committerHenry M. Wu <edu/mit/csail/zurich/mhwu>
Tue, 26 May 1992 23:08:56 +0000 (23:08 +0000)
v7/src/runtime/input.scm
v7/src/runtime/output.scm

index c61950ddddb2ec538dac6962ce3954021d1a5d09..0844b807d6734dfcdf9b183e816cb36cead2764e 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/input.scm,v 14.14 1991/11/26 07:06:21 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/input.scm,v 14.15 1992/05/26 23:08:41 mhwu Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
 
@@ -86,17 +86,29 @@ MIT in each case. |#
   (guarantee-input-port port)
   (fluid-let ((*current-input-port* port)) (thunk)))
 
-(define (call-with-input-file input-specifier receiver)
-  (let ((port (open-input-file input-specifier)))
+(define ((make-call-with-input-file open) input-specifier receiver)
+  (let ((port (open input-specifier)))
     (let ((value (receiver port)))
       (close-port port)
       value)))
 
-(define (with-input-from-file input-specifier thunk)
-  (call-with-input-file input-specifier
+(define call-with-input-file 
+  (make-call-with-input-file open-input-file))
+
+(define call-with-binary-input-file
+  (make-call-with-input-file open-binary-input-file))
+
+(define ((make-with-input-from-file call) input-specifier thunk)
+  (call input-specifier
     (lambda (port)
       (fluid-let ((*current-input-port* port))
        (thunk)))))
+
+(define with-input-from-file
+  (make-with-input-from-file call-with-input-file))
+
+(define with-input-from-binary-file
+  (make-with-input-from-file call-with-binary-input-file))
 \f
 ;;;; Input Procedures
 
index d07e52e20709467f677a768a3c7bc30180887fe8..8e492d9bdbbc7d9181fd385d3261ca2fdf888bdb 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/output.scm,v 14.12 1991/11/26 07:06:35 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/output.scm,v 14.13 1992/05/26 23:08:56 mhwu Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
 
@@ -87,17 +87,29 @@ MIT in each case. |#
   (guarantee-output-port port)
   (fluid-let ((*current-output-port* port)) (thunk)))
 
-(define (call-with-output-file output-specifier receiver)
+(define ((make-call-with-output-file open) output-specifier receiver)
   (let ((port (open-output-file output-specifier)))
     (let ((value (receiver port)))
       (close-port port)
       value)))
 
-(define (with-output-to-file output-specifier thunk)
-  (call-with-output-file output-specifier
+(define call-with-output-file
+  (make-call-with-output-file open-output-file))
+
+(define call-with-binary-output-file
+  (make-call-with-output-file open-binary-output-file))
+
+(define ((make-with-output-to-file call) output-specifier thunk)
+  (call output-specifier
     (lambda (port)
       (fluid-let ((*current-output-port* port))
        (thunk)))))
+
+(define with-output-to-file
+  (make-with-output-to-file call-with-output-file))
+
+(define with-output-to-binary-file
+  (make-with-output-to-file call-with-binary-output-file))
 \f
 ;;;; Output Procedures