protected PCond1(PrimitiveCombination1 predicate, SCode consequent, SCode alternative) : base(predicate, consequent, alternative) { this.procedure = predicate.Operator; this.method = this.procedure.Method; this.arg0 = predicate.Operand; #if DEBUG this.arg0Type = this.arg0.GetType (); #endif }
protected POr1(PrimitiveCombination1 predicate, SCode alternative) : base(predicate, alternative) { this.procedure = predicate.Operator; this.method = this.procedure.Method; this.arg0 = predicate.Operand; #if DEBUG this.arg0Type = this.arg0.GetType(); #endif }
static void AddPrimitives(Type type) { MemberInfo [] minfos = type.FindMembers(MemberTypes.Method, BindingFlags.Public | BindingFlags.Static, null, null); foreach (MemberInfo minfo in minfos) { object [] attributes = minfo.GetCustomAttributes(typeof(SchemePrimitiveAttribute), false); if (attributes.Length == 1) { string name = ((SchemePrimitiveAttribute)(attributes [0])).Name; int arity = ((SchemePrimitiveAttribute)(attributes [0])).Arity; MethodInfo mtdinfo = (MethodInfo)minfo; // Console.WriteLine ("Add Primitive {0}", ((PrimitiveAttribute) (attributes [0])).Name); if (arity == 0) { PrimitiveMethod0 del = (PrimitiveMethod0)System.Delegate.CreateDelegate(typeof(PrimitiveMethod0), mtdinfo); AddPrimitive(name, del); } else if (arity == 1) { PrimitiveMethod1 del = (PrimitiveMethod1)System.Delegate.CreateDelegate(typeof(PrimitiveMethod1), mtdinfo); AddPrimitive(name, del); } else if (arity == 2) { PrimitiveMethod2 del = (PrimitiveMethod2)System.Delegate.CreateDelegate(typeof(PrimitiveMethod2), mtdinfo); AddPrimitive(name, del); } else if (arity == 3) { PrimitiveMethod3 del = (PrimitiveMethod3)System.Delegate.CreateDelegate(typeof(PrimitiveMethod3), mtdinfo); AddPrimitive(name, del); } else { PrimitiveMethod del = (PrimitiveMethod)System.Delegate.CreateDelegate(typeof(PrimitiveMethod), mtdinfo); AddPrimitive(name, arity, del); } } } }
public Primitive1(Symbol name, PrimitiveMethod1 method) : base(name, 1) { this.method = method; }
static void AddPrimitive(string name, PrimitiveMethod1 method) { Symbol cname = CanonicalizeName(name); primitiveTable.Add(cname, new Primitive1(Symbol.Make(name), method)); }
static void AddPrimitive(string name, PrimitiveMethod1 method) { Symbol cname = CanonicalizeName (name); primitiveTable.Add (cname, new Primitive1 (Symbol.Make (name), method)); }