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

commits at source.squeak.org commits at source.squeak.org
Sun Feb 14 08:19:03 UTC 2010


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

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

Name: Multilingual-ul.89
Author: ul
Time: 14 February 2010, 8:59:55.784 am
UUID: 4cfa2f16-9045-6742-8d8d-151b0512a6b1
Ancestors: Multilingual-ar.87

- removed EUCTextConverter >> #saveStateOf: and EUCTextConverter >> #restoreStateOf:with:, because they were same as in super
- more chunk reading capabilities for TextConverter for better performance: #nextChunkTextFromStream: and #parseLanguageTagFor:fromStream: (part 1)

=============== Diff against Multilingual-ar.87 ===============

Item was added:
+ ----- Method: TextConverter>>nextChunkTextFromStream: (in category 'fileIn/Out') -----
+ nextChunkTextFromStream: input
+ 	"Deliver the next chunk as a Text.  Decode the following ]style[ chunk if present.  Position at start of next real chunk."
+ 	
+ 	| chunk state runs |
+ 	chunk := self nextChunkFromStream: input.
+ 	state := self saveStateOf: input.
+ 	(input skipSeparatorsAndPeekNext == $] and: [
+ 		(input next: 7) = ']style[' ])
+ 			ifTrue: [
+ 				runs := RunArray scanFrom: (self nextChunkFromStream: input) readStream ]
+ 			ifFalse: [
+ 				self restoreStateOf: input with: state.
+ 				runs := RunArray new: chunk size withAll: #() ].
+ 	^Text string: chunk runs: runs!

Item was added:
+ ----- Method: TextConverter>>parseLangTagFor:fromStream: (in category 'fileIn/Out') -----
+ parseLangTagFor: aString fromStream: stream
+ 
+ 	| state |
+ 	state := self saveStateOf: stream.
+ 	"Test for ]lang[ tag"
+ 	(stream skipSeparatorsAndPeekNext == $] and: [
+ 		(stream next: 6) = ']lang[' ]) ifTrue: [
+ 			^stream
+ 				decodeString: aString
+ 				andRuns: (self nextChunkFromStream: stream) ].
+ 	"no tag"
+ 	self restoreStateOf: stream with: state.
+ 	^aString
+ 			!

Item was added:
+ ----- Method: UTF8TextConverter>>nextChunkTextFromStream: (in category 'fileIn/Out') -----
+ nextChunkTextFromStream: input
+ 	"Deliver the next chunk as a Text.  Decode the following ]style[ chunk if present.  Position at start of next real chunk."
+ 	
+ 	| chunk state runs |
+ 	chunk := self nextChunkFromStream: input.
+ 	state := self saveStateOf: input.
+ 	(input skipSeparatorsAndPeekNext == $] and: [
+ 		(input basicNext: 7) = ']style[' ])
+ 			ifTrue: [
+ 				runs := RunArray scanFrom: (self nextChunkFromStream: input) readStream ]
+ 			ifFalse: [
+ 				self restoreStateOf: input with: state.
+ 				runs := RunArray new: chunk size withAll: #() ].
+ 	^Text string: chunk runs: runs!

Item was added:
+ ----- Method: UTF8TextConverter>>parseLangTagFor:fromStream: (in category 'fileIn/Out') -----
+ parseLangTagFor: aString fromStream: stream
+ 
+ 	| state |
+ 	state := self saveStateOf: stream.
+ 	"Test for ]lang[ tag"
+ 	(stream skipSeparatorsAndPeekNext == $] and: [
+ 		(stream basicNext: 6) = ']lang[' ]) ifTrue: [
+ 			^stream
+ 				decodeString: aString
+ 				andRuns: (self nextChunkFromStream: stream) ].
+ 	"no tag"
+ 	self restoreStateOf: stream with: state.
+ 	^aString!

Item was changed:
  ----- Method: TextConverter>>nextChunkFromStream: (in category 'fileIn/Out') -----
  nextChunkFromStream: input
  	"Answer the contents of input, up to the next terminator character. Doubled terminators indicate an embedded terminator character."
  	
  	input skipSeparators.
+ 	^self
+ 		parseLangTagFor: (
+ 			String new: 1000 streamContents: [ :output |
+ 				| character state |
+ 				[ 
+ 					(character := self nextFromStream: input) == nil or: [ 
+ 						character == $!! and: [ 
+ 							state := self saveStateOf: input.
+ 							(self nextFromStream: input) ~~ $!! ] ] ] 
+ 					whileFalse: [ output nextPut: character ].
+ 				character ifNotNil: [ 
+ 					self restoreStateOf: input with: state ] ])
+ 		fromStream: input!
- 	^input parseLangTagFor: (
- 		String new: 1000 streamContents: [ :output |
- 			| character state |
- 			[ 
- 				(character := self nextFromStream: input) == nil or: [ 
- 					character == $!! and: [ 
- 						state := self saveStateOf: input.
- 						(self nextFromStream: input) ~~ $!! ] ] ] 
- 				whileFalse: [ output nextPut: character ].
- 			character ifNotNil: [ 
- 				self restoreStateOf: input with: state ] ])!

Item was changed:
  ----- Method: UTF8TextConverter>>nextChunkFromStream: (in category 'fileIn/Out') -----
  nextChunkFromStream: input
  	"Answer the contents of input, up to the next terminator character. Doubled terminators indicate an embedded terminator character."
  	
  	input skipSeparators.
+ 	^self 
+ 		parseLangTagFor: (
+ 			String new: 1000 streamContents: [ :stream |
+ 				[
+ 					stream nextPutAll: (input basicUpTo: $!!).
+ 					input basicNext == $!! ]
+ 						whileTrue: [ 
+ 							stream nextPut: $!! ].
+ 				input atEnd ifFalse: [ input skip: -1 ] ]) utf8ToSqueak
+ 		fromStream: input!
- 	^input parseLangTagFor: (
- 		String new: 1000 streamContents: [ :stream |
- 			[
- 				stream nextPutAll: (input basicUpTo: $!!).
- 				input basicNext == $!! ]
- 					whileTrue: [ 
- 						stream nextPut: $!! ].
- 			input atEnd ifFalse: [ input skip: -1 ] ]) utf8ToSqueak!

Item was removed:
- ----- Method: EUCTextConverter>>restoreStateOf:with: (in category 'friend') -----
- restoreStateOf: aStream with: aConverterState
- 
- 	aStream position: aConverterState.
- !

Item was removed:
- ----- Method: EUCTextConverter>>saveStateOf: (in category 'friend') -----
- saveStateOf: aStream
- 
- 	^ aStream position.
- !



More information about the Packages mailing list