* boot-9.scm (process-define-module): Added new specifier
authorMikael Djurfeldt <djurfeldt@nada.kth.se>
Tue, 1 Dec 1998 17:06:34 +0000 (17:06 +0000)
committerMikael Djurfeldt <djurfeldt@nada.kth.se>
Tue, 1 Dec 1998 17:06:34 +0000 (17:06 +0000)
:autoload MODULENAME BINDINGS to the define-module form.
The autoload specifier tells the module system to load the module
MODULENAME at the first occasion that any variable with its name
among BINDINGS is referenced.
(make-autoload-interface): New procedure:  Constructs a stand-in
for the public interface for the module to be autoloaded.

ice-9/ChangeLog
ice-9/boot-9.scm

index 88706cf..a78d89f 100644 (file)
@@ -1,3 +1,13 @@
+1998-12-02  Mikael Djurfeldt  <mdj@barbara.nada.kth.se>
+
+       * boot-9.scm (process-define-module): Added new specifier
+       :autoload MODULENAME BINDINGS to the define-module form.
+       The autoload specifier tells the module system to load the module
+       MODULENAME at the first occasion that any variable with its name
+       among BINDINGS is referenced.
+       (make-autoload-interface): New procedure:  Constructs a stand-in
+       for the public interface for the module to be autoloaded.
+
 1998-12-01  Mikael Djurfeldt  <mdj@mdj.nada.kth.se>
 
        * boot-9.scm (*suppress-old-style-hook-warning*): Set this to #t
index d2e2848..b7c4a5c 100644 (file)
                                          #f)))
                         (loop (cddr kws)
                               (cons interface reversed-interfaces)))))))
+             ((autoload)
+              (if (not (and (pair? (cdr kws)) (pair? (cddr kws))))
+                  (error "unrecognized defmodule argument" kws))
+              (loop (cdddr kws)
+                    (cons (make-autoload-interface module
+                                                   (cadr kws)
+                                                   (caddr kws))
+                          reversed-interfaces)))
              (else     
               (error "unrecognized defmodule argument" kws))))))
     module))
+
+;;; {Autoload}
+
+(define (make-autoload-interface module name bindings)
+  (let ((b (lambda (a sym definep)
+            (and (memq sym bindings)
+                 (let ((i (module-public-interface (resolve-module name))))
+                   (if (not i)
+                       (error "missing interface for module" name))
+                   ;; Replace autoload-interface with interface
+                   (set-car! (memq a (module-uses module)) i)
+                   (module-local-variable i sym))))))
+    (module-constructor #() #f b #f #f name 'autoload)))
+
 \f
 ;;; {Autoloading modules}
 
            (lambda () (set-autoloaded! dir-hint name didit)))
           didit))))
 
+\f
 ;;; Dynamic linking of modules
 
 ;; Initializing a module that is written in C is a two step process.