public void Attribute(string name, bool read, bool write, bool ex) { NOEX noex = NOEX.PUBLIC; RThread th = ruby.GetCurrentContext(); if (ex) { if (th.ScopeTest(Scope.ScopeMode.Private)) { noex = NOEX.PRIVATE; ruby.warning((th.ScopeMode == Scope.ScopeMode.ModFunc) ? "attribute accessor as module_function" : "private attribute?"); } else if (th.ScopeTest(Scope.ScopeMode.Protected)) { noex = NOEX.PROTECTED; } } uint id = ruby.ToID(name); uint attriv = ruby.intern("@" + name); if (read) { ////addMethod(id, new RNIVar(th, attriv), noex); ruby.Funcall(this, "method_added", Symbol.ID2SYM(id)); } if (write) { id = ruby.intern(name + "="); ////addMethod(id, new RNAttrSet(th, attriv), noex); ruby.Funcall(this, "method_added", Symbol.ID2SYM(id)); } }
public void DefineMethod(string name, RMethod rm, int argc) { AddMethodCheck(); NOEX accs = ((name == "initialize") ? NOEX.PRIVATE : NOEX.PUBLIC) | NOEX.CFUNC; addMethod(name, rm, argc, accs); }
private void ExportMethod(uint name, NOEX noex) { /* * if (this == ruby.cObject) * { * ruby.Secure(4); * } * RMetaObject origin; * RNode body = SearchMethod(name, out origin); * if (body == null && this is RModule) * { * body = ruby.cObject.SearchMethod(name, out origin); * } * if (body == null) * { * printUndef(name); * } * if (body.noex != noex) * { * if (this == origin) * { * body.noex = noex; * } * else * { * ruby.ClearCache(name); * addMethod(name, new RNZSuper(ruby.GetCurrentContext(), ruby), noex); * } * } */ }
private void SetMethodVisibility(object[] args, NOEX ex) { ////ruby.SecureVisibility(this); for (int i = 0; i < args.Length; i++) { ExportMethod(ruby.ToID(args[i]), ex); } }
protected void addMethod(string name, MethodInfo mi, NOEX noex) { if (!mi.IsStatic) { m_tbl[name] = new RBuiltinMethod(ruby, mi); } /* * Console.WriteLine("adding " + mi.DeclaringType.Name + "." + mi.Name + " static=" + mi.IsStatic.ToString() + " ret=" + mi.ReturnType.Name); + + foreach(ParameterInfo pi in mi.GetParameters()) { + Console.WriteLine("param " + pi.ParameterType.Name + " " + pi.Name); + } */ }
public void Write(NOEX n) { Write(n.ToString()); }
/* * protected void addMethod(string name, RMethod rm, int argc, NOEX noex) * { * RNode func = new RNRFunc(ruby, rm, argc); * RNode body = new RNMethod(func, noex); #if INIT_DEBUG * System.Console.WriteLine("AddMethod for " + ToString() + ", " + name + "(" + ruby.intern(name).ToString() + ")"); #endif * lock (m_tbl.SyncRoot) * { * m_tbl[ruby.intern(name)] = body; * } * } */ protected void addMethod(string name, RMethod rm, int argc, NOEX noex) { //Console.WriteLine("addMethod " + rm.Method.DeclaringType.Name + "." + rm.Method.Name); m_tbl[name] = new RDelegateMethod(ruby, name, rm); }
protected void addMethod(string name, MethodInfo mi, NOEX noex) { if(!mi.IsStatic) { m_tbl[name] = new RBuiltinMethod(ruby, mi); } /* Console.WriteLine("adding " + mi.DeclaringType.Name + "." + mi.Name + " static=" + mi.IsStatic.ToString() + " ret=" + mi.ReturnType.Name); foreach(ParameterInfo pi in mi.GetParameters()) { Console.WriteLine("param " + pi.ParameterType.Name + " " + pi.Name); } */ }
/* protected void addMethod(string name, RMethod rm, int argc, NOEX noex) { RNode func = new RNRFunc(ruby, rm, argc); RNode body = new RNMethod(func, noex); #if INIT_DEBUG System.Console.WriteLine("AddMethod for " + ToString() + ", " + name + "(" + ruby.intern(name).ToString() + ")"); #endif lock (m_tbl.SyncRoot) { m_tbl[ruby.intern(name)] = body; } } */ protected void addMethod(string name, RMethod rm, int argc, NOEX noex) { //Console.WriteLine("addMethod " + rm.Method.DeclaringType.Name + "." + rm.Method.Name); m_tbl[name] = new RDelegateMethod(ruby, name, rm); }
private void SetMethodVisibility(object[] args, NOEX ex) { ////ruby.SecureVisibility(this); for (int i = 0; i < args.Length; i++) { ExportMethod(ruby.ToID(args[i]), ex); } }
private void ExportMethod(uint name, NOEX noex) { /* if (this == ruby.cObject) { ruby.Secure(4); } RMetaObject origin; RNode body = SearchMethod(name, out origin); if (body == null && this is RModule) { body = ruby.cObject.SearchMethod(name, out origin); } if (body == null) { printUndef(name); } if (body.noex != noex) { if (this == origin) { body.noex = noex; } else { ruby.ClearCache(name); addMethod(name, new RNZSuper(ruby.GetCurrentContext(), ruby), noex); } } */ }
internal RNDefn(RThread ps, uint i, RNode a, RNode d, NOEX p) : base(ps, i, a, d) { ex = p; }