* moved load to ikarus.load.ss

This commit is contained in:
Abdulaziz Ghuloum 2007-05-06 20:39:42 -04:00
parent cbad0231d4
commit e3c58d4464
4 changed files with 33 additions and 26 deletions

Binary file not shown.

30
src/ikarus.load.ss Normal file
View File

@ -0,0 +1,30 @@
(library (ikarus load)
(export load)
(import
(except (ikarus) load)
(only (ikarus reader) read-initial))
(define load-handler
(lambda (x)
(eval-top-level x)))
(define read-and-eval
(lambda (p eval-proc)
(let ([x (read p)])
(unless (eof-object? x)
(eval-proc x)
(read-and-eval p eval-proc)))))
(define load
(case-lambda
[(x) (load x load-handler)]
[(x eval-proc)
(unless (string? x)
(error 'load "~s is not a string" x))
(unless (procedure? eval-proc)
(error 'load "~s is not a procedure" eval-proc))
(let ([p (open-input-file x)])
(let ([x (read-initial p)])
(unless (eof-object? x)
(eval-proc x)
(read-and-eval p eval-proc)))
(close-input-port p))])))

View File

@ -1,9 +1,9 @@
(library (ikarus reader)
(export read read-token comment-handler load)
(export read read-initial read-token comment-handler)
(import
(ikarus system $chars)
(except (ikarus) read read-token comment-handler load))
(except (ikarus) read read-token comment-handler))
(define delimiter?
(lambda (c)
@ -785,29 +785,5 @@
(error 'comment-handler "~s is not a procedure" x))
x)))
(module (load)
(define load-handler
(lambda (x)
(eval-top-level x)))
(define read-and-eval
(lambda (p eval-proc)
(let ([x (my-read p)])
(unless (eof-object? x)
(eval-proc x)
(read-and-eval p eval-proc)))))
(define load
(case-lambda
[(x) (load x load-handler)]
[(x eval-proc)
(unless (string? x)
(error 'load "~s is not a string" x))
(unless (procedure? eval-proc)
(error 'load "~s is not a procedure" eval-proc))
(let ([p (open-input-file x)])
(let ([x (read-initial p)])
(unless (eof-object? x)
(eval-proc x)
(read-and-eval p eval-proc)))
(close-input-port p))])))
)

View File

@ -56,6 +56,7 @@
"ikarus.compiler.ss"
"ikarus.library-manager.ss"
"ikarus.syntax.ss"
"ikarus.load.ss"
"ikarus.pretty-print.ss"
"ikarus.cafe.ss"
"ikarus.posix.ss"