internal RMetaObject(NetRuby rb, string name, RMetaObject sp, RMetaObject meta) : base(rb, meta) { super = sp; m_tbl = new st_table(); if (name != null) { uint id = rb.intern(name); IVarSet("__classid__", Symbol.ID2SYM(id)); } }
internal object LocalASet(uint key, object val) { lock (this) { if (locals == null) { locals = new st_table(); } if (val == null) { locals.Remove(id); } else { locals[id] = val; } } return val; }
public override object IVarSet(uint uid, object val) { IVarCheck(); if (iv_tbl == null) iv_tbl = new st_table(); iv_tbl[uid] = val; return val; }
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; }
void valSet(uint id, object val, bool isconst) { string dest = (isconst) ? "constant" : "class variable"; CVarCheck(dest); lock (this) { if (iv_tbl == null) { iv_tbl = new st_table(); } else if (isconst) { if (iv_tbl.ContainsKey(id) || (this == ruby.cObject && ruby.class_tbl.ContainsKey(id))) { ruby.warn(String.Format("already initialized {0} {1}", dest, ruby.id2name(id))); } } iv_tbl[id] = val; } }
internal override void AttachSingleton(RObjectBase obj) { if (iv_tbl == null) { iv_tbl = new st_table(); } iv_tbl[ruby.intern("__attached__")] = obj; }
public bool lookup(object key, out st_table o) { o = (st_table)this[key]; return (o != null) ? true : false; }
public NetRuby() { disposed = false; sym_tbl = new st_table(); sym_rev_tbl = new st_table(); class_tbl = new st_table(); global_tbl = new st_table(); //generic_iv_tbl = null; last_id = Token.LAST_TOKEN; ////cache = new CacheEntry[CacheEntry.SIZE]; threads = new Hashtable(); threadMain = new RThread(this); InitEnvironment(threadMain); }