DEBUG: mes/module/mes/guile/module.mes

This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-12-30 09:56:46 +01:00
parent 80b51c18e7
commit 5effea9a61
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
2 changed files with 36 additions and 4 deletions

View File

@ -98,6 +98,7 @@
#t)
(define-macro (define-module module . rest)
(display "BOOT-5 DEFINE-MODULE")
#t)
;; end boot-02.scm

View File

@ -517,12 +517,13 @@
path))
(define (%search-load-path file-name)
(when (> %debug 2)
(when #t ;;(> %debug 2)
(format (current-error-port) "%load-path ~s\n" %load-path)
(format (current-error-port) "%search-load-path ~s\n" file-name))
(let ((file (or (search-path %load-path (string-append file-name ".mes"))
(search-path %load-path (string-append file-name ".scm")))))
(when (> %debug 1)
(format (current-error-port) " => ~s\n" file))
(format (current-error-port) " *file-name => ~s\n" file))
file))
@ -1424,7 +1425,11 @@
(define (module-public-interface m)
(module-ref m '%module-public-interface #f))
(define (set-module-public-interface! m i)
(module-define! m '%module-public-interface i))
(pke "setting public-i:" (module-name m))
(module-define! m '%module-public-interface i)
(when (module-name m)
(pke " ==> public-i" (module-name m) "=>" (module-public-interface m)))
)
(define (set-system-module! m s)
(set-procedure-property! (module-eval-closure m) 'system-module s))
(define the-root-module (make-root-module))
@ -1575,6 +1580,12 @@
identity))
(module (resolve-module name))
(public-i (and module (module-public-interface module))))
(and (not module)
(error "no such module" name))
(and (not public-i)
(format (current-error-port) " module=~s\n" module)
(error "module has no public-i" name))
(pke "***have public-i***" name "=>" public-i)
(and (or (not module) (not public-i))
(error "no code for module" name))
(if (and (not select) (null? hide) (eq? renamer identity))
@ -1626,6 +1637,8 @@
(kws (cdr args))
(unrecognized (lambda (arg)
(error "unrecognized define-module argument" arg))))
(pke "process-define-module args=" args)
(pke "process-define-module name=" (module-name module))
(beautify-user-module! module)
(let loop ((kws kws)
(reversed-interfaces '())
@ -1760,22 +1773,39 @@
(map (lambda (elt)
(string-append (symbol->string elt) "/"))
dir-hint-module-name))))
(pke "try-module-autoload" module-name)
(pke "dir-hint" dir-hint)
(resolve-module dir-hint-module-name #f)
(pke "resolft!")
(and (not (autoload-done-or-in-progress? dir-hint name))
(pke "...")
(let ((didit #f))
;; FIXME: *undefined* here is a terrible hack; it switches
;; toplevel for defines.
(define (load-file *undefined* file)
(save-module-excursion (lambda () (primitive-load file)))
(pke "reading file:" file)
;;(save-module-excursion (lambda () (primitive-load file)))
(save-module-excursion (lambda ()
(pke "calling primitve-load...")
(primitive-load file)))
(set! didit #t))
(dynamic-wind
(lambda () (autoload-in-progress! dir-hint name))
(lambda ()
(pke "gonna load..." dir-hint name)
(let ((file (in-vicinity dir-hint name)))
(pke "FILE:" file)
(cond ((and load-compiled
(%search-load-path (string-append file ".go")))
=> (lambda (full)
(load-file load-compiled full)))
((%search-load-path file)
=> (lambda (full)
;;(save-module-excursion (lambda () (load-file 'primitive-load full)))
(load-file 'primitive-load full)
))
((%search-load-path file)
=> (lambda (full)
(with-fluids ((current-reader #f))
@ -2733,3 +2763,4 @@
(define-module (guile-user))
;;; boot-9.scm ends here
(pke "guile/module.mes booted")