[squeak-dev] The Inbox: Multilingual-ul.144.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue May 17 15:39:40 UTC 2011
A new version of Multilingual was added to project The Inbox:
http://source.squeak.org/inbox/Multilingual-ul.144.mcz
==================== Summary ====================
Name: Multilingual-ul.144
Author: ul
Time: 17 May 2011, 5:22:26.856 pm
UUID: 95d68d32-70fa-564c-a0c3-8c2438903489
Ancestors: Multilingual-nice.143
MultiByteFileStream changes:
- ensure that wantsLineEndConversion is initalized
- deprecated #convertStringFromCr: and #convertStringToCr:
Use latin1Encodings in ByteTextConverter's and UTF8TextConverter's #nextPut:toStream:
=============== Diff against Multilingual-nice.143 ===============
Item was changed:
----- Method: ByteTextConverter>>nextPut:toStream: (in category 'conversion') -----
nextPut: aCharacter toStream: aStream
+
| charCode |
aStream isBinary ifTrue: [^aCharacter storeBinaryOn: aStream].
+ (charCode := aCharacter charCode) < 256
+ ifFalse: [ aStream basicNextPut: (Character value: (self encode: charCode)) ]
+ ifTrue: [
+ (latin1Encodings at: charCode + 1)
+ ifNil: [ aStream basicNextPut: aCharacter ]
+ ifNotNil: [ :encodedString | aStream basicNextPutAll: encodedString ] ].
+ ^aStream!
- (charCode := aCharacter charCode) < 128
- ifTrue: [aStream basicNextPut: aCharacter]
- ifFalse: [aStream basicNextPut: (Character value: (self encode: charCode))].!
Item was changed:
----- Method: MultiByteFileStream>>convertStringFromCr: (in category 'crlf private') -----
convertStringFromCr: aString
| inStream outStream |
+
+ self deprecated: 'This method is obsolete and private, don''t use it!!'.
lineEndConvention ifNil: [^ aString].
lineEndConvention == #cr ifTrue: [^ aString].
lineEndConvention == #lf ifTrue: [^ aString copy replaceAll: Cr with: Lf].
"lineEndConvention == #crlf"
inStream := ReadStream on: aString.
outStream := WriteStream on: (String new: aString size).
[inStream atEnd]
whileFalse:
[outStream nextPutAll: (inStream upTo: Cr).
(inStream atEnd not or: [aString last = Cr])
ifTrue: [outStream nextPutAll: CrLf]].
^ outStream contents!
Item was changed:
----- Method: MultiByteFileStream>>convertStringToCr: (in category 'crlf private') -----
convertStringToCr: aString
| inStream outStream |
+
+ self deprecated: 'This method is obsolete and private, don''t use it!!'.
lineEndConvention ifNil: [^ aString].
lineEndConvention == #cr ifTrue: [^ aString].
lineEndConvention == #lf ifTrue: [^ aString copy replaceAll: Lf with: Cr].
"lineEndConvention == #crlf"
inStream := ReadStream on: aString.
outStream := WriteStream on: (String new: aString size).
[inStream atEnd]
whileFalse:
[outStream nextPutAll: (inStream upTo: Cr).
(inStream atEnd not or: [aString last = Cr])
ifTrue:
[outStream nextPut: Cr.
inStream peek = Lf ifTrue: [inStream next]]].
^ outStream contents!
Item was added:
+ ----- Method: MultiByteFileStream>>initialize (in category 'initialize-release') -----
+ initialize
+
+ super initialize.
+ wantsLineEndConversion := false.
+ self initializeConverter!
Item was changed:
----- Method: MultiByteFileStream>>wantsLineEndConversion: (in category 'remnant') -----
wantsLineEndConversion: aBoolean
+ wantsLineEndConversion := aBoolean.
+ lineEndConvention ifNil: [ self detectLineEndConvention ]!
- wantsLineEndConversion := aBoolean.
-
- lineEndConvention ifNil: [ self detectLineEndConvention ]. !
Item was changed:
----- Method: UTF8TextConverter>>nextPut:toStream: (in category 'conversion') -----
nextPut: aCharacter toStream: aStream
+
+ | nBytes mask shift ucs2code |
- | leadingChar nBytes mask shift ucs2code |
aStream isBinary ifTrue: [^aCharacter storeBinaryOn: aStream].
+ ucs2code := aCharacter asUnicode ifNil: [ ^aStream ].
+ ucs2code < 256 ifTrue: [
+ (latin1Encodings at: ucs2code + 1)
+ ifNil: [ aStream basicNextPut: aCharacter ]
+ ifNotNil: [ :encodedString | aStream basicNextPutAll: encodedString ].
+ ^aStream ].
- leadingChar := aCharacter leadingChar.
- (leadingChar = 0 and: [aCharacter asciiValue < 128]) ifTrue: [
- aStream basicNextPut: aCharacter.
- ^ aStream.
- ].
-
- "leadingChar > 3 ifTrue: [^ aStream]."
-
- ucs2code := aCharacter asUnicode.
- ucs2code ifNil: [^ aStream].
-
nBytes := ucs2code highBit + 3 // 5.
+ mask := #[128 192 224 240 248 252 254 255] at: nBytes.
- mask := #(128 192 224 240 248 252 254 255) at: nBytes.
shift := nBytes - 1 * -6.
aStream basicNextPut: (Character value: (ucs2code bitShift: shift) + mask).
2 to: nBytes do: [:i |
shift := shift + 6.
aStream basicNextPut: (Character value: ((ucs2code bitShift: shift) bitAnd: 63) + 128).
].
^ aStream.
!
Item was changed:
+ (PackageInfo named: 'Multilingual') postscript: '"Initialize the value of wantsLineEndConversion in all MultiByteFileStreams"
+ MultiByteFileStream allSubInstancesDo: [ :each |
+ (each instVarNamed: #wantsLineEndConversion) ifNil: [
+ each instVarNamed: #wantsLineEndConversion put: false ] ]'!
- (PackageInfo named: 'Multilingual') postscript: '"below, add code to be run after the loading of this package"
- MultiCharacterScanner initialize'!
More information about the Squeak-dev
mailing list
|