VM Maker: ImageFormat-dtl.51.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: ImageFormat-dtl.51.mcz

commits-2
 
David T. Lewis uploaded a new version of ImageFormat to project VM Maker:
http://source.squeak.org/VMMaker/ImageFormat-dtl.51.mcz

==================== Summary ====================

Name: ImageFormat-dtl.51
Author: dtl
Time: 12 June 2021, 3:55:33.939129 pm
UUID: 9439d840-9001-4a40-b592-568a76202d21
Ancestors: ImageFormat-dtl.50

Provide ImageFileHeader class>>fromFile:

=============== Diff against ImageFormat-dtl.50 ===============

Item was changed:
  Object subclass: #ImageFileHeader
  instanceVariableNames: 'imageFormat headerSize imageBytes startOfMemory specialObjectsOop lastHash screenSize imageHeaderFlags extraVMMemory'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'ImageFormat-Header'!
 
+ !ImageFileHeader commentStamp: 'dtl 6/12/2021 15:54' prior: 0!
- !ImageFileHeader commentStamp: 'dtl 11/1/2012 07:46' prior: 0!
  An ImageFileHeader represents the information in the header block of an image file, used by an interpreter VM. Subclasses may implement extensions for Cog or other header extensions.
 
  Instance variables correspond to the fields in an image file header. An instance of ImageFileHeader may be created by reading from an image file, and an ImageFileHeader may be written to a file.
 
  When stored to a file, the file header fields may be 32 or 64 bits in size, depending on the image format. The byte ordering of each field will be little endian or big endian, depending on the convention of the host platform. When reading from disk, endianness is inferred from the contents of the first data field.
 
+ To read the file header of an image file:
- To explore the file header of an image file:
 
+ ImageFileHeader fromFile: Smalltalk imageName.
-   | fs |
-   fs := (FileStream readOnlyFileNamed: Smalltalk imageName) binary.
-   ([ImageFileHeader readFrom: fs] ensure: [fs close]) explore
  !

Item was added:
+ ----- Method: ImageFileHeader class>>fromFile: (in category 'instance creation') -----
+ fromFile: imageFile
+ "Answer a new instance from a saved image file."
+
+ "ImageFileHeader fromFile: Smalltalk imageName"
+
+ | fs |
+ fs := (FileStream readOnlyFileNamed: Smalltalk imageName) binary.
+ ^ ([ImageFileHeader readFrom: fs] ensure: [fs close])
+ !