David T. Lewis uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-tfel.306.mcz
==================== Summary ====================
Name: Graphics-tfel.306
Author: tfel
Time: 12 February 2015, 4:30:55.231 pm
UUID: d29337c1-4ded-b541-bf1e-9a8ca326eb04
Ancestors: Graphics-kfr.305
get rid of the self>>error: call in BitBlt>>copyBits. This is not really useful, as we can just proceed and it still works. In addition, the RSqueakVM needs to go through this fallback code to run the BitBltSimulation (it doesn't have a plugin)
=============== Diff against Graphics-kfr.305 ===============
Item was changed:
----- Method: BitBlt>>copyBits (in category 'copying') -----
copyBits
"Primitive. Perform the movement of bits from the source form to the
destination form. Fail if any variables are not of the right type (Integer,
Float, or Form) or if the combination rule is not implemented.
In addition to the original 16 combination rules, this BitBlt supports
16 fail (to simulate paint)
17 fail (to simulate mask)
18 sourceWord + destinationWord
19 sourceWord - destinationWord
20 rgbAdd: sourceWord with: destinationWord
21 rgbSub: sourceWord with: destinationWord
22 rgbDiff: sourceWord with: destinationWord
23 tallyIntoMap: destinationWord
24 alphaBlend: sourceWord with: destinationWord
25 pixPaint: sourceWord with: destinationWord
26 pixMask: sourceWord with: destinationWord
27 rgbMax: sourceWord with: destinationWord
28 rgbMin: sourceWord with: destinationWord
29 rgbMin: sourceWord bitInvert32 with: destinationWord
"
<primitive: 'primitiveCopyBits' module: 'BitBltPlugin'>
"Check for compressed source, destination or halftone forms"
(combinationRule >= 30 and: [combinationRule <= 31]) ifTrue:
["No alpha specified -- re-run with alpha = 1.0"
^ self copyBitsTranslucent: 255].
((sourceForm isForm) and: [sourceForm unhibernate])
ifTrue: [^ self copyBits].
((destForm isForm) and: [destForm unhibernate])
ifTrue: [^ self copyBits].
((halftoneForm isForm) and: [halftoneForm unhibernate])
ifTrue: [^ self copyBits].
"Check for unimplmented rules"
combinationRule = Form oldPaint ifTrue: [^ self paintBits].
combinationRule = Form oldErase1bitShape ifTrue: [^ self eraseBits].
"Check if BitBlt doesn't support full color maps"
(colorMap notNil and:[colorMap isColormap]) ifTrue:[
colorMap := colorMap colors.
^self copyBits].
"Check if clipping gots us way out of range"
self clipRange ifTrue:[self roundVariables. ^self copyBitsAgain].
- self error: 'Bad BitBlt arg (Fraction?); proceed to convert.'.
"Convert all numeric parameters to integers and try again."
self roundVariables.
^ self copyBitsAgain!
David T. Lewis uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-dtl.281.mcz
==================== Summary ====================
Name: EToys-dtl.281
Author: dtl
Time: 2 March 2017, 9:05:08.262967 pm
UUID: 5441a7e4-f77e-45cb-bb21-a24bc7a2b87b
Ancestors: EToys-ul.280
Capture Bert's explanation of Worldlet in a class comment
=============== Diff against EToys-ul.280 ===============
Item was changed:
PasteUpMorph subclass: #Worldlet
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Etoys-Squeakland-Morphic-Mentoring'!
+ !Worldlet commentStamp: 'dtl 3/2/2017 21:02' prior: 0!
+ An area with a private Presenter, viz, for which the scope of its stop-step-go buttons is limited to the area's interior.
+
+ A Worldlet serves as a world within a world, which can have its own flaps, but does not have its own worldState. It is used for recording and replaying demos in an EventTheater.!
- !Worldlet commentStamp: 'sw 9/19/2006 14:53' prior: 0!
- An area with a private Presenter, viz, for which the scope of its stop-step-go buttons is limited to the area's interior.!
David T. Lewis uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.601.mcz
==================== Summary ====================
Name: Collections-ul.601
Author: ul
Time: 19 January 2015, 8:43:39.075 pm
UUID: 02a48b9d-87a4-4ae0-9ae5-42a2f22e08ea
Ancestors: Collections-mt.600
- Added FloatCollection >> #asFloatArray which gives slightly better performance.
OrderedDictionary changes:
- Compact eagerly on removal. This ensures that the order Array is always compact: its elements between 1..tally are the associations stored in the dictionary in insertion order.
- Removed the lastIndex variable, because it's always the same as tally.
- Since order is compact, access by index takes O(1) time, and to copy the order array, we can always use a fast primitive.
- use nil in #sort instead of a block
- #errorOutOfBounds is only understood by SequenceableCollections
- avoid the use of fractions, use integer operations instead
- don't sort the order array when it only has one element
=============== Diff against Collections-mt.600 ===============
Item was added:
+ ----- Method: FloatCollection>>asFloatArray (in category 'adding') -----
+ asFloatArray
+ "Optimized version"
+
+ ^array copyFrom: firstIndex to: lastIndex!
Item was changed:
Dictionary subclass: #OrderedDictionary
+ instanceVariableNames: 'order'
- instanceVariableNames: 'order lastIndex'
classVariableNames: ''
poolDictionaries: ''
category: 'Collections-Sequenceable'!
!OrderedDictionary commentStamp: 'mt 1/16/2015 10:42' prior: 0!
I am an ordered dictionary. I have an additional index (called 'order') to keep track of the insertion order of my associations.
The read access is not affected by the additional index.
The index is updated in O(1) [time] when inserting new keys. For present keys, that insertion involves actions in O(n) to move the respective element to the end of the order.
The growth operation compacts the index and takes O(n) additional time.
NOTE: This is still no instance of SequenceableCollection. Having this, some protocols are missing and may require working on #associations, which is an Array and thus sequenceable.!
Item was changed:
----- Method: OrderedDictionary>>associationsDo: (in category 'enumerating') -----
associationsDo: aBlock
"Iterate over the order instead of the internal array."
+ order from: 1 to: tally do: aBlock!
- lastIndex = 0 ifTrue: [^ self].
- 1 to: lastIndex do: [:index |
- (order at: index) ifNotNil: [:element |
- aBlock value: element]].!
Item was changed:
----- Method: OrderedDictionary>>atIndex: (in category 'accessing') -----
atIndex: integer
+ integer > tally ifTrue: [ self error: 'indices are out of bounds' ].
+ ^order at: integer!
- ^ self atIndex: integer ifAbsent: [self errorOutOfBounds]!
Item was changed:
----- Method: OrderedDictionary>>atIndex:ifAbsent: (in category 'accessing') -----
atIndex: integer ifAbsent: exceptionBlock
"As we are sequenceable, provide index-based access."
+ integer > tally ifTrue: [ ^exceptionBlock value ].
+ ^order at: integer ifAbsent: exceptionBlock!
- | found |
- found := 0.
- self associationsDo: [:element |
- (found := found + 1) = integer ifTrue: [
- ^ element]].
-
- ^ exceptionBlock value!
Item was changed:
----- Method: OrderedDictionary>>atNewIndex:put: (in category 'private') -----
atNewIndex: index put: anObject
+ super atNewIndex: index put: anObject.
+ order at: tally put: anObject
+ !
- lastIndex = order size ifTrue: [
- self fixEmptySlots].
-
- lastIndex := lastIndex + 1.
- order at: lastIndex put: anObject.
-
- super atNewIndex: index put: anObject.!
Item was changed:
----- Method: OrderedDictionary>>copyFrom:to: (in category 'copying') -----
copyFrom: startIndex to: endIndex
"Answer a copy of the receiver that contains elements from position
startIndex to endIndex."
+ | result |
+ result := self class new: endIndex + startIndex + 1.
+ order from: startIndex to: endIndex do: [ :association |
+ result add: association copy ].
+ ^result!
- self fixEmptySlots.
- ^ self shallowCopy postCopyFrom: startIndex to: endIndex!
Item was removed:
- ----- Method: OrderedDictionary>>fillOrderFrom: (in category 'private') -----
- fillOrderFrom: anArray
-
- | arraySize |
- arraySize := lastIndex.
- lastIndex := 0.
- 1 to: arraySize do: [:index |
- (anArray at: index) ifNotNil: [:object |
- lastIndex := lastIndex + 1.
- order at: lastIndex put: object]].!
Item was removed:
- ----- Method: OrderedDictionary>>fixEmptySlots (in category 'private') -----
- fixEmptySlots
- "Remove all nil slots in the order index to avoid overflow."
-
- lastIndex = tally ifTrue: [^ self].
- self fillOrderFrom: order.!
Item was changed:
----- Method: OrderedDictionary>>growTo: (in category 'private') -----
growTo: anInteger
| oldOrder |
super growTo: anInteger.
oldOrder := order.
"Grow only to 75%. See #atNewIndex:put: in HashedCollection."
+ order := self class arrayType new: anInteger + 1 * 3 // 4.
+ order
+ replaceFrom: 1
+ to: tally
+ with: oldOrder
+ startingAt: 1!
- order := self class arrayType new: (anInteger * (3/4)) ceiling.
- self fillOrderFrom: oldOrder.!
Item was changed:
----- Method: OrderedDictionary>>initialize: (in category 'private') -----
initialize: n
super initialize: n.
+ order := self class arrayType new: n + 1 * 3 // 4!
- order := self class arrayType new: (n * (3/4)) ceiling.
- lastIndex := 0.!
Item was changed:
----- Method: OrderedDictionary>>isSorted (in category 'sorting') -----
isSorted
+ "Return true if the receiver is sorted by #<=."
- "Return true if the receiver's keys are sorted by #<=."
- self fixEmptySlots.
^ order
isSortedBetween: 1
+ and: tally!
- and: lastIndex!
Item was changed:
----- Method: OrderedDictionary>>postCopy (in category 'copying') -----
postCopy
"We must not copy associations again but retrieve them from the array, which is already a copy. See super."
super postCopy.
+ order := order copy.
+ 1 to: tally do: [ :index |
+ order at: index put: (array at: (self scanFor: (order at: index) key)) ]!
- order := order collect: [:association |
- association ifNotNil: [array at: (self scanFor: association key)]].!
Item was removed:
- ----- Method: OrderedDictionary>>postCopyFrom:to: (in category 'copying') -----
- postCopyFrom: startIndex to: endIndex
- "Adapted from SequenceableCollection and OrderedCollection."
-
- | oldOrder newArraySize newOrderSize |
- newArraySize := self class goodPrimeAtLeast: ((endIndex - startIndex + 1) * (5/4) "add 25%") ceiling.
- newOrderSize := (newArraySize * (3/4)) ceiling. "remove 25%"
-
- oldOrder := order.
- order := self class arrayType new: newOrderSize.
- array := self class arrayType new: newArraySize.
-
- startIndex to: endIndex do: [:index | | element |
- element := (oldOrder at: index) copy.
- order at: index - startIndex + 1 put: element.
- array at: (self scanFor: element key) put: element].
-
- lastIndex := endIndex - startIndex + 1.
- tally := lastIndex.
-
-
- !
Item was changed:
----- Method: OrderedDictionary>>removeKey:ifAbsent: (in category 'removing') -----
removeKey: key ifAbsent: aBlock
+ | result |
+ result := super removeKey: key ifAbsent: [ ^aBlock value ].
+ (self scanOrderFor: key) ifNotNil: [ :index |
+ order
+ replaceFrom: index
+ to: tally
+ with: order
+ startingAt: index + 1 ].
+ . order at: tally + 1 put: nil.
+ ^result!
- (self scanOrderFor: key) ifNotNil: [:index |
- order at: index put: nil].
- ^ super removeKey: key ifAbsent: aBlock!
Item was changed:
----- Method: OrderedDictionary>>scanOrderFor: (in category 'private') -----
scanOrderFor: anObject
+ 1 to: tally do: [ :index |
+ (order at: index) key = anObject ifTrue: [ ^index ] ].
+ ^nil!
- 1 to: lastIndex do: [:index |
- | element |
- ((element := order at: index) notNil and: [anObject = element key])
- ifTrue: [^ index]].
-
- ^ nil!
Item was changed:
----- Method: OrderedDictionary>>sort (in category 'sorting') -----
sort
+ self sort: nil!
- self sort: [:a1 :a2| a1 key <= a2 key].!
Item was changed:
----- Method: OrderedDictionary>>sort: (in category 'sorting') -----
sort: aSortBlock
"Like in OrderedCollection, sort the associations according to the sort block."
+ tally <= 1 ifTrue: [ ^self ].
+ order
+ mergeSortFrom: 1
+ to: tally
+ by: aSortBlock!
- self ifNotEmpty: [
- self fixEmptySlots.
- order
- mergeSortFrom: 1
- to: lastIndex
- by: aSortBlock].!
David T. Lewis uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-dtl.331.mcz
==================== Summary ====================
Name: Compiler-dtl.331
Author: dtl
Time: 5 March 2017, 11:23:25.780766 am
UUID: ee28d7a0-4167-4462-8780-b9fa72d4b0db
Ancestors: Compiler-ul.330, Compiler-jr.329
Merge
=============== Diff against Compiler-ul.330 ===============
Item was added:
+ ----- Method: CompilationCue class>>source:context:class:environment:requestor: (in category 'instance creation') -----
+ source: aTextOrStream context: aContext class: aClass environment: anEnvironment requestor: reqObject
+ ^ self basicNew
+ initializeWithSource: aTextOrStream
+ context: aContext
+ receiver: (aContext ifNotNil: [aContext receiver])
+ class: aClass
+ environment: anEnvironment
+ requestor: reqObject!
Item was added:
+ ----- Method: CompilationCue class>>source:environment:requestor: (in category 'instance creation') -----
+ source: aString environment: anEnvironment requestor: aRequestor
+ ^ self
+ source: aString
+ context: nil
+ receiver: nil
+ class: UndefinedObject
+ environment: anEnvironment
+ requestor: aRequestor!
Item was added:
+ ----- Method: Compiler class>>evaluate:in:notifying:logged: (in category 'evaluating logged') -----
+ evaluate: textOrString in: anEnvironment notifying: aController logged: logFlag
+ "Compile and execute the argument, textOrString in anEnvironment.
+ If a compilation error occurs, notify aController. If both
+ compilation and execution are successful then, if logFlag is true, log
+ (write) the text onto a system changes file so that it can be replayed if
+ necessary."
+
+ ^ self new
+ evaluate: textOrString
+ in: anEnvironment
+ notifying: aController
+ logged: logFlag.!
Item was added:
+ ----- Method: Compiler>>compile:in:environment:notifying:ifFail: (in category 'public access') -----
+ compile: textOrStream in: aClass environment: anEnvironment notifying: aRequestor ifFail: failBlock
+ "Answer a MethodNode for the argument, textOrStream. If the
+ MethodNode can not be created, notify the argument, aRequestor; if
+ aRequestor is nil, evaluate failBlock instead. The MethodNode is the root
+ of a parse tree. It can be told to generate a CompiledMethod to be
+ installed in the method dictionary of the argument, aClass."
+
+ ^self
+ compileCue: (CompilationCue
+ source: textOrStream
+ class: aClass
+ environment: anEnvironment
+ requestor: aRequestor)
+ noPattern: false
+ ifFail: failBlock
+ !
Item was added:
+ ----- Method: Compiler>>compileNoPattern:in:context:environment:notifying:ifFail: (in category 'public access') -----
+ compileNoPattern: textOrStream in: aClass context: aContext environment: anEnvironment notifying: aRequestor ifFail: failBlock
+ "Similar to #compile:in:notifying:ifFail:, but the compiled code is
+ expected to be a do-it expression, with no message pattern,
+ and it will be in an explicit environment."
+
+ ^self
+ compileCue: (CompilationCue
+ source: textOrStream
+ context: aContext
+ class: aClass
+ environment: anEnvironment
+ requestor: aRequestor)
+ noPattern: true
+ ifFail: failBlock
+ !
Item was added:
+ ----- Method: Compiler>>evaluate:in:environment:notifying:ifFail:logged: (in category 'public access logging') -----
+ evaluate: textOrStream in: aContext environment: anEnvironment notifying: aRequestor ifFail: failBlock logged: logFlag
+ "Compiles the sourceStream into a parse tree, then generates code into
+ a method. If aContext is not nil, the text can refer to temporaries in that
+ context (the Debugger uses this). If aRequestor is not nil, then it will receive
+ a notify:at: message before the attempt to evaluate is aborted. Finally, the
+ compiled method is invoked from here via withArgs:executeMethod:, hence
+ the system no longer creates Doit method litter on errors."
+ ^self
+ evaluateCue: (CompilationCue
+ source: textOrStream
+ context: aContext
+ receiver: nil
+ class: UndefinedObject
+ environment: anEnvironment
+ requestor: aRequestor)
+ ifFail: failBlock
+ logged: logFlag!
Item was added:
+ ----- Method: Compiler>>evaluate:in:notifying:logged: (in category 'public access logging') -----
+ evaluate: textOrString in: anEnvironment notifying: aController logged: logFlag
+ "Compile and execute the argument, textOrString in anEnvironment.
+ If a compilation error occurs, notify aController. If both
+ compilation and execution are successful then, if logFlag is true, log
+ (write) the text onto a system changes file so that it can be replayed if
+ necessary."
+
+ ^self
+ evaluate: textOrString
+ in: nil
+ environment: anEnvironment
+ notifying: aController
+ ifFail: [^nil]
+ logged: logFlag!
Item was added:
+ ----- Method: Compiler>>evaluate:in:to:environment:notifying:ifFail:logged: (in category 'public access logging') -----
+ evaluate: textOrStream in: aContext to: receiver environment: anEnvironment notifying: aRequestor ifFail: failBlock logged: logFlag
+ "Same as #evaluate:in:to:notifying:ifFail:logged: but with an explicit environment"
+ | theClass |
+ theClass := (aContext == nil ifTrue: [receiver class] ifFalse: [aContext methodClass]).
+ ^self
+ evaluateCue: (CompilationCue
+ source: textOrStream
+ context: aContext
+ receiver: receiver
+ class: theClass
+ environment: anEnvironment
+ requestor: aRequestor)
+ ifFail: failBlock
+ logged: logFlag!
David T. Lewis uploaded a new version of SUnit to project The Trunk:
http://source.squeak.org/trunk/SUnit-jr.106.mcz
==================== Summary ====================
Name: SUnit-jr.106
Author: jr
Time: 2 March 2017, 11:07:55.282687 pm
UUID: 675e77ab-782e-2c47-a754-a9d1ca6f9c03
Ancestors: SUnit-mt.105
make ClassTestCase>targetClass work in other environments
=============== Diff against SUnit-mt.105 ===============
Item was changed:
----- Method: ClassTestCase>>targetClass (in category 'private') -----
targetClass
|className|
className := self class name asText copyFrom: 0 to: self class name size - 4.
+ ^ self class environment valueOf: (className asString asSymbol).
- ^ Smalltalk at: (className asString asSymbol).
!