[FIX] 2 Stream fixes

Hans-Martin Mosner hm.mosner at cityweb.de
Sat Oct 23 20:21:11 UTC 1999


--------------64C35F3843FA9A01BC4367D4
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353"
Content-Transfer-Encoding: 7bit


PositionableStream>>match: and StandardFileStream>>upToEnd did not
behave as expected...

--
PGP Fingerprint: D717 03E1 046D 6BEB A777  25AE A2BA 7559 4D59 9CCF

--------------64C35F3843FA9A01BC4367D4
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="522A6368";
 name="StreamFixes.cs"
Content-Transfer-Encoding: 7bit
Content-Description: Unknown Document
Content-Disposition: inline;
 filename="StreamFixes.cs"


'From Squeak 2.5 of August 6, 1999 on 23 October 1999 at 10:15:04 pm'!
"Change Set:		StreamFixes
Date:			23 October 1999
Author:			Hans-Martin Mosner <hmm at heeg.de>

Fixes 2 Stream issues:
PositionableStream>>match: failed to match string when the first character of the string appears just before the full occurrence of the string.
StandardFileStream>>upToEnd failed because the collection inst var is not set"!


!PositionableStream methodsFor: 'positioning' stamp: 'hmm 10/22/1999 21:18'!
match: subCollection
	"Set the access position of the receiver to be past the next occurrence of the subCollection. Answer whether subCollection is found.  No wildcards, and case does matter."

	| pattern startMatch |
	pattern _ ReadStream on: subCollection.
	startMatch _ nil.
	[pattern atEnd] whileFalse: 
		[self atEnd ifTrue: [^ false].
		(self next) = (pattern next) 
			ifTrue: [pattern position = 1 ifTrue: [startMatch _ self position]]
			ifFalse: [pattern position: 0.
					startMatch ifNotNil: [
						self position: startMatch.
						startMatch _ nil]]].
	^ true

! !


!StandardFileStream methodsFor: 'read, write, position' stamp: 'hmm 10/22/1999 20:34'!
upToEnd
	collection _ buffer1.
	^super upToEnd! !



--------------64C35F3843FA9A01BC4367D4--





More information about the Squeak-dev mailing list