*** empty log message ***
[m17n/m17n-lib-js.git] / mim2.js
diff --git a/mim2.js b/mim2.js
index 3df31e3..2bb2370 100644 (file)
--- a/mim2.js
+++ b/mim2.js
@@ -1051,7 +1051,6 @@ MIM.im_domain.DefType (MIM.State.prototype);
        var vname = node.attributes['vname'].nodeValue;
        if (this != MIM.im_global)
          {
-           alert ("getting global var of vname:"+vname);
            var vari = get_global_var (vname);
            if (vari != null)
              this.domain.Defvar (vname, vari.desc, vari.val, vari.range);
@@ -1152,26 +1151,31 @@ MIM.im_domain.DefType (MIM.State.prototype);
                                  MIM.im_domain, null);
   };
 
-  function load_im (node)
+  function load_im (node, im)
   {
-    this.map_list = {};
-    this.initial_state = null;
-    this.state_list = {};
+    //alert ('Loading IM (' + im + ':' + im.lang + '-' + im.name + ')');
+    im.map_list = {};
+    im.initial_state = null;
+    im.state_list = {};
     for (node = node.firstElement (); node; node = node.nextElement ())
       {
        var name = node.nodeName;
+       //Xex.Log ('parsing ' + name);
        var parser = parsers[name];
        if (parser)
-         parser.call (this, node);
+         parser.call (im, node);
       }
-    this.load_status = MIM.LoadStatus.Loaded;
+    //alert ('initial state = ' + im.initial_state);
+    im.load_status = MIM.LoadStatus.Loaded;
   }
 
-  MIM.IM.prototype.Load = function ()
-  {
-    this.load_status = MIM.LoadStatus.Loading;
-    Xex.Load (MIM.server, this.file, load_im);
-  }
+  MIM.IM.prototype = {
+    Load: function ()
+    {
+      this.load_status = MIM.LoadStatus.Loading;
+      Xex.Load (MIM.server, this.file, load_im, this);
+    }
+  };
 
   MIM.IC = function (im, target)
   {
@@ -1729,7 +1733,6 @@ MIM.im_domain.DefType (MIM.State.prototype);
        MIM.im_global = new MIM.IM ('t', 'nil', 'global', null);
        MIM.im_global.load_status = MIM.LoadStatus.Error;
       }
-    node = undefined;
     MIM.current = MIM.imlist['t']['latn-post'];
     MIM.current.Load ();
   }
@@ -2116,7 +2119,7 @@ MIM.keydown = function (event)
   if (! ic || ic.im != MIM.current)
     {
       target.mim_ic = null;
-      Xex.Log ('creating IC');
+      Xex.Log ('creating IC for ' + MIM.current.lang + '-' + MIM.current.name);
       ic = new MIM.IC (MIM.current, target);
       if (ic.im.load_status != MIM.LoadStatus.Loaded)
        return true;