[uim-commit] r289 - trunk/scm

yamaken@freedesktop.org yamaken@freedesktop.org
Fri Jan 14 12:45:50 PST 2005


Author: yamaken
Date: 2005-01-14 12:45:47 -0800 (Fri, 14 Jan 2005)
New Revision: 289

Modified:
   trunk/scm/loader.scm
   trunk/scm/plugin.scm
Log:
* scm/plugin.scm
  - (require-module): New procedure. This abstraction of loading is
    required to implement the lazy loading feature
  - Remove unused debug codes
* scm/loader.scm
  - Update copyright
  - Remove discrete require and load-plugins
  - (installed-im-module-list): New variable
  - Load all IMs listed in installed-im-module-list by
    require-module. This code will be removed once the enabled-im-list
    feature is implemented


Modified: trunk/scm/loader.scm
===================================================================
--- trunk/scm/loader.scm	2005-01-14 17:08:40 UTC (rev 288)
+++ trunk/scm/loader.scm	2005-01-14 20:45:47 UTC (rev 289)
@@ -1,5 +1,5 @@
 ;;;
-;;; Copyright (c) 2003,2004 uim Project http://uim.freedesktop.org/
+;;; Copyright (c) 2003-2005 uim Project http://uim.freedesktop.org/
 ;;;
 ;;; All rights reserved.
 ;;;
@@ -28,33 +28,39 @@
 ;;; SUCH DAMAGE.
 ;;;;
 
-;; the loading order of input methods affecs which IM is preferred at
-;; the default IM selection process for each locale. i.e. list
+;; The described order of input methods affects which IM is preferred
+;; at the default IM selection process for each locale. i.e. list
 ;; preferable IM first for each language
+(define installed-im-module-list
+  '(;; Chinese input methods
+    "pyload"
 
-;; Chinese input methods
-(require "pyload.scm")
+    ;; Japanese input methods
+    "anthy"
+    "canna"
+    "prime"
+    "skk"
+    "tcode"
+    "tutcode"
 
-(load-plugin "anthy")
-(load-plugin "canna")
-(load-plugin "prime")
-(load-plugin "skk")
-(require "tcode.scm")
-(require "tutcode.scm")
+    ;; Korean input methods
+    "hangul"
 
-;; Korean input methods
-(require "hangul.scm")
+    ;; Vietnamese input methods
+    "viqr"
 
-;; Vietnamese input methods
-(require "viqr.scm")
+    ;; other input methods
+    "ipa"
+    ;;"spellcheck"
 
-;; other input methods
-(require "ipa.scm")
-;(require "spellcheck.scm")
+    ;; latin input method
+    "latin"
 
-;; latin input method
-(require "latin.scm")
+    ;; other input method frameworks
+    "m17nlib"
+    ;;"scim"
+    ))
 
-(load-plugin "m17nlib")
-
-;(load-plugin "scim")
+;; don't touch this. This code will be removed once the
+;; enabled-im-list feature is implemented
+(for-each require-module installed-im-module-list)

Modified: trunk/scm/plugin.scm
===================================================================
--- trunk/scm/plugin.scm	2005-01-14 17:08:40 UTC (rev 288)
+++ trunk/scm/plugin.scm	2005-01-14 20:45:47 UTC (rev 289)
@@ -51,10 +51,6 @@
 		(sys-pkgdatadir))))
 		
 
-;; 'print' prevents testing framework from normal run.
-;;(print uim-plugin-lib-load-path)
-;;(print uim-plugin-scm-load-path)
-
 (define plugin-alist ())
 (define plugin-func-alist ())
 
@@ -94,3 +90,28 @@
     (let ((entry (plugin-list-query plugin-name)))
       (and entry
 	   (plugin-entry-quit-proc entry)))))
+
+
+;; holds list of (module-name provided-im-name1 provided-im-name2 ...)
+;; e.g. '("pyload" py pyunihan pinyin-big5)
+(define required-modules-alist ())
+
+;; The name 'module' is imported from a post from Hiroyuki. If you
+;; feel bad about the meaning of 'module', post your opinion to
+;; uim@fdo.
+;;
+;; TODO: write test
+;; returns provided im-names
+(define require-module
+  (lambda (module-name)
+    (let ((pre-im-list im-list))
+      (or (load-plugin module-name)
+	  (require (string-append module-name ".scm")))
+      (let* ((post-im-list im-list)
+	     (nr-new-ims (- (length post-im-list)
+			    (length pre-im-list)))
+	     (new-ims (list-head post-im-list nr-new-ims))
+	     (provided (reverse (map im-name new-ims))))
+	(set! required-modules-alist (cons (cons module-name provided)
+					   required-modules-alist))
+	provided))))



More information about the Uim-commit mailing list