//static SCode InvertConditional (PrimitiveNot predicate, SCode SCode alternative) //{ // //Debug.Write ("\n; InvertConditional"); // return Conditional.Make (predicate.Operand, alternative, consequent); //} public static SCode Make(PrimitiveCombination1 predicate, SCode alternative) { return ((predicate.Operator == Primitive.IsBigFixnum) ? POrIsType <long> .Make(predicate, alternative) : (predicate.Operator == Primitive.IsBigFlonum) ? POrIsType <double> .Make(predicate, alternative) : (predicate.Operator == Primitive.IsComplex) ? POrIsType <Complex> .Make(predicate, alternative) : (predicate.Operator == Primitive.IsFixnum) ? POrIsType <int> .Make(predicate, alternative) : (predicate.Operator == Primitive.IsPair) ? POrIsType <Cons> .Make(predicate, alternative) : (predicate.Operator == Primitive.IsRatnum) ? POrIsType <Ratnum> .Make(predicate, alternative) : (predicate.Operator == Primitive.IsString) ? POrIsType <char []> .Make(predicate, alternative) : //(Configuration.EnableInvertConditional && predicate is PrimitiveNot) ? InvertConditional ((PrimitiveNot) predicate, alternative) : //(predicate is PrimitiveCdr) ? Unimplemented() : //(predicate is PrimitiveIsSymbol) ? POrIsSymbol.Make ((PrimitiveIsSymbol) predicate, alternative) : //(predicate is PrimitiveIsType<long>) ? POrIsType<long>.Make ((PrimitiveIsType<long>) predicate, alternative) : //(predicate is PrimitiveIsType<double>) ? POrIsType<double>.Make ((PrimitiveIsType<double>) predicate, alternative) : //(predicate is PrimitiveIsType<Complex>) ? POrIsType<Complex>.Make ((PrimitiveIsType<Complex>) predicate, alternative) : //(predicate is PrimitiveIsType<char>) ? POrIsType<char>.Make ((PrimitiveIsType<char>) predicate, alternative) : //(predicate is PrimitiveIsType<int>) ? POrIsType<int>.Make ((PrimitiveIsType<int>) predicate, alternative) : //(predicate is PrimitiveIsNegative) ? POrIsNegative.Make ((PrimitiveIsNegative) predicate, alternative) : //(predicate is PrimitiveIsNull) ? POrIsNull.Make ((PrimitiveIsNull) predicate, alternative) : //(predicate is PrimitiveIsType<Cons>) ? POrIsType<Cons>.Make ((PrimitiveIsType<Cons>) predicate, alternative) : //(predicate is PrimitiveIsType<Primitive>) ? POrIsType<Primitive>.Make ((PrimitiveIsType<Primitive>) predicate, alternative) : //(predicate is PrimitiveIsType<Ratnum>) ? POrIsType<Ratnum>.Make ((PrimitiveIsType<Ratnum>) predicate, alternative) : //(predicate is PrimitiveIsType<Record>) ? POrIsType<Record>.Make ((PrimitiveIsType<Record>) predicate, alternative) : //(predicate is PrimitiveIsType<object []>) ? POrIsType<object []>.Make ((PrimitiveIsType<object[]>) predicate, alternative) : //(predicate is PrimitiveCombination1Q) ? Unimplemented () : (predicate.Operand is Argument) ? POr1A.Make(predicate, alternative) : (predicate.Operand is Quotation) ? Unimplemented() : (predicate.Operand is StaticVariable) ? POr1S.Make(predicate, alternative) : //(consequent is Quotation) ? POr1SQ.Make (predicate, (Quotation) alternative) : //(alternative is Quotation) ? POr1SSQ.Make (predicate, (Quotation) alternative) : new POr1(predicate, alternative)); }
public static SCode Make(PrimitiveCombination1 predicate, SCode consequent, SCode alternative) { return (Configuration.EnableCodeRewriting && Configuration.EnableInvertConditional && predicate is PrimitiveNot) ? InvertConditional ((PrimitiveNot) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveCar) ? PCondCar.Make ((PrimitiveCar) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<long>) ? PCondIsType<long>.Make ((PrimitiveIsType<long>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<double>) ? PCondIsType<double>.Make ((PrimitiveIsType<double>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<Complex>) ? PCondIsType<Complex>.Make ((PrimitiveIsType<Complex>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<char>) ? PCondIsType<char>.Make ((PrimitiveIsType<char>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<char []>) ? PCondIsType<char []>.Make ((PrimitiveIsType<char []>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<int>) ? PCondIsType<int>.Make ((PrimitiveIsType<int>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsNull) ? PCondIsNull.Make ((PrimitiveIsNull) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<Cons>) ? PCondIsType<Cons>.Make ((PrimitiveIsType<Cons>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<Entity>) ? PCondIsType<Entity>.Make ((PrimitiveIsType<Entity>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<Ratnum>) ? PCondIsType<Ratnum>.Make ((PrimitiveIsType<Ratnum>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<Record>) ? PCondIsType<Record>.Make ((PrimitiveIsType<Record>) predicate, consequent, alternative) : ////(predicate is PrimitiveIsSymbol) ? PCondIsSymbol.Make ((PrimitiveIsSymbol) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<object []>) ? PCondIsType<object []>.Make ((PrimitiveIsType<object []>) predicate, consequent, alternative) : (Configuration.EnableInlinePCond1 && predicate is PrimitiveIsType<WeakCons>) ? PCondIsType<WeakCons>.Make ((PrimitiveIsType<WeakCons>) predicate, consequent, alternative) : (predicate.Operand is Argument) ? PCond1A.Make (predicate, consequent, alternative) : (predicate.Operand is Quotation) ? PCond1Q.Make (predicate, consequent, alternative) : (predicate.Operand is StaticVariable) ? PCond1S.Make (predicate, consequent, alternative) : (consequent is Argument) ? PCond1XA.Make (predicate, (Argument) consequent, alternative) : (consequent is Quotation) ? PCond1XQ.Make (predicate, (Quotation) consequent, alternative) : (consequent is StaticVariable) ? PCond1XS.Make (predicate, (StaticVariable) consequent, alternative) : (alternative is Argument) ? PCond1XXA.Make (predicate, consequent, (Argument) alternative) : (alternative is Quotation) ? PCond1XXQ.Make (predicate, consequent, (Quotation) alternative) : (alternative is StaticVariable) ? PCond1XXS.Make (predicate, consequent, (StaticVariable) alternative) : new PCond1 (predicate, consequent, alternative); }
public static SCode Make(PrimitiveCombination1 predicate, SCode alternative) { return //(predicate is PrimitiveIsTypeA<SType>) ? POrIsTypeA<SType>.Make((PrimitiveIsTypeA<SType>)predicate, alternative) : ((predicate.Operand is Argument) ? POrIsTypeA <SType> .Make(predicate, alternative) : (predicate.Operand is Quotation) ? Unimplemented(): (predicate.Operand is StaticVariable) ? POrIsTypeS <SType> .Make(predicate, alternative) : new POrIsType <SType>(predicate, alternative)); }
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 }
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 }
public static SCode Make(Primitive2 rator, Quotation rand0, SCode rand1) { TC code = (TC)rand0.Quoted; return ((!Configuration.EnableObjectTypePrimitives) ? new PrimitiveIsObjectTypeQ(rator, rand0, rand1) : (code == TC.BIG_FIXNUM) ? PrimitiveCombination1.Make(Primitive.IsBigFixnum, rand1) : (code == TC.BIG_FLONUM) ? PrimitiveCombination1.Make(Primitive.IsBigFlonum, rand1) : (code == TC.COMPILED_ENTRY) ? PrimitiveCombination1.Make(Primitive.IsCompiledEntry, rand1) : (code == TC.COMPLEX) ? PrimitiveCombination1.Make(Primitive.IsComplex, rand1) : (code == TC.ENTITY) ? PrimitiveCombination1.Make(Primitive.IsEntity, rand1) : (code == TC.FIXNUM) ? PrimitiveCombination1.Make(Primitive.IsFixnum, rand1) : (code == TC.INTERNED_SYMBOL) ? PrimitiveCombination1.Make(Primitive.IsSymbol, rand1) : (code == TC.RATNUM) ? PrimitiveCombination1.Make(Primitive.IsRatnum, rand1) : (code == TC.UNINTERNED_SYMBOL) ? PrimitiveCombination1.Make(Primitive.IsUninternedSymbol, rand1) : (code == TC.VECTOR) ? PrimitiveCombination1.Make(Primitive.IsVector, rand1) : (code == TC.WEAK_CONS) ? PrimitiveCombination1.Make(Primitive.IsWeakCons, rand1) : //(rand1 is Quotation) ? PrimitiveIsObjectTypeQQ.Make (rator, rand0, (Quotation) rand1) : (rand1 is Argument) ? PrimitiveIsObjectTypeQA.Make(rator, rand0, (Argument)rand1) : new PrimitiveIsObjectTypeQ(rator, rand0, rand1)); }
protected PCond1A0XA(PrimitiveCombination1 predicate, SCode consequent, Argument alternative) : base(predicate, consequent, alternative) { this.alternativeOffset = alternative.Offset; }
public static new SCode Make(PrimitiveCombination1 predicate, SCode consequent, Argument alternative) { return (alternative is Argument0) ? PCond1A0XA0.Make (predicate, consequent, (Argument0) alternative) : new PCond1A0XA (predicate, consequent, alternative); }
public static new SCode Make(PrimitiveCombination1 predicate, Quotation consequent, Quotation alternative) { #if DEBUG if (consequent.Quoted == alternative.Quoted) Debugger.Break(); #endif return new PCond1XQQ (predicate, consequent, alternative); }
protected PCond1Q(PrimitiveCombination1 predicate, SCode consequent, SCode alternative) : base(predicate, consequent, alternative) { this.predicateArgumentValue = ((Quotation) predicate.Operand).Quoted; }
public static new SCode Make(PrimitiveCombination1 predicate, SCode consequent, StaticVariable alternative) { return new PCond1A0XS (predicate, consequent, alternative); }
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(); } }
protected PCond1A0A(PrimitiveCombination1 predicate, Argument consequent, SCode alternative) : base(predicate, consequent, alternative) { this.consequentOffset = consequent.Offset; }
public static new SCode Make(PrimitiveCombination1 predicate, SCode consequent, Quotation alternative) { return new PCond1A0XQ (predicate, consequent, alternative); }
public static new SCode Make(PrimitiveCombination1 predicate, SCode consequent, Argument0 alternative) { return new PCondCarA0XA0 (predicate, consequent, alternative); }
public static new SCode Make(PrimitiveCombination1 predicate, Argument consequent, SCode alternative) { return (consequent is Argument0) ? PCond1XA0.Make (predicate, (Argument0) consequent, alternative) : new PCond1XA (predicate, consequent, alternative); }
public static new SCode Make(PrimitiveCombination1 predicate, SCode consequent, SCode alternative) { return //(consequent is Argument) ? PCond1A0A.Make (predicate, (Argument) consequent, alternative) : //(consequent is Quotation) ? PCond1A0Q.Make (predicate, (Quotation) consequent, alternative) : //(consequent is StaticVariable) ? PCond1A0S.Make (predicate, (StaticVariable) consequent, alternative) : (alternative is Argument) ? PCondCarA0XA.Make (predicate, consequent, (Argument) alternative) : (alternative is Quotation) ? PCondCarA0XQ.Make (predicate, consequent, (Quotation) alternative) : //(alternative is StaticVariable) ? PCond1A0XS.Make (predicate, consequent, (StaticVariable) alternative) : new PCondCarA0 (predicate, consequent, alternative); }
protected PCondCarA0(PrimitiveCombination1 predicate, SCode consequent, SCode alternative) : base(predicate, consequent, alternative) { }
protected PCondCarA(PrimitiveCombination1 predicate, SCode consequent, SCode alternative) : base(predicate, consequent, alternative) { this.predicateArgumentOffset = ((Argument) predicate.Operand).Offset; }
protected PCond1A0XA0(PrimitiveCombination1 predicate, SCode consequent, Argument0 alternative) : base(predicate, consequent, alternative) { }
public static new SCode Make(PrimitiveCombination1 predicate, Argument consequent, SCode alternative) { return (consequent is Argument0) ? PCond1A0A0.Make (predicate, (Argument0) consequent, alternative) : //(alternative is Quotation) ? PCond1A1XQ.Make (predicate, consequent, (Quotation) alternative) : new PCond1A0A (predicate, consequent, alternative); }
protected PCond1A0XQ(PrimitiveCombination1 predicate, SCode consequent, Quotation alternative) : base(predicate, consequent, alternative) { this.alternativeValue = alternative.Quoted; }
public static new SCode Make(PrimitiveCombination1 predicate, SCode consequent, SCode alternative) { return (predicate.Operand is Argument0) ? PCond1A0.Make (predicate, consequent, alternative) : (consequent is Argument) ? PCond1AA.Make (predicate, (Argument) consequent, alternative) : (consequent is Quotation) ? PCond1AQ.Make (predicate, (Quotation) consequent, alternative) : (consequent is StaticVariable) ? PCond1AS.Make (predicate, (StaticVariable) consequent, alternative) : (alternative is Argument) ? PCond1AXA.Make (predicate, consequent, (Argument) alternative) : (alternative is Quotation) ? PCond1AXQ.Make (predicate, consequent, (Quotation) alternative): new PCond1A (predicate, consequent, alternative); }
protected PCond1A0XS(PrimitiveCombination1 predicate, SCode consequent, StaticVariable alternative) : base(predicate, consequent, alternative) { this.alternativeName = alternative.Name; this.alternativeOffset = alternative.Offset; }
public static new SCode Make(PrimitiveCombination1 predicate, SCode consequent, SCode alternative) { return //(predicate.Operand is A0) ? PCond1A0.Make ((PrimitiveCombination1A0) predicate, consequent, alternative) : //(predicate.Operand is A1) ? PCond1A1.Make ((PrimitiveCombination1A1) predicate, consequent, alternative) : (consequent is Argument) ? PCond1SA.Make (predicate, (Argument) consequent, alternative) : (consequent is Quotation) ? PCond1SQ.Make (predicate, (Quotation) consequent, alternative) : (consequent is StaticVariable) ? PCond1SS.Make (predicate, (StaticVariable) consequent, alternative) : (alternative is Quotation) ? PCond1SXQ.Make (predicate, consequent, (Quotation) alternative) : (alternative is StaticVariable) ? PCond1SXS.Make (predicate, consequent, (StaticVariable) alternative) : new PCond1S (predicate, consequent, alternative); }
static SCode Rewrite(TC oldType, Primitive1 newPred, SCode arg) { Debug.Write("\n; Flatten (object-type? => " + newPred.Name); return(PrimitiveCombination1.Make(newPred, arg)); }
protected POrIsTypeA(PrimitiveCombination1 predicate, SCode alternative) : base(predicate, alternative) { this.predicateOffset = ((Argument)predicate.Operand).Offset; }
protected POrIsTypeA0(PrimitiveCombination1 predicate, SCode alternative) : base(predicate, alternative) { }
public static new SCode Make(PrimitiveCombination1 predicate, Quotation consequent, SCode alternative) { return (alternative is Quotation) ? PCond1XQQ.Make (predicate, consequent, (Quotation) alternative) : new PCond1XQ (predicate, consequent, alternative); }
public static new SCode Make(PrimitiveCombination1 predicate, Argument0 consequent, SCode alternative) { return new PCond1A0A0 (predicate, consequent, alternative); }
protected PCond1S(PrimitiveCombination1 predicate, SCode consequent, SCode alternative) : base(predicate, consequent, alternative) { this.predicateRandName = ((StaticVariable) predicate.Operand).Name; this.predicateRandOffset = ((StaticVariable) predicate.Operand).Offset; }
protected POrIsTypeS(PrimitiveCombination1 predicate, SCode alternative) : base(predicate, alternative) { this.predicateName = ((StaticVariable)predicate.Operand).Name; this.predicateOffset = ((StaticVariable)predicate.Operand).Offset; }
protected PCond1A0Q(PrimitiveCombination1 predicate, Quotation consequent, SCode alternative) : base(predicate, consequent, alternative) { this.consequentValue = consequent.Quoted; }
public static SCode Make(PrimitiveCombination1 predicate, SCode alternative) { return (new POrIsTypeS <SType> (predicate, alternative)); }
protected PCond1A0S(PrimitiveCombination1 predicate, StaticVariable consequent, SCode alternative) : base(predicate, consequent, alternative) { this.consequentName = consequent.Name; this.consequentOffset = consequent.Offset; }
public static SCode Make(PrimitiveCombination1 predicate, SCode alternative) { return ((predicate.Operand is Argument0) ? POrIsTypeA0 <SType> .Make(predicate, alternative) : new POrIsTypeA <SType>(predicate, alternative)); }
public static bool SystemPairCons(out object answer, object acode, object car, object cdr) { //TC typeCode = (TC) (int) acode; // for debugging porpoises switch ((TC)acode) { case TC.ACCESS: answer = Access.Make(car, (Symbol)cdr); break; case TC.ASSIGNMENT: answer = Assignment.Make(car, cdr); break; case TC.COMBINATION_1: answer = Combination1.Make(car, cdr); break; case TC.COMMENT: answer = Comment.Make(car, cdr); break; case TC.COMPLEX: answer = new Complex(car, cdr); break; case TC.DEFINITION: answer = Definition.Make((Symbol)car, cdr); break; case TC.DELAY: answer = new Delay(car, cdr); break; case TC.DISJUNCTION: answer = Disjunction.Make(car, cdr); break; case TC.ENTITY: answer = new Entity(car, cdr); break; case TC.LAMBDA: // passed in backwards. object [] names = (object [])cdr; object [] formals = new object [names.Length - 1]; Array.Copy(names, 1, formals, 0, formals.Length); SCode body = SCode.EnsureSCode(car); answer = Lambda.Make(names[0], formals, car); break; case TC.PCOMB1: answer = PrimitiveCombination1.Make((Primitive1)car, cdr); break; case TC.PROCEDURE: // Lambda had better be a `StandardLambda' because we are // constructing an closureEnvironment that needs to be first-class. Environment env = Environment.ToEnvironment(cdr); Lambda ulam = (Lambda)car; Lambda plam = (Lambda)ulam.PartialEval(PartialEnvironment.Make((ITopLevelEnvironment)env)).Residual; StandardLambda slam = (StandardLambda) new StandardLambda(plam.Name, plam.Formals, plam.Body, ulam.FreeVariables, plam.StaticMapping ); answer = new StandardClosure(slam, env); break; case TC.RATNUM: answer = new Ratnum(car, cdr); break; case TC.SCODE_QUOTE: answer = Quotation.Make(car); break; case TC.SEQUENCE_2: answer = Sequence2.Make(car, cdr); break; case TC.UNINTERNED_SYMBOL: // What gives? Uninterned strings are squirrely on the CLR. // We put them in a class object to have more control. answer = Symbol.MakeUninterned(new String((char [])car)); break; case TC.WEAK_CONS: answer = new WeakCons(car, cdr); break; default: throw new NotImplementedException(); } return(false); }