Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.792.mcz
==================== Summary ====================
Name: Collections-eem.792
Author: eem
Time: 3 May 2018, 12:55:52.175146 am
UUID: 7d8995ed-835e-44b0-bf4c-0b0780f5c96f
Ancestors: Collections-pre.791
Four times faster implementation of isAsciiString.
=============== Diff against Collections-pre.791 ===============
Item was changed:
----- Method: String>>isAsciiString (in category 'testing') -----
isAsciiString
+ "Answer if the receiver contains only ascii characters.
+ Inline ^self allSatisfy: [ :each | each asciiValue <= 127 ] for speed."
+ 1 to: self basicSize do: [:i| (self basicAt: i) > 127 ifTrue: [^false]].
+ ^true!
-
- ^self allSatisfy: [ :each | each asciiValue <= 127 ]!
Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.1021.mcz
==================== Summary ====================
Name: System-eem.1021
Author: eem
Time: 2 May 2018, 1:39:55.407326 pm
UUID: 727d275e-a337-4208-9616-f887d8fd4576
Ancestors: System-eem.1020
Move more NativeImageSegment methods up to ImageSegment. Provide a hack accessor for testing that a segment can be loaded (forFile:outPointers:, which may get deleted once 64-bit native image segments work).
=============== Diff against System-eem.1020 ===============
Item was added:
+ ----- Method: ImageSegment class>>folder (in category 'fileIn/Out') -----
+ folder
+ | im |
+ "Full path name of segments folder. Be sure to duplicate and rename the folder when you duplicate and rename an image. Is $_ legal in all file systems?"
+
+ im := Smalltalk imageName.
+ ^ (im copyFrom: 1 to: im size - 6 "'.image' size"), '_segs'!
Item was added:
+ ----- Method: ImageSegment>>errorWrongState (in category 'testing') -----
+ errorWrongState
+
+ ^ self error: 'wrong state'!
Item was added:
+ ----- Method: ImageSegment>>forFile:outPointers: (in category 'testing') -----
+ forFile: aFileName outPointers: outPointerArray
+ "An accessor for testing to set up a new image segment to be in a state to load from aFileName. After this send install to load."
+ fileName := aFileName.
+ state := #onFile.
+ outPointers := outPointerArray!
Item was added:
+ ----- Method: ImageSegment>>install (in category 'read/write segment') -----
+ install
+ "This operation retrieves the segment if necessary from file storage, installs it in memory, and replaces (using become:) all the root stubs with the reconstructed roots of the segment."
+
+ | allObjectsInSegment newRoots |
+ state = #onFile ifTrue: [self readFromFile].
+ state = #onFileWithSymbols ifTrue:
+ [self readFromFileWithSymbols].
+ (state = #active) | (state = #imported) ifFalse: [self errorWrongState].
+ allObjectsInSegment := self loadSegmentFrom: segment outPointers: outPointers.
+ newRoots := allObjectsInSegment first.
+ self checkAndReportLoadError.
+ (state = #imported "just came in from exported file" or: [arrayOfRoots isNil "testing..."])
+ ifTrue: [arrayOfRoots := newRoots]
+ ifFalse: [arrayOfRoots elementsForwardIdentityTo: newRoots].
+ state := #inactive.
+ Beeper beepPrimitive!
Item was changed:
----- Method: ImageSegment>>loadSegmentFrom:outPointers: (in category 'read/write segment') -----
loadSegmentFrom: segment outPointers: outPointers
"Attempt to load the segment into memory (reify the objects in segment
as real objects), using outPointers to bind references to objects not in the
segment. Answer a collection of all the objects in the segment."
| segmentFormat |
+ (state == #imported or: [state == #active]) ifTrue:
+ [segmentFormat := self segmentFormatFrom: segment first.
- state == #imported ifTrue:
- [segmentFormat := segment first bitAnd: 16rFFFFFF.
segmentFormat = 6502 ifTrue:
[LegacyImageSegment adoptInstance: self.
^self loadSegmentFrom: segment outPointers: outPointers].
segmentFormat = Smalltalk imageFormatVersion ifTrue:
[NativeImageSegment adoptInstance: self.
^self loadSegmentFrom: segment outPointers: outPointers].
self error: 'no handling for format ', segmentFormat asString. ' in a ', Smalltalk imageFormatVersion asString, ' image.'].
self subclassResponsibility!
Item was added:
+ ----- Method: ImageSegment>>localName (in category 'read/write segment') -----
+ localName
+ | segs ind sep |
+ "Return the current file name for this segment, a local name in the segments directory."
+
+ fileName ifNil: [^ nil].
+ "^ fileName"
+
+ "The following is for backward compatibility. Remove this part after June 2000.
+ Check if the fileName is a full path, and make it local. Regardless of current or previous file system delimiter."
+
+ segs := self class folder copyLast: 4. ":=segs"
+ ind := 1.
+ [ind := fileName findString: segs startingAt: ind+1 caseSensitive: false.
+ ind = 0 ifTrue: [^ fileName].
+ sep := fileName at: ind + (segs size).
+ sep isAlphaNumeric ] whileTrue. "sep is letter or digit, not a separator"
+
+ ^ fileName := fileName copyFrom: ind+(segs size)+1 "delimiter" to: fileName size!
Item was added:
+ ----- Method: ImageSegment>>readFromFile (in category 'read/write segment') -----
+ readFromFile
+ "Read in a simple segment. Use folder of this image, even if remembered as previous location of this image"
+
+ | ff realName |
+ realName := self class folder, FileDirectory slash, self localName.
+ ff := FileStream readOnlyFileNamed: realName.
+ segment := ff nextWordsInto: (WordArrayForSegment new: ff size//4).
+ ff close.
+ state := #active!
Item was added:
+ ----- Method: ImageSegment>>segmentFormatFrom: (in category 'private') -----
+ segmentFormatFrom: a32BitWord
+ "The first two words of a segment array contain the image format version of the system upon which the segment was generated, along with a top byte that is either $d or $s (from the 'does' in #doesNotUnderstand:). But this may be encoded either in big-endian or little-endian format. Since endianness may or may not have been changed, determining what the segment format is takes care."
+ | msc lsc |
+ msc := Character value: ((a32BitWord bitShift: -24) bitAnd: 255).
+ lsc := Character value: (a32BitWord bitAnd: 255).
+ (('ds' includes: msc)
+ and: ['ds' includes: lsc]) ifTrue:
+ [self error: 'ambiguous segment format'].
+ ('ds' includes: msc) ifTrue:
+ [^a32BitWord bitAnd: 16rFFFFFF].
+ ^((a32BitWord bitShift: -24) bitAnd: 16rFF)
+ + ((a32BitWord bitShift: -8) bitAnd: 16rFF00)
+ + ((a32BitWord bitShift: 8) bitAnd: 16rFF0000)!
Item was added:
+ ----- Method: LegacyImageSegment>>aComment (in category 'compact classes') -----
+ aComment
+ "Compact classes are a potential problem because a pointer to the class would not ordinarily show up in the outPointers. We add the classes of all compact classes to outPointers, both for local and export segments.
+ Compact classes are never allowed as roots. No compact class may be in an Environment that is written out to disk. (In local segments, the compact classes array should never have an ImageSegmentRootStub in it. For export, fileIn the class first, then load a segment with instances of it. The fileIn code can be pasted onto the front of the .extSeg file)
+ For local segments, a class may become compact while its instances are out on the disk. Or it may become un-compact. A compact class may change shape while some of its instances are on disk. All three cases go through (ClassDescription updateInstancesFrom:). If it can't rule out an instance being in the segment, it reads it in to fix the instances.
+ See Behavior.becomeCompact for the rules on Compact classes. Indexes may not be reused. This is so that an incoming export segment has its index available. (Changes may be needed in the way indexes are assigned.)
+ For export segments, a compact class may have a different shape. The normal class reshape mechanism will catch this. During the installation of the segment, objects will have the wrong version of their class momentarily. We will change them back before we get caught.
+ For export segments, the last two items in outPointers are the number 1717 and an array of the compact classes used in this segment. (The classes in the array are converted from DiskProxies by SmartRefStream.) If that class is not compact in the new image, the instances are recopied.
+ "!
Item was removed:
- ----- Method: NativeImageSegment class>>folder (in category 'fileIn/Out') -----
- folder
- | im |
- "Full path name of segments folder. Be sure to duplicate and rename the folder when you duplicate and rename an image. Is $_ legal in all file systems?"
-
- im := Smalltalk imageName.
- ^ (im copyFrom: 1 to: im size - 6 "'.image' size"), '_segs'!
Item was changed:
----- Method: NativeImageSegment>>aComment (in category 'compact classes') -----
aComment
+ "Spur does not use compact classes, so an effort has been made to excise their use from the code. The previous comment was:
- "Spur does not use compact classes, so an effort has been made to excise their use from the code. Thew previous comment was:
Compact classes are a potential problem because a pointer to the class would not ordinarily show up in the outPointers. We add the classes of all compact classes to outPointers, both for local and export segments.
Compact classes are never allowed as roots. No compact class may be in an Environment that is written out to disk. (In local segments, the compact classes array should never have an ImageSegmentRootStub in it. For export, fileIn the class first, then load a segment with instances of it. The fileIn code can be pasted onto the front of the .extSeg file)
For local segments, a class may become compact while its instances are out on the disk. Or it may become un-compact. A compact class may change shape while some of its instances are on disk. All three cases go through (ClassDescription updateInstancesFrom:). If it can't rule out an instance being in the segment, it reads it in to fix the instances.
See Behavior.becomeCompact for the rules on Compact classes. Indexes may not be reused. This is so that an incoming export segment has its index available. (Changes may be needed in the way indexes are assigned.)
For export segments, a compact class may have a different shape. The normal class reshape mechanism will catch this. During the installation of the segment, objects will have the wrong version of their class momentarily. We will change them back before we get caught.
+ For export segments, the last two items in outPointers are the number 1717 and an array of the compact classes used in this segment. (The classes in the array are converted from DiskProxies by SmartRefStream.) If that class is not compact in the new image, the instances are recopied."!
- For export segments, the last two items in outPointers are the number 1717 and an array of the compact classes used in this segment. (The classes in the array are converted from DiskProxies by SmartRefStream.) If that class is not compact in the new image, the instances are recopied.
- "!
Item was removed:
- ----- Method: NativeImageSegment>>errorWrongState (in category 'testing') -----
- errorWrongState
-
- ^ self error: 'wrong state'!
Item was removed:
- ----- Method: NativeImageSegment>>install (in category 'read/write segment') -----
- install
- "This operation retrieves the segment if necessary from file storage, installs it in memory, and replaces (using become:) all the root stubs with the reconstructed roots of the segment."
-
- | allObjectsInSegment newRoots |
- state = #onFile ifTrue: [self readFromFile].
- state = #onFileWithSymbols ifTrue:
- [self readFromFileWithSymbols].
- (state = #active) | (state = #imported) ifFalse: [self errorWrongState].
- allObjectsInSegment := self loadSegmentFrom: segment outPointers: outPointers.
- newRoots := allObjectsInSegment first.
- self checkAndReportLoadError.
- state = #imported "just came in from exported file"
- ifTrue: [arrayOfRoots := newRoots]
- ifFalse: [arrayOfRoots elementsForwardIdentityTo: newRoots].
- state := #inactive.
- Beeper beepPrimitive!
Item was removed:
- ----- Method: NativeImageSegment>>localName (in category 'read/write segment') -----
- localName
- | segs ind sep |
- "Return the current file name for this segment, a local name in the segments directory."
-
- fileName ifNil: [^ nil].
- "^ fileName"
-
- "The following is for backward compatibility. Remove this part after June 2000.
- Check if the fileName is a full path, and make it local. Regardless of current or previous file system delimiter."
-
- segs := self class folder copyLast: 4. ":=segs"
- ind := 1.
- [ind := fileName findString: segs startingAt: ind+1 caseSensitive: false.
- ind = 0 ifTrue: [^ fileName].
- sep := fileName at: ind + (segs size).
- sep isAlphaNumeric ] whileTrue. "sep is letter or digit, not a separator"
-
- ^ fileName := fileName copyFrom: ind+(segs size)+1 "delimiter" to: fileName size!
Item was removed:
- ----- Method: NativeImageSegment>>readFromFile (in category 'read/write segment') -----
- readFromFile
- "Read in a simple segment. Use folder of this image, even if remembered as previous location of this image"
-
- | ff realName |
- realName := self class folder, FileDirectory slash, self localName.
- ff := FileStream readOnlyFileNamed: realName.
- segment := ff nextWordsInto: (WordArrayForSegment new: ff size//4).
- ff close.
- state := #active!
Item was removed:
- ----- Method: NativeImageSegment>>segmentFormatFrom: (in category 'private') -----
- segmentFormatFrom: a32BitWord
- "The first two words of a segment array contain the image format version of the system upon which the segment was generated, along with a top byte that is either $d or $s (from the 'does' in #doesNotUnderstand:). But this may be encoded either in big-endian or little-endian format. Since endianness may or may not have been changed, determining what the segment format is takes care."
- | msc lsc |
- msc := Character value: ((a32BitWord bitShift: -24) bitAnd: 255).
- lsc := Character value: (a32BitWord bitAnd: 255).
- (('ds' includes: msc)
- and: ['ds' includes: lsc]) ifTrue:
- [self error: 'ambiguous segment format'].
- ('ds' includes: msc) ifTrue:
- [^a32BitWord bitAnd: 16rFFFFFF].
- ^((a32BitWord bitShift: -24) bitAnd: 16rFF)
- + ((a32BitWord bitShift: -8) bitAnd: 16rFF00)
- + ((a32BitWord bitShift: 8) bitAnd: 16rFF0000)!
Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.1020.mcz
==================== Summary ====================
Name: System-eem.1020
Author: eem
Time: 2 May 2018, 12:29:21.289681 pm
UUID: f492f156-8401-4575-9c03-d268326a41af
Ancestors: System-mt.1019
Move some reading methods up from NativeImageSegment that should be in ImageSegment. Fix determining the image format in NativeImageSegment on load. This reveals that byte reversal does /not/ work on 64-bit Spur (loking at the VM code it seems to reverse 32-bit units, which is almost certainly wrong for 64-bits, alhtough it is right for 32-bits).
=============== Diff against System-mt.1019 ===============
Item was added:
+ ----- Method: ImageSegment>>acceptSingleMethodSource: (in category 'fileIn/Out') -----
+ acceptSingleMethodSource: aDictionary
+
+ | oldClassInfo oldClassName ismeta newName actualClass selector |
+ oldClassInfo := (aDictionary at: #oldClassName) findTokens: ' '. "'Class' or 'Class class'"
+ oldClassName := oldClassInfo first asSymbol.
+ ismeta := oldClassInfo size > 1.
+
+ "must use class var since we may not be the same guy who did the initial work"
+
+ newName := RecentlyRenamedClasses ifNil: [
+ oldClassName
+ ] ifNotNil: [
+ RecentlyRenamedClasses at: oldClassName ifAbsent: [oldClassName]
+ ].
+ actualClass := Smalltalk at: newName.
+ ismeta ifTrue: [actualClass := actualClass class].
+ selector := actualClass newParser parseSelector: (aDictionary at: #methodText).
+ (actualClass compiledMethodAt: selector ifAbsent: [^self "hosed input"])
+ putSource: (aDictionary at: #methodText)
+ fromParseNode: nil
+ class: actualClass
+ category: (aDictionary at: #category)
+ withStamp: (aDictionary at: #changeStamp)
+ inFile: 2
+ priorMethod: nil.
+ !
Item was changed:
----- Method: ImageSegment>>comeFullyUpOnReload: (in category 'fileIn') -----
comeFullyUpOnReload: smartRefStream
"fix up the objects in the segment that changed size. An object in the segment is the wrong size for the modern version of the class. Construct a fake class that is the old size. Replace the modern class with the old one in outPointers. Load the segment. Traverse the instances, making new instances by copying fields, and running conversion messages. Keep the new instances. Bulk forward become the old to the new. Let go of the fake objects and classes.
After the install (below), arrayOfRoots is filled in. Globalize new classes. Caller may want to do some special install on certain objects in arrayOfRoots.
May want to write the segment out to disk in its new form."
| mapFakeClassesToReal receiverClasses rootsToUnhiberhate myProject existing forgetDoItsClass endianness |
forgetDoItsClass := Set new.
RecentlyRenamedClasses := nil. "in case old data hanging around"
mapFakeClassesToReal := smartRefStream reshapedClassesIn: outPointers.
"Dictionary of just the ones that change shape. Substitute them in outPointers."
self fixCapitalizationOfSymbols.
+ endianness := self endianness.
- endianness := (segment first bitShift: -24) asCharacter == $d ifTrue: [#big] ifFalse: [#little].
segment := self loadSegmentFrom: segment outPointers: outPointers.
arrayOfRoots := segment first.
mapFakeClassesToReal isEmpty ifFalse: [
self reshapeClasses: mapFakeClassesToReal refStream: smartRefStream
].
"When a Project is stored, arrayOfRoots has all objects in the project, except those in outPointers"
arrayOfRoots do: [:importedObject |
((importedObject isMemberOf: WideString) or: [importedObject isMemberOf: WideSymbol]) ifTrue: [
importedObject mutateJISX0208StringToUnicode.
importedObject class = WideSymbol ifTrue: [
"self halt."
Symbol hasInterned: importedObject asString ifTrue: [:multiSymbol |
multiSymbol == importedObject ifFalse: [
importedObject becomeForward: multiSymbol.
].
].
].
].
(importedObject isMemberOf: TTCFontSet) ifTrue: [
existing := TTCFontSet familyName: importedObject familyName
pointSize: importedObject pointSize. "supplies default"
existing == importedObject ifFalse: [importedObject becomeForward: existing].
].
].
receiverClasses := self restoreEndianness: endianness ~~ Smalltalk endianness. "rehash sets"
smartRefStream checkFatalReshape: receiverClasses.
"Classes in this segment."
arrayOfRoots do: [:importedObject |
importedObject class class == Metaclass ifTrue: [forgetDoItsClass add: importedObject. self declare: importedObject]].
rootsToUnhiberhate := OrderedCollection new.
arrayOfRoots do: [:importedObject |
((importedObject isMemberOf: ScriptEditorMorph)
or: [(importedObject isKindOf: TileMorph)
or: [(importedObject isMemberOf: ScriptingTileHolder)
or: [importedObject isKindOf: CompoundTileMorph]]]) ifTrue: [
rootsToUnhiberhate add: importedObject
].
(importedObject isMemberOf: Project) ifTrue: [
myProject := importedObject.
importedObject ensureChangeSetNameUnique.
Project addingProject: importedObject.
importedObject restoreReferences.
self dependentsRestore: importedObject.
ScriptEditorMorph writingUniversalTiles:
((importedObject projectPreferenceAt: #universalTiles) ifNil: [false])]].
myProject ifNotNil: [
myProject world setProperty: #thingsToUnhibernate toValue: rootsToUnhiberhate asArray.
].
mapFakeClassesToReal isEmpty ifFalse: [
mapFakeClassesToReal keysAndValuesDo: [:aFake :aReal |
aFake removeFromSystemUnlogged.
aFake becomeForward: aReal].
SystemOrganization removeEmptyCategories].
forgetDoItsClass do: [:c | c forgetDoIts].
"^ self"
!
Item was added:
+ ----- Method: ImageSegment>>endianness (in category 'fileIn/Out') -----
+ endianness
+ "Return which endian kind the incoming segment came from"
+
+ segment class isBits ifFalse:
+ ["Hope that primitive 98 did the right thing - anyway, we lost information about endianness, so pretend we share the image's endianness."
+ ^Smalltalk endianness].
+ ^(segment first bitShift: -24) asCharacter == $d ifTrue: [#big] ifFalse: [#little]!
Item was added:
+ ----- Method: ImageSegment>>restoreEndianness (in category 'fileIn/Out') -----
+ restoreEndianness
+ ^self restoreEndianness: self endianness ~~ Smalltalk endianness!
Item was added:
+ ----- Method: ImageSegment>>scanFrom: (in category 'fileIn/Out') -----
+ scanFrom: aStream
+ "Move source code from a fileIn to the changes file for classes in an ImageSegment. Do not compile the methods. They already came in via the image segment. After the ImageSegment in the file, !!ImageSegment new!! captures control, and scanFrom: is called."
+ | val chunk |
+
+ [aStream atEnd] whileFalse:
+ [aStream skipSeparators.
+ val := (aStream peekFor: $!!)
+ ifTrue: ["Move (aStream nextChunk), find the method or class
+ comment, and install the file location bytes"
+ (Compiler evaluate: aStream nextChunk logged: false)
+ scanFromNoCompile: aStream forSegment: self]
+ ifFalse: [chunk := aStream nextChunk.
+ aStream checkForPreamble: chunk.
+ Compiler evaluate: chunk logged: true].
+ aStream skipStyleChunk].
+ "regular fileIn will close the file"
+ ^ val!
Item was added:
+ ----- Method: ImageSegment>>scanFrom:environment: (in category 'fileIn/Out') -----
+ scanFrom: aStream environment: anEnvironment
+ ^ self scanFrom: aStream!
Item was removed:
- ----- Method: NativeImageSegment>>acceptSingleMethodSource: (in category 'fileIn/Out') -----
- acceptSingleMethodSource: aDictionary
-
- | oldClassInfo oldClassName ismeta newName actualClass selector |
- oldClassInfo := (aDictionary at: #oldClassName) findTokens: ' '. "'Class' or 'Class class'"
- oldClassName := oldClassInfo first asSymbol.
- ismeta := oldClassInfo size > 1.
-
- "must use class var since we may not be the same guy who did the initial work"
-
- newName := RecentlyRenamedClasses ifNil: [
- oldClassName
- ] ifNotNil: [
- RecentlyRenamedClasses at: oldClassName ifAbsent: [oldClassName]
- ].
- actualClass := Smalltalk at: newName.
- ismeta ifTrue: [actualClass := actualClass class].
- selector := actualClass newParser parseSelector: (aDictionary at: #methodText).
- (actualClass compiledMethodAt: selector ifAbsent: [^self "hosed input"])
- putSource: (aDictionary at: #methodText)
- fromParseNode: nil
- class: actualClass
- category: (aDictionary at: #category)
- withStamp: (aDictionary at: #changeStamp)
- inFile: 2
- priorMethod: nil.
- !
Item was removed:
- ----- Method: NativeImageSegment>>endianness (in category 'fileIn/Out') -----
- endianness
- "Return which endian kind the incoming segment came from"
-
- segment class isBits ifFalse:
- ["Hope that primitive 98 did the right thing - anyway, we lost information about endianness, so pretend we share the image's endianness."
- ^Smalltalk endianness].
- ^(segment first bitShift: -24) asCharacter == $d ifTrue: [#big] ifFalse: [#little]!
Item was changed:
----- Method: NativeImageSegment>>loadSegmentFrom:outPointers: (in category 'read/write segment primitives') -----
loadSegmentFrom: segmentWordArray outPointers: outPointerArray
"Load segmentWordArray into the memory. Adapt the primitive to the new API, which is to answer the array of loaded objects, the first of which should be the array of roots. The primitive will install a binary image segment and return as its value the array
of roots of the tree of objects represented. Upon successful completion, the
wordArray will have been becomed into anArray of the loaded objects. So simply answer the segmentWordArray which will have becommed."
| segmentFormat |
+ segmentFormat := self segmentFormatFrom: segmentWordArray first.
- segmentFormat := segmentWordArray first bitAnd: 16rFFFFFF.
segmentFormat = Smalltalk imageFormatVersion ifTrue:
[^(self primitiveLoadSegmentFrom: segmentWordArray outPointers: outPointerArray)
ifNil: [self error: 'segment load failed']
ifNotNil: [segmentWordArray]].
segmentFormat >= 68000
ifTrue:
[Smalltalk wordSize = 4 ifTrue:
[^(Spur64BitImageSegmentLoader new loadSegmentFrom: segmentWordArray outPointers: outPointerArray)]]
ifFalse:
[Smalltalk wordSize = 8 ifTrue:
[^(Spur32BitImageSegmentLoader new loadSegmentFrom: segmentWordArray outPointers: outPointerArray)]].
self error: 'segment version unrecognized'!
Item was removed:
- ----- Method: NativeImageSegment>>restoreEndianness (in category 'fileIn/Out') -----
- restoreEndianness
- ^self restoreEndianness: self endianness ~~ Smalltalk endianness!
Item was removed:
- ----- Method: NativeImageSegment>>scanFrom: (in category 'fileIn/Out') -----
- scanFrom: aStream
- "Move source code from a fileIn to the changes file for classes in an ImageSegment. Do not compile the methods. They already came in via the image segment. After the ImageSegment in the file, !!ImageSegment new!! captures control, and scanFrom: is called."
- | val chunk |
-
- [aStream atEnd] whileFalse:
- [aStream skipSeparators.
- val := (aStream peekFor: $!!)
- ifTrue: ["Move (aStream nextChunk), find the method or class
- comment, and install the file location bytes"
- (Compiler evaluate: aStream nextChunk logged: false)
- scanFromNoCompile: aStream forSegment: self]
- ifFalse: [chunk := aStream nextChunk.
- aStream checkForPreamble: chunk.
- Compiler evaluate: chunk logged: true].
- aStream skipStyleChunk].
- "regular fileIn will close the file"
- ^ val!
Item was removed:
- ----- Method: NativeImageSegment>>scanFrom:environment: (in category 'fileIn/Out') -----
- scanFrom: aStream environment: anEnvironment
- ^ self scanFrom: aStream!
Item was added:
+ ----- Method: NativeImageSegment>>segmentFormatFrom: (in category 'private') -----
+ segmentFormatFrom: a32BitWord
+ "The first two words of a segment array contain the image format version of the system upon which the segment was generated, along with a top byte that is either $d or $s (from the 'does' in #doesNotUnderstand:). But this may be encoded either in big-endian or little-endian format. Since endianness may or may not have been changed, determining what the segment format is takes care."
+ | msc lsc |
+ msc := Character value: ((a32BitWord bitShift: -24) bitAnd: 255).
+ lsc := Character value: (a32BitWord bitAnd: 255).
+ (('ds' includes: msc)
+ and: ['ds' includes: lsc]) ifTrue:
+ [self error: 'ambiguous segment format'].
+ ('ds' includes: msc) ifTrue:
+ [^a32BitWord bitAnd: 16rFFFFFF].
+ ^((a32BitWord bitShift: -24) bitAnd: 16rFF)
+ + ((a32BitWord bitShift: -8) bitAnd: 16rFF00)
+ + ((a32BitWord bitShift: 8) bitAnd: 16rFF0000)!
Patrick Rein uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-pre.223.mcz
==================== Summary ====================
Name: Network-pre.223
Author: pre
Time: 2 May 2018, 3:19:58.805873 pm
UUID: 6308303d-2839-b54d-9e44-90d16685e6be
Ancestors: Network-pre.222
Makes MIMEHeaderValue objects aware of qencoding by resolving the encoding issue at creation time.
=============== Diff against Network-pre.222 ===============
Item was changed:
----- Method: MIMEHeaderValue class>>forField:fromString: (in category 'instance creation') -----
forField: aFName fromString: aString
"Create a MIMEHeaderValue from aString. How it is parsed depends on whether it is a MIME specific field or a generic header field."
+ | decodedString |
+ decodedString := [aString decodeMimeHeader]
+ on: InvalidUTF8 , NoConverterFound do: [:e | aString].
(aFName beginsWith: 'content-')
+ ifTrue: [^self fromMIMEHeader: decodedString]
+ ifFalse: [^self fromTraditionalHeader: decodedString]
- ifTrue: [^self fromMIMEHeader: aString]
- ifFalse: [^self fromTraditionalHeader: aString]
!
Item was changed:
----- Method: MIMEHeaderValue class>>fromMIMEHeader: (in category 'instance creation') -----
fromMIMEHeader: aString
+ "This is the value of a MIME header field and so is parsed to extract the various parts.
+ This assumes a string without any special encodings (e.g. q encoding)."
- "This is the value of a MIME header field and so is parsed to extract the various parts"
| parts newValue parms |
newValue := self new.
parts := ReadStream on: (aString findTokens: ';').
newValue mainValue: parts next.
parms := Dictionary new.
parts do:
[:e | | separatorPos parmName parmValue |
separatorPos := e findAnySubStr: '=' startingAt: 1.
separatorPos <= e size
ifTrue:
[parmName := (e copyFrom: 1 to: separatorPos - 1) withBlanksTrimmed asLowercase.
parmValue := (e copyFrom: separatorPos + 1 to: e size) withBlanksTrimmed withoutQuoting.
parms at: parmName put: parmValue]].
newValue parameters: parms.
^ newValue
!
Item was changed:
----- Method: MIMEHeaderValue class>>fromTraditionalHeader: (in category 'instance creation') -----
fromTraditionalHeader: aString
+ "This is a traditional non-MIME header (like Subject:) and so should be stored whole.
+ This assumes a string without any special encodings (e.g. q encoding)."
- "This is a traditional non-MIME header (like Subject:) and so should be stored whole"
| newValue |
newValue := self new.
newValue mainValue: aString.
newValue parameters: #().
^newValue.
!
Item was changed:
----- Method: MIMEHeaderValue>>asHeaderValue (in category 'printing') -----
asHeaderValue
+ | strm result |
- | strm |
strm := WriteStream on: (String new: 20).
strm nextPutAll: mainValue.
parameters associationsDo: [:e |
strm
nextPut: $; ;
nextPutAll: e key;
nextPutAll: '=';
nextPutAll: e value].
+ ^ ((result := strm contents) anySatisfy: [:c | c isAscii not])
+ ifTrue: [QEncodingMimeConverter mimeEncode: result]
+ ifFalse: [result]
+ !
- ^ QEncodingMimeConverter mimeEncode: strm contents!
Item was changed:
----- Method: MIMEHeaderValue>>mainValue (in category 'accessing') -----
mainValue
+ ^ mainValue!
- ^ [mainValue decodeMimeHeader]
- on: InvalidUTF8 , NoConverterFound do: [:e | mainValue]!
David T. Lewis uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-dtl.810.mcz
==================== Summary ====================
Name: Tools-dtl.810
Author: dtl
Time: 30 April 2018, 8:12:14.871637 pm
UUID: 53192ea3-8423-4ff8-b52b-0b87a44fea51
Ancestors: Tools-eem.809
Add comment to explain the intent of Object>>canonicalArgumentName
=============== Diff against Tools-eem.809 ===============
Item was changed:
----- Method: Object>>canonicalArgumentName (in category '*Tools-Debugger') -----
canonicalArgumentName
+ "Answer a name that describes the type or class of this object for creating
+ an argument name for an argument of similar type in a stub method."
+
^ self class name!