VM Maker: ImageFormat-dtl.23.mcz

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

VM Maker: ImageFormat-dtl.23.mcz

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

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

Name: ImageFormat-dtl.23
Author: dtl
Time: 13 April 2017, 10:15:41.267 am
UUID: 0eacae94-ff21-4207-8f57-e92e3952977b
Ancestors: ImageFormat-dtl.22

Refactoring and cleaner magic file output by Subbu.

=============== Diff against ImageFormat-dtl.22 ===============

Item was changed:
  ----- Method: ImageFormat class>>unixMagicFileEntries (in category 'unix magic file entries') -----
  unixMagicFileEntries
  "Answer a string that can be appended to /etc/magic on a Unix system to support the file(1) utility"
 
  "ImageFormat unixMagicFileEntries"
 
  " | fs |
  fs := FileStream newFileNamed: 'magic'.
  [ fs nextPutAll: ImageFormat unixMagicFileEntries ]
  ensure: [ fs close ] "
 
  ^String streamContents: [:s |
  s nextPutAll: '# Smalltalk image file formats'; lf.
  KnownVersionNumbers do: [ :num | | fmt |
  #( 'le' 'be' ) do: [ :endian |
  fmt := self fromInteger: num.
  (fmt is64Bit and: [ endian = 'be' ])
  ifTrue: [ s nextPut: $4 ]
  ifFalse: [ s nextPut: $0 ].
  s tab;
  nextPutAll: endian;
  nextPutAll: 'long';
  tab;
  nextPutAll: num asString;
  tab;
  nextPutAll: 'Smalltalk '.
  fmt printTerseDescriptionOn: s.
  s lf.
+ s nextPutAll: '!!:mime application/';
+ nextPutAll: fmt simpleName;
+ nextPutAll: '-image';
+ lf
- s nextPutAll: '!!:mime application/'.
- fmt requiresSpurSupport
- ifTrue: [ s nextPutAll: 'spur']
- ifFalse: [fmt requiresClosureSupport ifTrue: [ s nextPutAll: 'cog']
- ifFalse: [s nextPutAll: 'squeak']].
- fmt is64Bit ifTrue: [ s nextPutAll: '64'].
- s nextPutAll: '-image'.
- s lf
  ]
  ].
  s lf.
  ]!

Item was changed:
  ----- Method: ImageFormat>>printTerseDescriptionOn: (in category 'printing') -----
  printTerseDescriptionOn: stream
  "Shortened description as may be required for unix magic file entries"
 
+ stream
+ nextPutAll: self simpleName;
+ nextPutAll: ' image '.
- stream
- nextPutAll: 'image ';
- nextPutAll: (self requiresSpurSupport
- ifTrue: [ 'Spur ' ]
- ifFalse: [ 'V3 ' ]);
- nextPutAll: (wordSize * 8) asString;
- nextPutAll: 'b '.
  self requiresClosureSupport ifTrue: [stream nextPutAll: '+C'].
  self requiresNativeFloatWordOrder ifTrue: [stream nextPutAll: '+NF'].
  self requiresNewSpur64TagAssignment ifTrue: [stream nextPutAll: '+Tag' ].
  stream nextPutAll: ' (%d)'.
  ^ stream
  !

Item was added:
+ ----- Method: ImageFormat>>simpleName (in category 'printing') -----
+ simpleName
+
+ "Return a simple name for the format, suitable for use as filename or mimetype.
+ (ImageFormat fromInteger: 6500) simpleName."
+
+ ^String streamContents: [:s |
+ self requiresSpurSupport
+ ifTrue: [ s nextPutAll: 'spur']
+ ifFalse: [self requiresClosureSupport
+ ifTrue: [ s nextPutAll: 'cog']
+ ifFalse: [s nextPutAll: 'squeak']].
+ self is64Bit ifTrue: [ s nextPutAll: '64']].
+ !

Loading...