fix module-name resolver for embedded exe

svn: r3651
This commit is contained in:
Matthew Flatt 2006-07-07 17:51:21 +00:00
parent 1db7ae24c8
commit 399f98ff14

View File

@ -426,12 +426,17 @@
(cons path (mod-full-name m))
#f)))
code-l)))])
(current-module-name-resolver
(lambda (name rel-to stx)
(if (or (not name)
(not (eq? (current-namespace) ns)))
;; a notification,or wrong namespace
(orig name rel-to stx)
(letrec ([embedded-resolver
(case-lambda
[(name)
;; a notification
(orig name)]
[(name rel-to stx)
(embedded-resolver name rel-to stx #t)]
[(name rel-to stx load?)
(if (not (eq? (current-namespace) ns))
;; Wrong namespace
(orig name rel-to stx load?)
;; Have a relative mapping?
(let ([a (assoc rel-to mapping-table)])
(if a
@ -477,7 +482,8 @@
;; Have it:
(cdr a3)
;; Let default handler try:
(orig name rel-to stx))))))))))
(orig name rel-to stx load?))))))])])
(current-module-name-resolver embedded-resolver))))
;; Write a module bundle that can be loaded with 'load' (do not embed it
;; into an executable). The bundle is written to the current output port.