From 7122506062585e538b8a2a2e41e9825dbe63f94e Mon Sep 17 00:00:00 2001 From: Mikael Djurfeldt Date: Tue, 1 Dec 1998 17:06:34 +0000 Subject: [PATCH] * 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. --- ice-9/ChangeLog | 10 ++++++++++ ice-9/boot-9.scm | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/ice-9/ChangeLog b/ice-9/ChangeLog index 88706cf5a..a78d89f7b 100644 --- a/ice-9/ChangeLog +++ b/ice-9/ChangeLog @@ -1,3 +1,13 @@ +1998-12-02 Mikael Djurfeldt + + * 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 * boot-9.scm (*suppress-old-style-hook-warning*): Set this to #t diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm index d2e28485f..b7c4a5c62 100644 --- a/ice-9/boot-9.scm +++ b/ice-9/boot-9.scm @@ -1989,9 +1989,31 @@ #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))) + ;;; {Autoloading modules} @@ -2038,6 +2060,7 @@ (lambda () (set-autoloaded! dir-hint name didit))) didit)))) + ;;; Dynamic linking of modules ;; Initializing a module that is written in C is a two step process. -- 2.20.1