Revision: 6902
Author: ek.kato
Date: Wed Jan 5 05:39:38 2011
Log: * scm/plugin.scm
- (try-require-with-force-reload) : Move to lazy-load.scm.
- (require-module) : Revert r6898.
- (module-load) : Ditto.
* scm/lazy-load.scm
- (try-require-with-force-reload) : Moved from plugin.scm.
- (require-module-with-force-reload) : New. Copy require-module
from plugin.scm, and use try-require-with-force-reload and
module-load-with-force-reload instead.
- (module-load-with-force-reload) : New. Copy module-load from
plugin.scm, and use try-require-with-force-reload instead of
try-require.
http://code.google.com/p/uim/source/detail?r=6902
Modified:
/trunk/scm/lazy-load.scm
/trunk/scm/plugin.scm
=======================================
--- /trunk/scm/lazy-load.scm Sun Apr 4 20:35:54 2010
+++ /trunk/scm/lazy-load.scm Wed Jan 5 05:39:38 2011
@@ -31,13 +31,47 @@
(require "util.scm")
+(define try-require-with-force-reload
+ (lambda (file)
+ (let ((loaded-str (string-append "*" file "-loaded*")))
+ (if (provided? loaded-str)
+ (try-load file)
+ (try-require file)))))
+
+;; see also pluin.scm
+(define require-module-with-force-reload
+ (lambda (module-name)
+ (set! currently-loading-module-name module-name)
+ ;; use try-require-with-force-reload because init-handler of the
+ ;; IM may be overwritten by stub-im handler
+ (let ((succeeded (or (module-load-with-force-reload module-name)
+ (try-require-with-force-reload
+ (find-module-scm-path
+ uim-plugin-scm-load-path
+ module-name)))))
+ (set! currently-loading-module-name #f)
+ succeeded)))
+
+;; see also pluin.scm
+(define module-load-with-force-reload
+ (lambda (module-name)
+ (if (require-dynlib module-name)
+ (let ((scm-path (find-module-scm-path
+ uim-plugin-scm-load-path module-name)))
+ (if (string? scm-path)
+ ;; use try-require-with-force-reload because init-handler of the
+ ;; im may be overwritten by stub-im handler
+ (try-require-with-force-reload scm-path)
+ #t))
+ #f)))
+
(define stub-im-generate-init-handler
(lambda (name module-name)
(lambda (id fake-im fake-arg)
(let* ((stub-im (retrieve-im name))
(stub-im-init-handler (and stub-im
(im-init-handler stub-im))))
- (and (require-module module-name)
+ (and (require-module-with-force-reload module-name)
(let* ((im (retrieve-im name))
(init-handler (im-init-handler im))
(arg (im-init-arg im))
=======================================
--- /trunk/scm/plugin.scm Tue Jan 4 23:00:13 2011
+++ /trunk/scm/plugin.scm Wed Jan 5 05:39:38 2011
@@ -55,22 +55,14 @@
(define installed-im-module-list ())
(define currently-loading-module-name #f)
-(define try-require-with-force-reload
- (lambda (file)
- (let ((loaded-str (string-append "*" file "-loaded*")))
- (if (provided? loaded-str)
- (try-load file)
- (try-require file)))))
;;
;; TODO: write test for load-plugin
;; returns whether initialization is succeeded
(define require-module
(lambda (module-name)
(set! currently-loading-module-name module-name)
- ;; use try-require-with-force-reload because init-handler of the
- ;; im may be overwritten by stub-im handler
(let ((succeeded (or (module-load module-name)
- (try-require-with-force-reload
+ (try-require
(find-module-scm-path
uim-plugin-scm-load-path
module-name)))))
@@ -142,8 +134,6 @@
(let ((scm-path (find-module-scm-path
uim-plugin-scm-load-path module-name)))
(if (string? scm-path)
- ;; use try-require-with-force-reload because init-handler of the
- ;; im may be overwritten by stub-im handler
- (try-require-with-force-reload scm-path)
+ (try-require scm-path)
#t))
#f)))