예제 #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> ();
 }
예제 #2
0
        internal static FaslFile Fasload(BinaryReader binaryReader)
        {
            FaslHeader  faslHeader   = FaslHeader.Load(binaryReader);
            FaslSection heapSection  = FaslSection.Load(binaryReader, Strip(faslHeader.heapBase), Strip(faslHeader.heapCount), faslHeader.heapCount);
            FaslSection constSection = FaslSection.Load(binaryReader, Strip(faslHeader.constBase), Strip(faslHeader.constCount), faslHeader.constCount);

            Primitive [] primTable = LoadPrimitives(binaryReader, 0, (uint)Strip(faslHeader.primSize), faslHeader.primLength);
            FaslSection  cTable    = FaslSection.Load(binaryReader, 0, Strip(faslHeader.cSize), faslHeader.cSize);

            return(new FaslFile(faslHeader, heapSection, constSection, primTable, cTable));
        }
예제 #3
0
        public static FaslHeader Load(BinaryReader binaryReader)
        {
            UInt32 magic = binaryReader.ReadUInt32();

            if (magic != FASL_FILE_MARKER)
            {
                throw new NotImplementedException();
            }
            UInt32     heapCount  = binaryReader.ReadUInt32() & DATUM_MASK;
            UInt32     heapBase   = binaryReader.ReadUInt32() & DATUM_MASK;
            UInt32     dumpedObj  = binaryReader.ReadUInt32() & DATUM_MASK; /* Where dumped object was */
            UInt32     constCount = binaryReader.ReadUInt32() & DATUM_MASK; /* Count of objects in const. area */
            UInt32     constBase  = binaryReader.ReadUInt32() & DATUM_MASK; /* Address of const. area at dump */
            UInt32     version    = binaryReader.ReadUInt32();              /* FASL format version info. */
            UInt32     stackTop   = binaryReader.ReadUInt32();              /* Top of stack when dumped */
            UInt32     primLength = binaryReader.ReadUInt32() & DATUM_MASK; /* Number of entries in primitive primitiveTable */
            UInt32     primSize   = binaryReader.ReadUInt32() & DATUM_MASK; /* Size of primitive primitiveTable in SCHEME_OBJECTs */
            UInt32     ciVersion  = binaryReader.ReadUInt32();              /* Version number for compiled code interface */
            UInt32     utBase     = binaryReader.ReadUInt32();              /* Address of the utilities vector */
            UInt32     checkSum   = binaryReader.ReadUInt32();              /* Header and data checksum. */
            UInt32     cLength    = binaryReader.ReadUInt32();              /* Number of entries in the C code primitiveTable */
            UInt32     cSize      = binaryReader.ReadUInt32() & DATUM_MASK; /* Size of C code primitiveTable in SCHEME_OBJECTs */
            UInt32     memBase    = binaryReader.ReadUInt32();
            FaslHeader header     = new FaslHeader(
                heapCount,
                heapBase,
                dumpedObj,
                constCount,
                constBase,
                version,
                stackTop,
                primLength,
                primSize,
                ciVersion,
                utBase,
                checkSum,
                cLength,
                cSize,
                memBase);

            for (int i = 16; i < FASL_HEADER_SIZE; i++)
            {
                UInt32 discard = binaryReader.ReadUInt32();
                if (discard != 0)
                {
                    throw new BadFaslFileException();
                }
            }
            return(header);
        }
예제 #4
0
 public static FaslHeader Load(BinaryReader binaryReader)
 {
     UInt32 magic = binaryReader.ReadUInt32 ();
     if (magic != FASL_FILE_MARKER)
         throw new NotImplementedException ();
     UInt32 heapCount = binaryReader.ReadUInt32 () & DATUM_MASK;
     UInt32 heapBase = binaryReader.ReadUInt32 () & DATUM_MASK;
     UInt32 dumpedObj = binaryReader.ReadUInt32 () & DATUM_MASK; /* Where dumped object was */
     UInt32 constCount = binaryReader.ReadUInt32 () & DATUM_MASK;        /* Count of objects in const. area */
     UInt32 constBase = binaryReader.ReadUInt32 () & DATUM_MASK; /* Address of const. area at dump */
     UInt32 version = binaryReader.ReadUInt32 ();        /* FASL format version info. */
     UInt32 stackTop = binaryReader.ReadUInt32 ();       /* Top of stack when dumped */
     UInt32 primLength = binaryReader.ReadUInt32 () & DATUM_MASK;     /* Number of entries in primitive primitiveTable */
     UInt32 primSize = binaryReader.ReadUInt32 () & DATUM_MASK;  /* Size of primitive primitiveTable in SCHEME_OBJECTs */
     UInt32 ciVersion = binaryReader.ReadUInt32 ();      /* Version number for compiled code interface */
     UInt32 utBase = binaryReader.ReadUInt32 (); /* Address of the utilities vector */
     UInt32 checkSum = binaryReader.ReadUInt32 ();               /* Header and data checksum. */
     UInt32 cLength = binaryReader.ReadUInt32 ();        /* Number of entries in the C code primitiveTable */
     UInt32 cSize = binaryReader.ReadUInt32 () & DATUM_MASK;     /* Size of C code primitiveTable in SCHEME_OBJECTs */
     UInt32 memBase = binaryReader.ReadUInt32 ();
     FaslHeader header = new FaslHeader (
                                         heapCount,
                                         heapBase,
                                         dumpedObj,
                                         constCount,
                                         constBase,
                                         version,
                                         stackTop,
                                         primLength,
                                         primSize,
                                         ciVersion,
                                         utBase,
                                         checkSum,
                                         cLength,
                                         cSize,
                                         memBase);
     for (int i = 16; i < FASL_HEADER_SIZE; i++)
     {
         UInt32 discard = binaryReader.ReadUInt32 ();
         if (discard != 0)
             throw new BadFaslFileException ();
     }
     return header;
 }
예제 #5
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> ();
 }