Beispiel #1
0
        public static SCode Make(PrimitiveCombination2 predicate, SCode alternative)
        {
#if DEBUG
            Debugger.Break();
#endif
            return
                (new POrIsEqA0A0(predicate, alternative));
        }
Beispiel #2
0
 public static SCode Make(PrimitiveCombination2 predicate, SCode alternative)
 {
     return
         ((predicate.Operand1 is Argument) ? POrIsEqQA.Make(predicate, alternative) :
          (predicate.Operand1 is Quotation) ? Unimplemented() :
          (predicate.Operand1 is StaticVariable) ? POrIsEqQS.Make(predicate, alternative) :
          new POrIsEqQ(predicate, alternative));
 }
Beispiel #3
0
        protected PCondIsEqCar(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
            : base(predicate, consequent, alternative)
        {
            this.rand0Inner = ((PrimitiveCar)predicate.Operand0).Operand;
#if DEBUG
            this.rand0InnerType = this.rand0Inner.GetType();
#endif
        }
 protected PCondIsEqCar(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
     this.rand0Inner = ((PrimitiveCar) predicate.Operand0).Operand;
     #if DEBUG
     this.rand0InnerType = this.rand0Inner.GetType();
     #endif
 }
Beispiel #5
0
 public static SCode Make(PrimitiveCombination2 predicate, SCode alternative)
 {
     return
         ((predicate.Operand0 is Argument0) ? POrIsEqA0.Make(predicate, alternative) :
          (predicate.Operand1 is Argument) ? POrIsEqAA.Make(predicate, alternative) :
          (predicate.Operand1 is Quotation) ? POrIsEqAQ.Make(predicate, alternative) :
          (predicate.Operand1 is StaticVariable) ? POrIsEqAS.Make(predicate, alternative) :
          new POrIsEqA(predicate, alternative));
 }
Beispiel #6
0
 public static new SCode Make(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         //(consequent is Argument) ? PCondIsEqA0SA.Make (predicate, (Argument) consequent, alternative) :
         //(consequent is Quotation) ? PCondIsEqA0SQ.Make (predicate, (Quotation) consequent, alternative) :
         //(consequent is StaticVariable) ? PCondIsEqA0SS.Make (predicate, (StaticVariable) consequent, alternative) :
         //(alternative is Argument) ? PCondIsEqA0SXA.Make (predicate, consequent, (Argument) alternative) :
         //(alternative is Quotation) ? PCondIsEqA0SXQ.Make (predicate, consequent, (Quotation) alternative) :
         //(alternative is StaticVariable) ? PCondIsEqA0SXS.Make (predicate, consequent, (StaticVariable) alternative) :
         (new PCondIsEqCarA0S(predicate, consequent, alternative));
 }
Beispiel #7
0
 public static SCode Make(PrimitiveCombination2 predicate, SCode alternative)
 {
     return
         (predicate.Operand0 is Argument) ? POrIsEqA.Make (predicate, alternative) :
         (predicate.Operand0 is Quotation) ? POrIsEqQ.Make (predicate, alternative) :
         (predicate.Operand0 is StaticVariable) ? POrIsEqS.Make (predicate, alternative) :
         (predicate.Operand1 is Argument) ? POrIsEqXA.Make (predicate, alternative) :
         (predicate.Operand1 is Quotation) ? POrIsEqXQ.Make (predicate, alternative) :
         (predicate.Operand1 is StaticVariable) ? POrIsEqXS.Make (predicate, alternative) :
         new POrIsEq (predicate, alternative);
 }
Beispiel #8
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
        }
Beispiel #9
0
 public static new SCode Make(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         //(predicate.Operand1 is Argument) ? PCondIsEqA0A.Make (predicate, consequent, alternative) :
         //(predicate.Operand1 is Quotation) ? PCondIsEqA0Q.Make (predicate, consequent, alternative) :
         ((predicate.Operand1 is StaticVariable) ? PCondIsEqCarA0S.Make(predicate, consequent, alternative) :
          //(consequent is Argument) ? PCondIsEqA0XA.Make (predicate, (Argument) consequent, alternative) :
          //(consequent is Quotation) ? PCondIsEqA0XQ.Make (predicate, (Quotation) consequent, alternative) :
          //(consequent is StaticVariable) ? Unimplemented () :
          //(alternative is Argument) ? PCondIsEqA0XXA.Make (predicate, consequent, (Argument) alternative) :
          //(alternative is Quotation) ? PCondIsEqA0XXQ.Make (predicate, consequent, (Quotation) alternative) :
          //(alternative is StaticVariable) ? PCondIsEqA0XXS.Make (predicate, consequent, (StaticVariable) alternative) :
          new PCondIsEqCarA0(predicate, consequent, alternative));
 }
Beispiel #10
0
 public static new SCode Make(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         ((((PrimitiveCar)predicate.Operand0).Operand is Argument0) ? PCondIsEqCarA0.Make(predicate, consequent, alternative) :
          //(predicate.Operand0 is Argument0) ? PCondIsEqA0.Make (predicate, consequent, alternative) :
          //(predicate.Operand1 is Argument) ? PCondIsEqAA.Make (predicate, consequent, alternative) :
          //(predicate.Operand1 is Quotation) ? PCondIsEqAQ.Make (predicate, consequent, alternative) :
          //(predicate.Operand1 is StaticVariable) ? PCondIsEqAS.Make (predicate, consequent, alternative) :
          //(consequent is Argument) ? PCondIsEqAXA.Make (predicate, (Argument) consequent, alternative) :
          //(consequent is Quotation) ? PCondIsEqAXQ.Make (predicate, (Quotation) consequent, alternative) :
          //(consequent is StaticVariable) ? Unimplemented () :
          //(alternative is Argument) ? PCondIsEqAXXA.Make (predicate, consequent, (Argument) alternative) :
          //(alternative is Quotation) ? PCondIsEqAXXQ.Make (predicate, consequent, (Quotation) alternative) :
          //(alternative is StaticVariable) ? Unimplemented () :
          new PCondIsEqCarA(predicate, consequent, alternative));
 }
Beispiel #11
0
 public static SCode Make (PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         (predicate.Operand0 is Argument) ? PCondIsEqA.Make (predicate, consequent, alternative) :
         (predicate.Operand0 is PrimitiveCar) ? PCondIsEqCar.Make (predicate, consequent, alternative) :
         (predicate.Operand0 is Quotation) ? PCondIsEqQ.Make (predicate, consequent, alternative) :
         (predicate.Operand0 is StaticVariable) ? PCondIsEqS.Make (predicate, consequent, alternative) :
         (predicate.Operand1 is Argument) ? PCondIsEqXA.Make (predicate, consequent, alternative) :
         (predicate.Operand1 is Quotation) ? PCondIsEqXQ.Make (predicate, consequent, alternative) :
         (predicate.Operand1 is StaticVariable) ? PCondIsEqXS.Make (predicate, consequent, alternative) :
         (consequent is Argument) ? PCondIsEqXXA.Make (predicate, (Argument) consequent, alternative) :
         (consequent is Quotation) ? PCondIsEqXXQ.Make (predicate, (Quotation) consequent, alternative) :
         (consequent is StaticVariable) ? Unimplemented () :
         (alternative is Argument) ? PCondIsEqXXXA.Make (predicate, consequent, (Argument) alternative) :
         (alternative is Quotation) ? PCondIsEqXXXQ.Make (predicate, consequent, (Quotation) alternative) :
         (alternative is StaticVariable) ? Unimplemented () :
         new PCondIsEq (predicate, consequent, alternative);
 }
Beispiel #12
0
 public static SCode Make (PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         //(predicate is PrimitiveGreaterThanFixnum) ? PCondGreaterThanFixnum.Make ((PrimitiveGreaterThanFixnum) predicate, consequent, alternative) :
         (predicate is PrimitiveIsEq) ? PCondIsEq.Make ((PrimitiveIsEq) predicate, consequent, alternative) :
         //(predicate is PrimitiveLessThanFixnum) ? PCondLessThanFixnum.Make ((PrimitiveLessThanFixnum) predicate, consequent, alternative) :
         //(predicate is PrimitiveIsObjectType) ? PCondIsObjectType.Make ((PrimitiveIsObjectType) predicate, consequent, alternative) :
         //(predicate is PrimitiveRecordRef) ? PCondRecordRef.Make ((PrimitiveRecordRef) predicate, consequent, alternative) :
         //(predicate is PrimitiveVectorRef) ? PCondVectorRef.Make ((PrimitiveVectorRef) predicate, consequent, alternative) :
         (predicate.Operand0 is Argument) ? PCond2A.Make (predicate, consequent, alternative) :
         (predicate.Operand0 is Quotation) ? PCond2Q.Make (predicate, consequent, alternative) :
         (predicate.Operand0 is StaticVariable) ? PCond2S.Make (predicate, consequent, alternative) :
         (predicate.Operand1 is Argument) ? PCond2XA.Make (predicate, consequent, alternative) :
         (predicate.Operand1 is Quotation) ? PCond2XQ.Make (predicate, consequent, alternative) :
         (predicate.Operand1 is StaticVariable) ? PCond2XS.Make (predicate, consequent, alternative) :
         (consequent is Argument) ? PCond2XXA.Make (predicate, (Argument) consequent, alternative) :
         (consequent is Quotation) ? PCond2XXQ.Make (predicate, (Quotation) consequent, alternative) :
         (consequent is StaticVariable) ? Unimplemented():
         (alternative is Argument) ? PCond2XXXA.Make (predicate, consequent, (Argument) alternative) :
         (alternative is Quotation) ? PCond2XXXQ.Make (predicate, consequent, (Quotation) alternative) :
         (alternative is StaticVariable) ? Unimplemented():
         new PCond2 (predicate, consequent, alternative);
 }
Beispiel #13
0
 protected PCond2SQXA0 (PrimitiveCombination2 predicate, SCode consequent, Argument0 alternative)
     : base (predicate, consequent, alternative)
 {
 }
Beispiel #14
0
 protected POrIsEqSA0(PrimitiveCombination2 predicate, SCode alternative)
     : base(predicate, alternative)
 {
 }
Beispiel #15
0
 public static SCode Make(PrimitiveCombination2 predicate, SCode alternative)
 {
     return
         (new POrIsEqSS(predicate, alternative));
 }
Beispiel #16
0
 public static SCode Make(PrimitiveCombination2 predicate, SCode alternative)
 {
     return
         ((((Quotation)predicate.Operand1).Quoted is int) ?  POrIsEqA0Int.Make(predicate, alternative) :
          new POrIsEqA0Q(predicate, alternative));
 }
Beispiel #17
0
 protected POrIsEqSA(PrimitiveCombination2 predicate, SCode alternative)
     : base(predicate, alternative)
 {
     this.rand1Offset = ((Argument)predicate.Operand1).Offset;
 }
Beispiel #18
0
 static SCode RewriteAsSameType(PrimitiveObjectType left, SCode right)
 {
     return(PrimitiveCombination2.Make(Primitive.IsSameType, left.Operand, right));
 }
Beispiel #19
0
 public static SCode Make(PrimitiveCombination2 predicate, SCode alternative)
 {
     return
         ((predicate.Operand1 is Quotation) ? POrIsEqSQ.Make(predicate, alternative) :
          new POrIsEqS(predicate, alternative));
 }
Beispiel #20
0
 protected PCondIsEqCarA(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
     this.rand0Offset = ((Argument)((PrimitiveCar)predicate.Operand0).Operand).Offset;
 }
Beispiel #21
0
 public static new SCode Make (PrimitiveCombination2 predicate, SCode consequent, Argument0 alternative)
 {
     return
         new PCond2SA0XA0 (predicate, consequent, alternative);
 }
Beispiel #22
0
 protected PCond2SQXA (PrimitiveCombination2 predicate, SCode consequent, Argument alternative)
     : base (predicate, consequent, alternative)
 {
     this.alternativeOffset = alternative.Offset;
 }
Beispiel #23
0
 public static new SCode Make (PrimitiveCombination2 predicate, SCode consequent, Argument alternative)
 {
     return
         (alternative is Argument0) ? PCond2SQXA0.Make (predicate, consequent, (Argument0) alternative) :
         new PCond2SQXA (predicate, consequent, alternative);
 }
Beispiel #24
0
 public static new SCode Make (PrimitiveCombination2 predicate, StaticVariable consequent, SCode alternative)
 {
     return
         (alternative is Argument) ? Unimplemented () :
         (alternative is Quotation) ? PCond2SQSQ.Make (predicate, consequent, (Quotation) alternative) :
         (alternative is StaticVariable) ? Unimplemented() : //PCond2SQQS.Make (predicate, consequent, (StaticVariable) alternative) :
         new PCond2SQS (predicate, consequent, alternative);
 }
Beispiel #25
0
 protected PCond2SQS (PrimitiveCombination2 predicate, StaticVariable consequent, SCode alternative)
     : base (predicate, consequent, alternative)
 {
     this.consequentName = consequent.Name;
     this.consequentOffset = consequent.Offset;
 }
Beispiel #26
0
 public static new SCode Make (PrimitiveCombination2 predicate, Quotation consequent, StaticVariable alternative)
 {
     return
         new PCond2SQQS (predicate, consequent, alternative);
 }
Beispiel #27
0
 protected PCond2SQQS (PrimitiveCombination2 predicate, Quotation consequent, StaticVariable alternative)
     : base (predicate, consequent, alternative)
 {
     this.alternativeName = alternative.Name;
     this.alternativeOffset = alternative.Offset;
 }
Beispiel #28
0
 public static new SCode Make (PrimitiveCombination2 predicate, Argument consequent, SCode alternative)
 {
     return
         (consequent is Argument0) ? PCond2A0SA0.Make (predicate, (Argument0) consequent, alternative) :
         (alternative is Argument) ? Unimplemented() :
         (alternative is Quotation) ? Unimplemented() :
         (alternative is StaticVariable) ? Unimplemented () :
         new PCond2A0SA (predicate, consequent, alternative);
 }
Beispiel #29
0
 protected PCond2SQQ (PrimitiveCombination2 predicate, Quotation consequent, SCode alternative)
     : base (predicate, consequent, alternative)
 {
     this.consequentValue = consequent.Quoted;
 }
Beispiel #30
0
 protected PCond2SQXQ (PrimitiveCombination2 predicate, SCode consequent, Quotation alternative)
     : base (predicate, consequent, alternative)
 {
     this.alternativeValue = alternative.Quoted;
 }
Beispiel #31
0
        internal object ReadObject(uint location)
        {
            object probe = null;

            if (this.sharingTable.TryGetValue(location, out probe) == true)
            {
                return(probe);
            }

            EncodedObject encoded =
                heapSection.Contains(location) ? heapSection [location]
                : constSection.Contains(location) ? constSection [location]
                : new EncodedObject(0);
            // Console.WriteLine ("{0}", encoded.TypeCode);
            object first = null;

            switch (encoded.TypeCode)
            {
            case TC.ACCESS:
                return(Access.Make(ReadObject(encoded.Datum),
                                   (Symbol)ReadObject(encoded.Datum + 4)));

            case TC.ASSIGNMENT:
                return(ReadAssignment(encoded.Datum));

            case TC.BIG_FIXNUM:
                return(ReadBignum(encoded.Datum));

            case TC.BIG_FLONUM:
                return(ReadBigFlonum(encoded.Datum));

            case TC.CHARACTER:
                return((char)(encoded.Datum));

            case TC.CHARACTER_STRING:
                return(heapSection.ReadString(encoded.Datum));

            case TC.COMBINATION:
                return(Combination.Make(ReadVector(encoded.Datum)));

            case TC.COMBINATION_1:
                return(Combination1.Make(ReadObject(encoded.Datum),
                                         ReadObject(encoded.Datum + 4)));

            case TC.COMBINATION_2:
                return(Combination2.Make(ReadObject(encoded.Datum),
                                         ReadObject(encoded.Datum + 4),
                                         ReadObject(encoded.Datum + 8)));

            case TC.COMMENT:
                return(Comment.Make(ReadObject(encoded.Datum),
                                    ReadObject(encoded.Datum + 4)));

            case TC.COMPLEX:
                return(new Complex(ReadObject(encoded.Datum),
                                   ReadObject(encoded.Datum + 4)));

            case TC.CONDITIONAL:
                return(Conditional.Make(ReadObject(encoded.Datum),
                                        ReadObject(encoded.Datum + 4),
                                        ReadObject(encoded.Datum + 8)));

            case TC.CONSTANT:
                return(Constant.Decode(encoded.Datum));

            case TC.DEFINITION:
                return(Definition.Make((Symbol)ReadObject(encoded.Datum),
                                       ReadObject(encoded.Datum + 4)));

            case TC.DELAY:
                return(Delay.Make(ReadObject(encoded.Datum)));

            case TC.DISJUNCTION:
                return(Disjunction.Make(ReadObject(encoded.Datum),
                                        ReadObject(encoded.Datum + 4)));

            case TC.EXTENDED_LAMBDA:
                return(ReadExtendedLambda(encoded.Datum));

            case TC.FIXNUM:
                return(encoded.Datum > 0x02000000
                           ? (int)-(0x04000000 - encoded.Datum)
                           : (int)encoded.Datum);

            case TC.INTERNED_SYMBOL:
                return(Symbol.Make(new String((char [])ReadObject(encoded.Datum))));

            case TC.LAMBDA:
                Symbol    name;
                Symbol [] formals;
                ReadFormals(encoded.Datum + 4, out name, out formals);
                return(Lambda.Make(name, formals, SCode.EnsureSCode(ReadObject(encoded.Datum))));

            case TC.LIST:
                object second = ReadObject(encoded.Datum + 4);
                return(new Cons(ReadObject(encoded.Datum),
                                second == sharpF ? null : second));

            case TC.NULL:
                if (encoded.Datum != 0)
                {
                    throw new NotImplementedException();
                }
                return(sharpF);

            case TC.PCOMB0:
                return(PrimitiveCombination0.Make((Primitive0)primSection[encoded.Datum]));

            case TC.PCOMB1:
                return(PrimitiveCombination1.Make((Primitive1)ReadObject(encoded.Datum),
                                                  ReadObject(encoded.Datum + 4)));

            case TC.PCOMB2:
                return(PrimitiveCombination2.Make((Primitive2)ReadObject(encoded.Datum),
                                                  ReadObject(encoded.Datum + 4),
                                                  ReadObject(encoded.Datum + 8)));

            case TC.PCOMB3:
                return(PrimitiveCombination3.Make((Primitive3)ReadObject(encoded.Datum + 4),
                                                  ReadObject(encoded.Datum + 8),
                                                  ReadObject(encoded.Datum + 12),
                                                  ReadObject(encoded.Datum + 16)));

            case TC.PRIMITIVE:
                return(primSection [encoded.Datum]);

            case TC.REFERENCE_TRAP:
                if (encoded.Datum == 0)
                {
                    return(ReferenceTrap.Unassigned);
                }
                else
                {
                    throw new NotImplementedException();
                }
            // return ReferenceTrap.Make (encoded.Datum);

            case TC.RATNUM:
                return(new Ratnum(ReadObject(encoded.Datum),
                                  ReadObject(encoded.Datum + 4)));

            case TC.RETURN_CODE:
                return((ReturnCode)(encoded.Datum));

            case TC.SEQUENCE_2:
                return(Sequence2.Make(ReadObject(encoded.Datum),
                                      ReadObject(encoded.Datum + 4)));

            case TC.SEQUENCE_3:
                // Chains of sequence_3 can be arbitrarily long.
                // Unfortunately, the CLR puts a strict limit on
                // the stack, so we have to do this funky thing.
                Cons sequenceStack = null;
                while (true)
                {
                    // read the first two elements
                    object s1 = ReadObject(encoded.Datum);
                    sequenceStack = new Cons(s1, sequenceStack);
                    object s2 = ReadObject(encoded.Datum + 4);
                    sequenceStack = new Cons(s2, sequenceStack);

                    // peek at the third

                    EncodedObject sencoded =
                        heapSection.Contains(encoded.Datum + 8) ? heapSection [encoded.Datum + 8]
                           : constSection.Contains(encoded.Datum + 8) ? constSection [encoded.Datum + 8]
                           : new EncodedObject(0);

                    if (sencoded.TypeCode == TC.SEQUENCE_3)
                    {
                        encoded = sencoded;
                    }
                    else
                    {
                        // found the end of the chain!
                        object tail = ReadObject(encoded.Datum + 8);
                        while (sequenceStack != null)
                        {
                            object ob2 = sequenceStack.Car;
                            sequenceStack = (Cons)sequenceStack.Cdr;
                            object ob1 = sequenceStack.Car;
                            sequenceStack = (Cons)sequenceStack.Cdr;
                            tail          = Sequence3.Make(ob1, ob2, tail);
                        }
                        return(tail);
                    }
                }


            case TC.THE_ENVIRONMENT:
                return(TheEnvironment.Make());

            case TC.UNINTERNED_SYMBOL:
                // KLUDGE!!  Make sure that all uninterned strings within a file
                // keep their identity when read.
                // Also, postpend a unique number so we can tell these apart.
                first = ReadObject(encoded.Datum);
                if (first is Symbol)
                {
                    return(first);
                }
                else
                {
                    Symbol result = Symbol.MakeUninterned("#:" + new String((char [])first) + "-" + (gensymCounter++).ToString(CultureInfo.InvariantCulture));
                    this.sharingTable.Add(encoded.Datum, result);
                    return(result);
                }

            case TC.VARIABLE:
                return(Variable.Make((Symbol)ReadObject(encoded.Datum)));

            case TC.VECTOR:
                return(ReadVector(encoded.Datum));

            default:
                throw new NotImplementedException();
            }
        }
Beispiel #32
0
 public static new SCode Make (PrimitiveCombination2 predicate, SCode consequent, Quotation alternative)
 {
     return
         new PCond2SQXQ (predicate, consequent, alternative);
 }
Beispiel #33
0
 public static new SCode Make (PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         (predicate.Operand1 is Argument0) ? PCond2SA0.Make (predicate, consequent, alternative) :
         (consequent is Argument) ? Unimplemented():
         (consequent is Quotation) ? Unimplemented () :
         (consequent is StaticVariable) ? Unimplemented () :
         (alternative is Argument) ? Unimplemented () :
         (alternative is Quotation) ? PCond2SAXQ.Make (predicate, consequent, (Quotation) alternative) :
         (alternative is StaticVariable) ? Unimplemented () :
         new PCond2SA (predicate, consequent, alternative);
 }
Beispiel #34
0
        public static bool ObjectSetType(out object answer, object arg0, object arg1)
        {
            TC newType = (TC)(int)arg0;

            // kludge!!!!
            if ((int)arg0 == 0 && (int)arg1 == 1)
            {
                answer = new NullEnvironment();
            }
            else
            {
                switch (newType)
                {
                case TC.COMBINATION_2:
                    answer = Combination2.Make((Hunk3)arg1);
                    break;

                case TC.CONDITIONAL:
                    answer = Conditional.Make((Hunk3)arg1);
                    break;

                case TC.CONSTANT:
                    answer = Constant.Decode((uint)(int)arg1);
                    break;

                case TC.HUNK3_A:
                    // Probably someone trying to mark a history object.
                    answer = arg1;
                    break;

                case TC.HUNK3_B:
                    answer = arg1;
                    break;

                case TC.ENVIRONMENT:
                    object []       args       = (object[])arg1;
                    StandardClosure closure    = (StandardClosure)args [0];
                    object []       actualArgs = new object [args.Length - 1];
                    for (int i = 0; i < actualArgs.Length; i++)
                    {
                        actualArgs [i] = args [i + 1];
                    }
                    answer = new StandardEnvironment <StandardLambda, StandardClosure> (closure, actualArgs);
                    break;

                // throw new NotImplementedException ();
                //            // answer = (new InterpreterEnvironment ((object []) arg1));

                case TC.EXTENDED_LAMBDA:
                    answer = ExtendedLambda.Make((Hunk3)arg1);
                    break;

                case TC.PCOMB0:
                    answer = PrimitiveCombination0.Make((Primitive0)arg1);
                    break;

                case TC.PCOMB2:
                    answer = PrimitiveCombination2.Make((Hunk3)arg1);
                    break;

                case TC.PRIMITIVE:
                    if (!(arg1 is PrimitiveCombination0))
                    {
                        throw new NotImplementedException("Object-set-type on primitive");
                    }
                    answer = ((PrimitiveCombination0)arg1).Operator;
                    break;

                case TC.RECORD:
                    answer = new Record((object [])arg1);
                    return(false);

                case TC.SEQUENCE_3:
                    answer = new Sequence3((Hunk3)arg1);
                    break;

                case TC.THE_ENVIRONMENT:
                    answer = TheEnvironment.Make();
                    break;

                case TC.VARIABLE:
                    answer = Variable.Make((Hunk3)arg1);
                    break;

                case TC.VECTOR:
                    // Someone wants to see what endian we are!
                    char []   source = (char [])arg1;
                    object [] result = new object [source.Length / 4];
                    result [1] = ((((((byte)source [3]) * 256)
                                    + ((byte)source [2])) * 256)
                                  + ((byte)source [1])) * 256
                                 + ((byte)source [0]);
                    result [0] = ((((((byte)source [7]) * 256)
                                    + ((byte)source [6])) * 256)
                                  + ((byte)source [5])) * 256
                                 + ((byte)source [4]);
                    answer = result;
                    break;

                case TC.WEAK_CONS:
                    answer = new WeakCons(((Cons)arg1).Car, ((Cons)arg1).Cdr);
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
            return(false);
        }
Beispiel #35
0
 protected PCond2SA (PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
     : base (predicate, consequent, alternative)
 {
     this.rand1Offset = ((Argument) predicate.Operand1).Offset;
 }
Beispiel #36
0
 protected PCondIsEqCarA(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
     this.rand0Offset = ((Argument) ((PrimitiveCar) predicate.Operand0).Operand).Offset;
 }
Beispiel #37
0
 protected POrIsEqA0Int(PrimitiveCombination2 predicate, SCode alternative)
     : base(predicate, alternative)
 {
     this.rand1Value = (int)((Quotation)predicate.Operand1).Quoted;
 }
Beispiel #38
0
 public static new SCode Make(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
          (((PrimitiveCar) predicate.Operand0).Operand is Argument0) ? PCondIsEqCarA0.Make (predicate, consequent, alternative) :
         //(predicate.Operand0 is Argument0) ? PCondIsEqA0.Make (predicate, consequent, alternative) :
         //(predicate.Operand1 is Argument) ? PCondIsEqAA.Make (predicate, consequent, alternative) :
         //(predicate.Operand1 is Quotation) ? PCondIsEqAQ.Make (predicate, consequent, alternative) :
         //(predicate.Operand1 is StaticVariable) ? PCondIsEqAS.Make (predicate, consequent, alternative) :
         //(consequent is Argument) ? PCondIsEqAXA.Make (predicate, (Argument) consequent, alternative) :
         //(consequent is Quotation) ? PCondIsEqAXQ.Make (predicate, (Quotation) consequent, alternative) :
         //(consequent is StaticVariable) ? Unimplemented () :
         //(alternative is Argument) ? PCondIsEqAXXA.Make (predicate, consequent, (Argument) alternative) :
         //(alternative is Quotation) ? PCondIsEqAXXQ.Make (predicate, consequent, (Quotation) alternative) :
         //(alternative is StaticVariable) ? Unimplemented () :
         new PCondIsEqCarA (predicate, consequent, alternative);
 }
Beispiel #39
0
 public static SCode Make(PrimitiveCombination2 predicate, SCode alternative)
 {
     return
         ((predicate.Operand1 is Argument0) ? POrIsEqSA0.Make(predicate, alternative) :
          new POrIsEqSA(predicate, alternative));
 }
Beispiel #40
0
 protected PCondIsEqCarA0(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
 }
Beispiel #41
0
 protected POrIsEqSS(PrimitiveCombination2 predicate, SCode alternative)
     : base(predicate, alternative)
 {
     this.rand1Name   = ((StaticVariable)predicate.Operand1).Name;
     this.rand1Offset = ((StaticVariable)predicate.Operand1).Offset;
 }
Beispiel #42
0
 public static new SCode Make(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         //(predicate.Operand1 is Argument) ? PCondIsEqA0A.Make (predicate, consequent, alternative) :
         //(predicate.Operand1 is Quotation) ? PCondIsEqA0Q.Make (predicate, consequent, alternative) :
         (predicate.Operand1 is StaticVariable) ? PCondIsEqCarA0S.Make (predicate, consequent, alternative) :
         //(consequent is Argument) ? PCondIsEqA0XA.Make (predicate, (Argument) consequent, alternative) :
         //(consequent is Quotation) ? PCondIsEqA0XQ.Make (predicate, (Quotation) consequent, alternative) :
         //(consequent is StaticVariable) ? Unimplemented () :
         //(alternative is Argument) ? PCondIsEqA0XXA.Make (predicate, consequent, (Argument) alternative) :
         //(alternative is Quotation) ? PCondIsEqA0XXQ.Make (predicate, consequent, (Quotation) alternative) :
         //(alternative is StaticVariable) ? PCondIsEqA0XXS.Make (predicate, consequent, (StaticVariable) alternative) :
         new PCondIsEqCarA0 (predicate, consequent, alternative);
 }
Beispiel #43
0
 protected POrIsEqQ(PrimitiveCombination2 predicate, SCode alternative)
     : base(predicate, alternative)
 {
     this.rand0Value = ((Quotation)predicate.Operand0).Quoted;
 }
Beispiel #44
0
 public static new SCode Make (PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         (consequent is Argument) ? PCond2SQA.Make (predicate, (Argument) consequent, alternative) :
         (consequent is Quotation) ? PCond2SQQ.Make (predicate, (Quotation) consequent, alternative) :
         (consequent is StaticVariable) ? PCond2SQS.Make (predicate, (StaticVariable) consequent, alternative) :
         (alternative is Argument) ? PCond2SQXA.Make (predicate, consequent, (Argument) alternative) :
         (alternative is Quotation) ? PCond2SQXQ.Make (predicate, consequent, (Quotation) alternative) :
         (alternative is StaticVariable) ? PCond2SQXS.Make (predicate, consequent, (StaticVariable) alternative) :
         new PCond2SQ (predicate, consequent, alternative);
 }
 static SCode BuildGCC(SCode rand, int code)
 {
     Debug.Write("\n; => GeneralCarCdr " + code.ToString());
     return(PrimitiveCombination2.Make(Primitive.GeneralCarCdr, rand, Quotation.Make(code)));
 }
Beispiel #46
0
 protected PCond2SQ (PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
     : base (predicate, consequent, alternative)
 {
     this.rand1Value = ((Quotation) predicate.Operand1).Quoted;
 }
Beispiel #47
0
 public static new SCode Make(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         ((((PrimitiveCar)predicate.Operand0).Operand is Argument) ? PCondIsEqCarA.Make(predicate, consequent, alternative) :
          new PCondIsEqCar(predicate, consequent, alternative));
 }
Beispiel #48
0
 protected PCond2A0SA (PrimitiveCombination2 predicate, Argument consequent, SCode alternative)
     : base (predicate, consequent, alternative)
 {
     this.consequentOffset = consequent.Offset;
 }
Beispiel #49
0
 protected PCondIsEqCarA0(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
 }
Beispiel #50
0
 protected PCondIsEqCarA0S(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
     this.rand1Name = ((StaticVariable) predicate.Operand1).Name;
     this.rand1Offset = ((StaticVariable) predicate.Operand1).Offset;
 }
Beispiel #51
0
 protected PCondIsEqCarA0S(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
     this.rand1Name   = ((StaticVariable)predicate.Operand1).Name;
     this.rand1Offset = ((StaticVariable)predicate.Operand1).Offset;
 }
Beispiel #52
0
 public static new SCode Make(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         //(consequent is Argument) ? PCondIsEqA0SA.Make (predicate, (Argument) consequent, alternative) :
         //(consequent is Quotation) ? PCondIsEqA0SQ.Make (predicate, (Quotation) consequent, alternative) :
         //(consequent is StaticVariable) ? PCondIsEqA0SS.Make (predicate, (StaticVariable) consequent, alternative) :
         //(alternative is Argument) ? PCondIsEqA0SXA.Make (predicate, consequent, (Argument) alternative) :
         //(alternative is Quotation) ? PCondIsEqA0SXQ.Make (predicate, consequent, (Quotation) alternative) :
         //(alternative is StaticVariable) ? PCondIsEqA0SXS.Make (predicate, consequent, (StaticVariable) alternative) :
         new PCondIsEqCarA0S (predicate, consequent, alternative);
 }
Beispiel #53
0
 public static new SCode Make(PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         (((PrimitiveCar) predicate.Operand0).Operand is Argument) ? PCondIsEqCarA.Make (predicate, consequent, alternative) :
         new PCondIsEqCar (predicate, consequent, alternative);
 }
Beispiel #54
0
 public static new SCode Make (PrimitiveCombination2 predicate, SCode consequent, SCode alternative)
 {
     return
         (consequent is Argument) ? PCond2SA0A.Make (predicate, (Argument) consequent, alternative) :
         (consequent is Quotation) ? PCond2SA0Q.Make (predicate, (Quotation) consequent, alternative) :
         (consequent is StaticVariable) ? PCond2SA0S.Make (predicate, (StaticVariable) consequent, alternative) :
         (alternative is Argument) ? PCond2SA0XA.Make (predicate, consequent, (Argument) alternative) :
         (alternative is Quotation) ? PCond2SA0XQ.Make (predicate, consequent, (Quotation) alternative) :
         (alternative is StaticVariable) ? Unimplemented () :
         new PCond2SA0 (predicate, consequent, alternative);
 }