Exemplo n.º 1
0
        protected PCond2 (PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
            : base (predicate, consequent, alternative)
        {
            this.procedure = predicate.Rator;
            this.method = this.procedure.Method;
            this.rand0 = predicate.Operand0;
            this.rand1 = predicate.Operand1;
#if DEBUG
            rand0Type = rand0.GetType ();
            rand1Type = rand1.GetType ();
#endif
        }
Exemplo n.º 2
0
 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);
             }
         }
     }
 }
Exemplo n.º 3
0
 public Primitive2(Symbol name, PrimitiveMethod2 method)
     : base(name, 2)
 {
     this.method = method;
 }
Exemplo n.º 4
0
        static void AddPrimitive(string name, PrimitiveMethod2 method)
        {
            Symbol cname = CanonicalizeName(name);

            primitiveTable.Add(cname, new Primitive2(Symbol.Make(name), method));
        }
Exemplo n.º 5
0
 public Primitive2(Symbol name, PrimitiveMethod2 method)
     : base(name, 2)
 {
     this.method = method;
 }
Exemplo n.º 6
0
 static void AddPrimitive(string name, PrimitiveMethod2 method)
 {
     Symbol cname = CanonicalizeName (name);
     primitiveTable.Add (cname, new Primitive2 (Symbol.Make (name), method));
 }