~ chicken-r7rs (master) 76ce9b9e8efc8ee18e0fcee2963a1001ac8588cc
commit 76ce9b9e8efc8ee18e0fcee2963a1001ac8588cc Author: Evan Hanson <evhan@foldling.org> AuthorDate: Sun Jul 7 04:54:58 2013 +0000 Commit: Evan Hanson <evhan@foldling.org> CommitDate: Sun Jul 7 04:54:58 2013 +0000 Add scheme.file module diff --git a/r7rs.setup b/r7rs.setup index d5101dc..280f22e 100644 --- a/r7rs.setup +++ b/r7rs.setup @@ -4,7 +4,7 @@ (use make srfi-1) (define scheme-modules - '("process-context" "eval" "cxr" "complex" "inexact" "load")) ;XXX + '("process-context" "eval" "cxr" "complex" "inexact" "load" "file")) ;XXX (make (("r7rs-compile-time.so" ("r7rs-compile-time.scm" "r7rs-compile-time-module.scm") (compile -s -O3 -d1 r7rs-compile-time-module.scm -J -o r7rs-compile-time.so) diff --git a/scheme.file.scm b/scheme.file.scm new file mode 100644 index 0000000..7e783cc --- /dev/null +++ b/scheme.file.scm @@ -0,0 +1,25 @@ +(module scheme.file (call-with-input-file + call-with-output-file + call-with-input-file + delete-file + ; TODO open-binary-input-file + open-input-file + with-input-from-file + call-with-output-file + file-exists? + ; TODO open-binary-output-file + open-output-file + with-output-to-file) + (import scheme) + (import (rename (only chicken delete-file file-exists? :) + (file-exists? chicken-file-exists?))) + + ;; CHICKEN's file-exists? returns the filename when true, + ;; whereas R7RS requires it to return #t or #f. + + (: file-exists? (string -> boolean)) + + (define (file-exists? filename) + (and (chicken-file-exists? filename) #t)) + +)Trap