Eliot Miranda uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-eem.186.mcz
==================== Summary ====================
Name: Network-eem.186
Author: eem
Time: 25 February 2017, 10:45:26.371668 am
UUID: cfa17471-ba85-4440-8aea-d24c0a5c3697
Ancestors: Network-tfel.185
Fix slip in upToAll:limit: that causes errors in the SocketStreamTests>>testUpToAllCrlf* tests.
=============== Diff against Network-tfel.185 ===============
Item was changed:
----- Method: SocketStream>>upToAll:limit: (in category 'stream in') -----
upToAll: aStringOrByteArray limit: nBytes
"Answer a subcollection from the current access position to the occurrence (if any, but not inclusive) of aStringOrByteArray. If aCollection is not in the stream, or not found within nBytes answer the available contents of the stream"
| index sz result searchedSoFar target |
"Deal with ascii vs. binary"
+ target := self isBinary
+ ifTrue:[aStringOrByteArray asByteArray]
+ ifFalse:[aStringOrByteArray asString].
- self isBinary
- ifTrue:[target := aStringOrByteArray asByteArray]
- ifFalse:[target := aStringOrByteArray asString].
sz := target size.
"Look in the current inBuffer first"
index := inBuffer indexOfSubCollection: target
+ startingAt: (lastRead - sz + 2 max: 1).
- startingAt: lastRead - sz + 2.
(index > 0 and: [(index + sz) <= inNextToWrite]) ifTrue: ["found it"
result := self nextInBuffer: index - lastRead - 1.
self skip: sz.
^ result
].
[searchedSoFar := self inBufferSize.
"Receive more data"
self receiveData.
recentlyRead > 0] whileTrue:[
"Data begins at lastRead + 1, we add searchedSoFar as offset and
backs up sz - 1 so that we can catch any borderline hits."
index := inBuffer indexOfSubCollection: target
startingAt: (lastRead + searchedSoFar - sz + 2 max: 1).
(index > 0 and: [(index + sz) <= inNextToWrite]) ifTrue: ["found it"
result := self nextInBuffer: index - lastRead - 1.
self skip: sz.
^ result
].
"Check if we've exceeded the max. amount"
(nBytes notNil and:[inNextToWrite - lastRead > nBytes])
ifTrue:[^self nextAllInBuffer].
].
"not found and (non-signaling) connection was closed"
^self nextAllInBuffer!
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.734.mcz
==================== Summary ====================
Name: Collections-eem.734
Author: eem
Time: 24 February 2017, 3:51:29.783168 pm
UUID: a81dce52-1da2-4c87-b8a7-fd6bf485396b
Ancestors: Collections-topa.733
Eliminate the ugly hack to speed up stream wide character writes. The trade-offs with Spur have changed and the cure is now arguably worse than the disease. The VM no longer supports the primitive (since it cannot be sufficiently polymorphic). hence the hack is paid for on every write but pays off only on wide chaacter writes to byte strings. Now that Spur's become is much faster than V3 let's accept that the writing of a wide character to a byte string stream won't be as fast, since all other stream writes will be.
Slightly faster (and correctly commented) version of isSeparator.
=============== Diff against Collections-topa.733 ===============
Item was changed:
----- Method: Character>>isSeparator (in category 'testing') -----
isSeparator
"Answer whether the receiver is one of the separator characters--space,
cr, tab, line feed, or form feed."
| integerValue |
+ (integerValue := self asInteger) > 32 ifTrue: [^false].
+ ^#(false false false false false false false false false
+ true "9 = tab"
+ true "10 = line feed"
+ false
+ true "12 = form feed"
+ true "13 = cr"
+ false false false false false false false false false false false false false false false false false false
+ true) at: integerValue + 1!
- (integerValue := self asInteger) > 32 ifTrue: [ ^false ].
- integerValue
- caseOf: {
- [ 32 "space" ] -> [ ^true ].
- [ 9 "cr" ] -> [ ^true ].
- [ 13 "tab"] -> [ ^true ].
- [ 10 "line feed" ] -> [ ^true ] }
- otherwise: [ ^integerValue = 12 "form feed" ]!
Item was changed:
----- Method: WriteStream>>nextPut: (in category 'accessing') -----
nextPut: anObject
"Primitive. Insert the argument at the next position in the Stream
represented by the receiver. Fail if the collection of this stream is not an
Array or a String. Fail if the stream is positioned at its end, or if the
position is out of bounds in the collection. Fail if the argument is not
of the right type for the collection. Optional. See Object documentation
whatIsAPrimitive."
<primitive: 66>
- ((collection class == ByteString) and: [
- anObject isCharacter and:[anObject isOctetCharacter not]]) ifTrue: [
- collection := (WideString from: collection).
- ^self nextPut: anObject.
- ].
position >= writeLimit
ifTrue: [^ self pastEndPut: anObject]
ifFalse:
[position := position + 1.
^collection at: position put: anObject]!