From 70bf1e80dc3a70e2017bacd490516add36c5a8d6 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 19 May 2018 22:30:49 -0700 Subject: [PATCH] Implement include and include-ci for R7RS. --- src/runtime/mit-macros.scm | 19 +++++++++++++++++++ src/runtime/runtime.pkg | 2 ++ 2 files changed, 21 insertions(+) diff --git a/src/runtime/mit-macros.scm b/src/runtime/mit-macros.scm index 41dfb69de..5c04886e9 100644 --- a/src/runtime/mit-macros.scm +++ b/src/runtime/mit-macros.scm @@ -426,6 +426,25 @@ USA. (scons-call 'raise-continuable condition) clauses))) +(define $include + (spar-transformer->runtime + (delay + (scons-rule `((+ ,string?)) + (lambda (filenames) + (apply scons-begin (read-files filenames #f))))))) + +(define $include-ci + (spar-transformer->runtime + (delay + (scons-rule `((+ ,string?)) + (lambda (filenames) + (apply scons-begin (read-files filenames #t))))))) + +(define (read-files filenames fold-case?) + (parameterize* (list (cons param:reader-fold-case? fold-case?)) + (lambda () + (append-map read-file filenames)))) + (define $define-values (spar-transformer->runtime (delay diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index f6a787a5e..3514fc6a5 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -4776,6 +4776,8 @@ USA. (do $do) ;R7RS (fluid-let $fluid-let) (guard $guard) ;R7RS + (include $include) ;R7RS + (include-ci $include-ci) ;R7RS (let $let) ;R7RS (let* $let*) ;R7RS (let*-syntax $let*-syntax) ;R7RS -- 2.25.1