Exemplo n.º 1
0
 public FaslFile(FaslHeader faslHeader, FaslSection heapSection, FaslSection constSection, Primitive [] primSection, FaslSection cSection)
 {
     this.faslHeader = faslHeader;
     this.heapSection = heapSection;
     this.constSection = constSection;
     this.primSection = primSection;
     this.cSection = cSection;
     this.sharingTable = new Dictionary<uint, object> ();
 }
Exemplo n.º 2
0
        public static Primitive[] LoadPrimitives(BinaryReader binaryReader, uint sectionBase, UInt32 count, UInt32 nPrims)
        {
            EncodedObject [] sectionContents = new EncodedObject [count];
            for (int i = 0; i < count; i++)
                sectionContents [i] = new EncodedObject (binaryReader.ReadUInt32 ());

            Primitive [] primitives = new Primitive [nPrims];
            uint offset = sectionBase;
            for (uint i = 0; i < primitives.Length; i++)
            {
                EncodedObject arity = sectionContents [offset / 4];
                offset += 4;
                uint stringLength = sectionContents [(offset / 4) + 1].Datum;
                char [] result = new char [stringLength];
                for (uint j = 0; j < stringLength; j++)
                {
                    EncodedObject encoded = sectionContents [(offset + 8 + j) / 4];
                    result [j] = (char) encoded.GetByte ((byte) ((offset + 8 + j) % 4));
                }
                string name = new string (result);

                offset += (sectionContents [offset / 4].Datum) * 4;
                offset += 4;
                primitives [i] = Primitive.Find (name, arity.Datum == 0x03ffffff ? -1 : (int) arity.Datum);
            }
            return primitives;
        }
 static bool isFoldableCxr(SCode form, Primitive prim)
 {
     return Configuration.EnableFoldCarCdr &&
         ((form is PrimitiveCombination1 && ((PrimitiveCombination1) form).Operator == prim) ||
          (form is PrimitiveCombination2 &&
          ((PrimitiveCombination2) form).Rator == prim &&
          ((PrimitiveCombination2) form).Rand1 is Quotation));
 }