~ chicken-core (chicken-5) 634e3041bc34baa8f7df6265dca00b7ee008e077


commit 634e3041bc34baa8f7df6265dca00b7ee008e077
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Mon Oct 16 08:21:39 2017 +1300
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Mon Oct 16 14:27:35 2017 +0200

    Add unit dependency info to the scheme and rnrs[-null] modules
    
    The r4rs module depends on the "library" unit, so we add that dependency
    to its module registration in modules.scm.
    
    The r[45]rs-null modules don't depend on any unit since they only export
    syntax, so set their module-library slots to #f to indicate "no unit".
    
    The scheme module only depends on the "library" unit, so remove it from
    the list of `core-unit-requirements` and add "library" to its module
    registration so that it's treated like any other unit.
    
    Add a test to make sure the r4rs and r4-null libraries are working.
    
    Signed-off-by: Peter Bex <peter@more-magic.net>

diff --git a/eval.scm b/eval.scm
index 10162865..dbdab377 100644
--- a/eval.scm
+++ b/eval.scm
@@ -894,10 +894,10 @@
 (define-foreign-variable install-lib-name c-string "C_INSTALL_LIB_NAME")
 (define-foreign-variable uses-soname? bool "C_USES_SONAME")
 
+;;; Core unit information
+
 (define-constant core-unit-requirements
-  '((scheme ; XXX not totally correct, also needs eval
-     . (##core#require library))
-    (chicken.foreign
+  '((chicken.foreign
      . (##core#require-for-syntax chicken-ffi-syntax))
     (chicken.condition
      . (##core#begin
diff --git a/modules.scm b/modules.scm
index f71519b6..8d99a0f4 100644
--- a/modules.scm
+++ b/modules.scm
@@ -941,13 +941,13 @@
        ;;    ##sys#initial-macro-environment and thus always available inside 
        ;;    modules.
        ##sys#default-macro-environment))
-  (##sys#register-primitive-module 'r4rs r4rs-values r4rs-syntax)
-  (##sys#register-primitive-module 
-   'scheme
+  (##sys#register-core-module 'r4rs 'library r4rs-values r4rs-syntax)
+  (##sys#register-core-module
+   'scheme 'library
    (append '(dynamic-wind values call-with-values) r4rs-values)
    r4rs-syntax)
-  (##sys#register-primitive-module 'r4rs-null '() r4rs-syntax)
-  (##sys#register-primitive-module 'r5rs-null '() r4rs-syntax))
+  (##sys#register-core-module 'r4rs-null #f '() r4rs-syntax)
+  (##sys#register-core-module 'r5rs-null #f '() r4rs-syntax))
 
 (##sys#register-module-alias 'r5rs 'scheme)
 (##sys#register-module-alias 'srfi-88 'chicken.keyword)
diff --git a/tests/module-tests.scm b/tests/module-tests.scm
index e6969e76..12d63bc4 100644
--- a/tests/module-tests.scm
+++ b/tests/module-tests.scm
@@ -10,6 +10,18 @@
 
 (test-begin "modules")
 
+(test-assert
+ "r4rs"
+ (module test-r4rs ()
+   (import r4rs)
+   (equal? 1 1)))
+
+(test-assert
+ "r4rs-null"
+ (module test-r4rs-null ()
+   (import r4rs-null)
+   (begin #t)))
+
 (test-equal "internal/variable"
 (module foo (abc def)
   (import scheme)
Trap