Implement include and include-ci for R7RS.
authorChris Hanson <org/chris-hanson/cph>
Sun, 20 May 2018 05:30:49 +0000 (22:30 -0700)
committerChris Hanson <org/chris-hanson/cph>
Sun, 20 May 2018 05:30:49 +0000 (22:30 -0700)
src/runtime/mit-macros.scm
src/runtime/runtime.pkg

index 41dfb69de160af693cb7f2be93c28f8eef3ec67a..5c04886e94dd37e3e782477c4acfe37d2bbfbfa3 100644 (file)
@@ -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))))
+\f
 (define $define-values
   (spar-transformer->runtime
    (delay
index f6a787a5e74a6d10130e124bc10beb6c7b709d65..3514fc6a5e89b134a751d800e1bc60e0ab12fde9 100644 (file)
@@ -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