Example #1
0
 internal fc_result(uint key, RObjectBase kl, RObjectBase value, fc_result pv)
 {
     name  = key;
     path  = null;
     klass = kl;
     track = value;
     prev  = pv;
 }
Example #2
0
        internal object FindClassPath()
        {
            fc_result arg = new fc_result(0, this, ruby.cObject, null);

            if (ruby.cObject.iv_tbl != null)
            {
                lock (ruby.cObject.iv_tbl.SyncRoot)
                {
                    foreach (DictionaryEntry entry in ruby.cObject.iv_tbl)
                    {
                        if (fc_i((uint)entry.Key, entry.Value, arg))
                        {
                            break;
                        }
                    }
                }
            }
            if (arg.path == null)
            {
                lock (ruby.class_tbl.SyncRoot)
                {
                    foreach (DictionaryEntry entry in ruby.class_tbl)
                    {
                        if (fc_i((uint)entry.Key, entry.Value, arg))
                        {
                            break;
                        }
                    }
                }
            }
            if (arg.path != null)
            {
                lock (this)
                {
                    if (iv_tbl == null)
                    {
                        iv_tbl = new st_table();
                    }
                    iv_tbl[ruby.intern("__classpath__")] = arg.path;
                }
            }
            return((string)arg.path);
        }
Example #3
0
 private bool fc_i(uint key, object value, fc_result res)
 {
     if (Parser.is_const_id(key))
     {
         return(false);
     }
     if (value is RModule || value is RClass)
     {
         RMetaObject va = (RMetaObject)value;
         if (va == res.klass)
         {
             res.path = fc_path(res, key);
             return(true);
         }
         if (va.iv_tbl == null)
         {
             return(false);
         }
         fc_result list = res;
         while (list != null)
         {
             if (list.end(va))
             {
                 return(false);
             }
             list = list.prev;
         }
         fc_result arg = new fc_result(key, res.klass, va, res);
         lock (va.iv_tbl.SyncRoot)
         {
             foreach (DictionaryEntry ent in va.iv_tbl)
             {
                 if (fc_i((uint)ent.Key, ent.Value, arg))
                 {
                     res.path = arg.path;
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Example #4
0
        private string fc_path(fc_result fc, uint name)
        {
            string path = ruby.id2name(name);
            string tmp;
            uint   cp = ruby.intern("__classpath__");

            while (fc != null)
            {
                if (fc.end(ruby.cObject))
                {
                    break;
                }
                if (fc.lookup(cp, out tmp))
                {
                    return(tmp + "::" + path);
                }
                tmp  = ruby.id2name(fc.name);
                path = tmp + "::" + path;
                fc   = fc.prev;
            }
            return(path);
        }
Example #5
0
 internal object FindClassPath()
 {
     fc_result arg = new fc_result(0, this, ruby.cObject, null);
     if (ruby.cObject.iv_tbl != null)
     {
         lock (ruby.cObject.iv_tbl.SyncRoot)
         {
             foreach (DictionaryEntry entry in ruby.cObject.iv_tbl)
             {
                 if (fc_i((uint)entry.Key, entry.Value, arg)) break;
             }
         }
     }
     if (arg.path == null)
     {
         lock (ruby.class_tbl.SyncRoot)
         {
             foreach (DictionaryEntry entry in ruby.class_tbl)
             {
                 if(fc_i((uint)entry.Key, entry.Value, arg)) break;
             }
         }
     }
     if (arg.path != null)
     {
         lock (this)
         {
             if (iv_tbl == null) iv_tbl = new st_table();
             iv_tbl[ruby.intern("__classpath__")] = arg.path;
         }
     }
     return (string)arg.path;
 }
Example #6
0
 private bool fc_i(uint key, object value, fc_result res)
 {
     if (Parser.is_const_id(key)) return false;
     if (value is RModule || value is RClass)
     {
         RMetaObject va = (RMetaObject)value;
         if (va == res.klass)
         {
             res.path = fc_path(res, key);
             return true;
         }
         if (va.iv_tbl == null) return false;
         fc_result list = res;
         while (list != null)
         {
             if (list.end(va)) return false;
             list = list.prev;
         }
         fc_result arg = new fc_result(key, res.klass, va, res);
         lock (va.iv_tbl.SyncRoot)
         {
             foreach (DictionaryEntry ent in va.iv_tbl)
             {
                 if (fc_i((uint)ent.Key, ent.Value, arg))
                 {
                     res.path = arg.path;
                     return true;
                 }
             }
         }
     }
     return false;
 }
Example #7
0
 private string fc_path(fc_result fc, uint name)
 {
     string path = ruby.id2name(name);
     string tmp;
     uint cp = ruby.intern("__classpath__");
     while (fc != null)
     {
         if (fc.end(ruby.cObject)) break;
         if (fc.lookup(cp, out tmp))
         {
             return tmp + "::" + path;
         }
         tmp = ruby.id2name(fc.name);
         path = tmp + "::" + path;
         fc = fc.prev;
     }
     return path;
 }
Example #8
0
 internal fc_result(uint key, RObjectBase kl, RObjectBase value, fc_result pv)
 {
     name = key;
     path = null;
     klass = kl;
     track = value;
     prev = pv;
 }