[Pkg] The Trunk: Multilingual-ul.146.mcz

commits at source.squeak.org commits at source.squeak.org
Sun May 22 10:38:17 UTC 2011


Levente Uzonyi uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-ul.146.mcz

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

Name: Multilingual-ul.146
Author: ul
Time: 17 May 2011, 5:31:08.561 pm
UUID: 8c0359ba-6c47-a946-9707-cc7c37dc8d44
Ancestors: Multilingual-ul.145

MultiByteFileStream changes:
- assume that wantsLineEndConversion is properly initialized
- removed the line end conversion code from #nextPut:

=============== Diff against Multilingual-ul.145 ===============

Item was changed:
  ----- Method: MultiByteFileStream>>detectLineEndConvention (in category 'crlf private') -----
  detectLineEndConvention
  	"Detect the line end convention used in this stream. The result may be either #cr, #lf or #crlf."
  	| char numRead state |
  	self isBinary ifTrue: [^ self error: 'Line end conventions are not used on binary streams'].
+ 	wantsLineEndConversion ifFalse: [self lineEndConvention: nil.
- 	wantsLineEndConversion == true ifFalse: [self lineEndConvention: nil.
  					^lineEndConvention].
  	self closed ifTrue: [self lineEndConvention: LineEndDefault.
  					^lineEndConvention].
  
  	"Default if nothing else found"
  	numRead := 0.
  	state := converter saveStateOf: self.
  	lineEndConvention := nil.
  	[super atEnd not and: [numRead < LookAheadCount]]
  		whileTrue: 
  			[char := self next.
  			char = Lf
  				ifTrue: 
  					[converter restoreStateOf: self with: state.
  					self lineEndConvention: #lf.
  					^lineEndConvention].
  			char = Cr
  				ifTrue: 
  					[self peek = Lf
  						ifTrue: [self lineEndConvention: #crlf]
  						ifFalse: [self lineEndConvention: #cr].
  					converter restoreStateOf: self with: state.
  					^ lineEndConvention].
  			numRead := numRead + 1].
  	converter restoreStateOf: self with: state.
  	self lineEndConvention: LineEndDefault.
  	^ lineEndConvention!

Item was changed:
  ----- Method: MultiByteFileStream>>doConversion (in category 'crlf private') -----
  doConversion
  
+ 	^wantsLineEndConversion and: [ lineEndConvention notNil ]!
- 	^wantsLineEndConversion == true and: [ lineEndConvention notNil ]!

Item was changed:
  ----- Method: MultiByteFileStream>>installLineEndConventionInConverter (in category 'private') -----
  installLineEndConventionInConverter
  
  	converter ifNotNil: [
  		converter installLineEndConvention: (
+ 			(wantsLineEndConversion and: [ lineEndConvention notNil ]) "#doConversion is inlined here"
- 			(wantsLineEndConversion == true and: [ lineEndConvention notNil ]) "#doConversion is inlined here"
  				ifTrue: [ LineEndStrings at: lineEndConvention ]
  				ifFalse: [ nil ]) ]!

Item was changed:
  ----- Method: MultiByteFileStream>>next (in category 'public') -----
  next
  
  	| char |
  	char := converter nextFromStream: self.
  	"#doConversion is inlined here"
+ 	(wantsLineEndConversion and: [ lineEndConvention notNil ]) ifTrue: [
- 	(wantsLineEndConversion == true and: [ lineEndConvention notNil ]) ifTrue: [
  		char == Cr ifTrue: [
  			| state |
  			state := converter saveStateOf: self.
  			(converter nextFromStream: self) ifNotNil: [ :secondChar |
  				secondChar == Lf ifFalse: [
  					converter restoreStateOf: self with: state ] ].
  			^Cr ].
  		char == Lf ifTrue: [
  			^Cr ] ].
  	^char.
  
  !

Item was changed:
  ----- Method: MultiByteFileStream>>next: (in category 'public') -----
  next: anInteger 
  
  	| multiString |
  	self isBinary ifTrue: [^ super next: anInteger].
  	multiString := String new: anInteger.
  	1 to: anInteger do: [:index |
  		| character |
  		(character := self next)
  			ifNotNil: [ multiString at: index put: character ]
  			ifNil: [
  				multiString := multiString copyFrom: 1 to: index - 1.
+ 				(wantsLineEndConversion and: [ lineEndConvention notNil ]) "#doConversion is inlined here"
- 				(wantsLineEndConversion == true and: [ lineEndConvention notNil ]) "#doConversion is inlined here"
  					ifFalse: [ ^multiString ].
  				^self next: anInteger innerFor: multiString ] ].
+ 	(wantsLineEndConversion and: [ lineEndConvention notNil ]) "#doConversion is inlined here"
- 	(wantsLineEndConversion == true and: [ lineEndConvention notNil ]) "#doConversion is inlined here"
  		 ifFalse: [ ^multiString ].
  
  	multiString := self next: anInteger innerFor: multiString.
  	(multiString size = anInteger or: [self atEnd]) ifTrue: [ ^ multiString].
  	^ multiString, (self next: anInteger - multiString size).
  !

Item was changed:
  ----- Method: MultiByteFileStream>>nextPut: (in category 'public') -----
  nextPut: aCharacter
  
  	aCharacter isInteger ifTrue: [ ^super nextPut: aCharacter ].
+ 	^converter nextPut: aCharacter toStream: self!
- 	(wantsLineEndConversion == true and: [ lineEndConvention notNil ]) "#doConversion is inlined here"
- 		 ifTrue: [
- 			aCharacter == Cr
- 				ifTrue: [
- 					converter 
- 						nextPutAll: (LineEndStrings at: lineEndConvention)
- 						toStream: self ]
- 				ifFalse: [ 
- 					converter nextPut: aCharacter toStream: self ].
- 			^aCharacter ].
- 	converter nextPut: aCharacter toStream: self.
- 	^aCharacter!

Item was changed:
  ----- Method: MultiByteFileStream>>wantsLineEndConversion (in category 'crlf private') -----
  wantsLineEndConversion
  
+ 	^wantsLineEndConversion!
- 	^wantsLineEndConversion == true
- !



More information about the Packages mailing list