[squeak-dev] The Trunk: Multilingual-ul.258.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Apr 14 10:43:56 UTC 2021


Nicolas Cellier uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-ul.258.mcz

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

Name: Multilingual-ul.258
Author: ul
Time: 14 April 2021, 12:00:20.264533 pm
UUID: eebd5681-298a-4aba-aeb2-53019a774f4b
Ancestors: Multilingual-nice.257

- implement MultiByteFileStream >> #basicSkipTo:
- restore MultiByteFileStream >> #basicUpTo: based on the previously removed implementation and #basicSkipTo:

=============== Diff against Multilingual-nice.257 ===============

Item was added:
+ ----- Method: MultiByteFileStream>>basicSkipTo: (in category 'private basic') -----
+ basicSkipTo: delimiter
+ 	"Set the access position of the receiver to be past the next occurrence of delimiter. Answer whether delimiter is found. Ignore both character encoding and line end conversion."
+ 	
+ 	collection ifNotNil: [
+ 		[
+ 			| delimiterPosition |
+ 			self atEnd ifTrue: [ ^false ].
+ 			((delimiterPosition := collection indexOf: delimiter startingAt: position + 1) > 0
+ 				and: [ delimiterPosition <= readLimit ])
+ 				ifTrue: [ 
+ 					position := delimiterPosition.
+ 					^true ].
+ 			position := readLimit.
+ 			"make sure the next block is read from the file."
+ 			self basicNext = delimiter ifTrue: [ ^true ] ] repeat ].
+ 
+ 	"read buffering is disabled"
+ 	[ self atEnd ] whileFalse: [ self basicNext = delimiter ifTrue: [ ^true ] ].
+ 	^false!

Item was added:
+ ----- Method: MultiByteFileStream>>basicUpTo: (in category 'private basic') -----
+ basicUpTo: delimiter
+ 	"Answer a subcollection from the current access position to the occurrence (if any, but not inclusive) of delimiter in the receiver. If delimiter is not in the collection, answer the entire rest of the receiver. Ignore both character encoding and line end conversion."
+ 	
+ 	| start end result |
+ 	collection ifNotNil: [
+ 		(position < readLimit and: [
+ 			(end := collection indexOf: delimiter startingAt: position + 1) > 0 and: [
+ 				end <= readLimit ] ]) ifTrue: [
+ 					^collection copyFrom: position + 1 to: (position := end) - 1 ] ].
+ 	start := self position.
+ 	self basicSkipTo: delimiter.
+ 	end := self position.
+ 	self position: start.
+ 	 "File position may be set to a value greater than the file's size. Make sure the argument is not negative."
+ 	result := self basicNext: (end - start - 1 max: 0).
+ 	"Read the delimiter itself. Noop when #atEnd."
+ 	self basicNext.
+ 	^result!



More information about the Squeak-dev mailing list