- invoking ikarus in r6rs mode now takes optional library files

arguments as in
  $ ikarus <library-file> ... --r6rs-script <script-file> args ...
This commit is contained in:
Abdulaziz Ghuloum 2008-11-01 16:19:35 -04:00
parent ae9d095527
commit 9c60997b02
4 changed files with 19 additions and 4 deletions

View File

@ -24,7 +24,6 @@
(only (psyntax expander) compile-r6rs-top-level) (only (psyntax expander) compile-r6rs-top-level)
(only (ikarus.reader.annotated) read-script-source-file)) (only (ikarus.reader.annotated) read-script-source-file))
(define-struct serialized-library (contents)) (define-struct serialized-library (contents))
(define fasl-extension ".ikarus-fasl") (define fasl-extension ".ikarus-fasl")

View File

@ -75,6 +75,8 @@
(export) (export)
(import (ikarus) (import (ikarus)
(except (ikarus startup) host-info) (except (ikarus startup) host-info)
(only (psyntax library-manager) current-library-expander)
(only (ikarus.reader.annotated) read-source-file)
(only (ikarus load) load-r6rs-top-level)) (only (ikarus load) load-r6rs-top-level))
(init-library-path) (init-library-path)
(let-values ([(files script script-type args) (let-values ([(files script script-type args)
@ -124,8 +126,14 @@
files))) files)))
(cond (cond
[(eq? script-type 'r6rs-script) [(eq? script-type 'r6rs-script)
(assert-null files "--r6rs-script")
(command-line-arguments (cons script args)) (command-line-arguments (cons script args))
(for-each
(lambda (filename)
(for-each
(lambda (src)
((current-library-expander) src))
(read-source-file filename)))
files)
(load-r6rs-top-level script 'run) (load-r6rs-top-level script 'run)
(exit 0)] (exit 0)]
[(eq? script-type 'compile) [(eq? script-type 'compile)

View File

@ -15,7 +15,7 @@
(library (ikarus.reader.annotated) (library (ikarus.reader.annotated)
(export read-library-source-file read-script-source-file) (export read-source-file read-library-source-file read-script-source-file)
(import (import
(except (ikarus) read-annotated read-script-annotated) (except (ikarus) read-annotated read-script-annotated)
(only (ikarus.reader) read-annotated read-script-annotated) (only (ikarus.reader) read-annotated read-script-annotated)
@ -32,6 +32,14 @@
(define (read-library-source-file file-name) (define (read-library-source-file file-name)
(read-annotated (annotated-port file-name))) (read-annotated (annotated-port file-name)))
(define (read-source-file file-name)
(let ([p (annotated-port file-name)])
(let f ()
(let ([x (read-annotated p)])
(if (eof-object? x)
'()
(cons x (f)))))))
(define (read-script-source-file file-name) (define (read-script-source-file file-name)
(let ([p (annotated-port file-name)]) (let ([p (annotated-port file-name)])
(let ([x (read-script-annotated p)]) (let ([x (read-script-annotated p)])

View File

@ -1 +1 @@
1659 1660