home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / schmlbrr / schem_lb.lha / unsupported / CScheme / file.scm < prev    next >
Encoding:
Text File  |  1991-08-05  |  588 b   |  28 lines

  1. ;;; -*- Base: 10; Mode: Scheme; Syntax: MIT Scheme; Package: USER -*-
  2. ;;
  3. ;; FILE.SCM
  4. ;;
  5. ;; July 15, 1991
  6. ;; Minghsun Liu
  7. ;;
  8. ;; File i/o related operations.
  9. ;;
  10. ;;
  11. ;; The following(s) are(is) defined:
  12. ;;
  13. ;; (WITH-OPEN-FILE PORT FILENAME OPTION . FORM)
  14. ;;
  15.  
  16. ;;
  17. ;; (WITH-OPEN-FILE PORT FILENAME OPTION . FORM)
  18. ;;
  19. ;; opens a file with FILENAME for input or output.
  20. ;;
  21. (defmacro (with-open-file port f-name option #!rest form)
  22.   `(let ((,port ,(if (eq? option ':input)
  23.              `(open-input-file (string->pathname ,f-name))
  24.              `(open-output-file (string->pathname ,f-name)))))
  25.      ,@form))
  26.  
  27.  
  28.