[squeak-dev] The Trunk: Collections-nice.527.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jul 30 00:13:47 UTC 2013


Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.527.mcz

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

Name: Collections-nice.527
Author: nice
Time: 30 July 2013, 2:13:07.506 am
UUID: 17e38fb5-76dd-499b-aa6d-bfe07045c28d
Ancestors: Collections-fbs.526

Simplify Base64MimeConverter class initialization with Character>>to:

=============== Diff against Collections-fbs.526 ===============

Item was changed:
  ----- Method: Base64MimeConverter class>>initialize (in category 'as yet unclassified') -----
  initialize
  
  	FromCharTable := Array new: 256.	"nils"
+ 	ToCharTable := ($A to: $Z) , ($a to: $z) , ($0 to: $9) , '+/'.
+ 	ToCharTable keysAndValuesDo: [:ind :char |
+ 		FromCharTable at: char asciiValue + 1 put: ind - 1].!
- 	ToCharTable := Array new: 64.
- 	($A asciiValue to: $Z asciiValue) doWithIndex: [:val :ind | 
- 		FromCharTable at: val+1 put: ind-1.
- 		ToCharTable at: ind put: val asCharacter].
- 	($a asciiValue to: $z asciiValue) doWithIndex: [:val :ind | 
- 		FromCharTable at: val+1 put: ind+25.
- 		ToCharTable at: ind+26 put: val asCharacter].
- 	($0 asciiValue to: $9 asciiValue) doWithIndex: [:val :ind | 
- 		FromCharTable at: val+1 put: ind+25+26.
- 		ToCharTable at: ind+26+26 put: val asCharacter].
- 	FromCharTable at: $+ asciiValue + 1 put: 62.
- 	ToCharTable at: 63 put: $+.
- 	FromCharTable at: $/ asciiValue + 1 put: 63.
- 	ToCharTable at: 64 put: $/.
- 	!

Item was changed:
  ----- Method: Character class>>initializeClassificationTable (in category 'class initialization') -----
  initializeClassificationTable
  	"
  	Initialize the classification table. The classification table is a
  	compact encoding of upper and lower cases of characters with
  
  		- bits 0-7: The lower case value of this character.
  		- bits 8-15: The upper case value of this character.
  		- bit 16: lowercase bit (e.g., isLowercase == true)
  		- bit 17: uppercase bit (e.g., isUppercase == true)
  
  	"
  	| ch1 |
  
  	LowercaseBit := 1 bitShift: 16.
  	UppercaseBit := 1 bitShift: 17.
  
  	"Initialize the letter bits (e.g., isLetter == true)"
  	LetterBits := LowercaseBit bitOr: UppercaseBit.
  
  	ClassificationTable := Array new: 256.
  	"Initialize the defaults (neither lower nor upper case)"
  	0 to: 255 do:[:i|
  		ClassificationTable at: i+1 put: (i bitShift: 8) + i.
  	].
  
  	"Initialize character pairs (upper-lower case)"
  	#(
  		"Basic roman"
  		($A $a) 	($B $b) 	($C $c) 	($D $d) 
  		($E $e) 	($F $f) 	($G $g) 	($H $h) 
  		($I $i) 		($J $j) 		($K $k) 	($L $l) 
  		($M $m)	($N $n)	($O $o)	($P $p) 
  		($Q $q) 	($R $r) 	($S $s) 	($T $t) 
  		($U $u)	($V $v)	($W $w)	($X $x)
  		($Y $y)	($Z $z)
  		"International"
+ 		($Ä $ä)	($Å $å)	($Ç $ç)	($É $é)
+ 		($Ñ $ñ)	($Ö $ö)	($Ü $ü)	($À $à)
+ 		($à $ã)	($Õ $õ)	($Œ $œ)	($Æ $æ)
- 		($Ä $ä)	($Å $å)	($Ç $ç)	($É $é)
- 		($Ñ $ñ)	($Ö $ö)	($Ü $ü)	($À $à)
- 		($à $ã)	($Õ $õ)	($Œ $œ)	($Æ $æ)
  		"International - Spanish"
+ 		($Á $á)	($Í $í)		($Ó $ó)	($Ú $ú)
- 		($Á $á)	($Í $í)		($Ó $ó)	($Ú $ú)
  		"International - PLEASE CHECK"
+ 		($È $è)	($Ì $ì)		($Ò $ò)	($Ù $ù)
+ 		($Ë $ë)	($Ï $ï)
+ 		($Â $â)	($Ê $ê)	($Î $î)	($Ô $ô)	($Û $û)
- 		($È $è)	($Ì $ì)		($Ò $ò)	($Ù $ù)
- 		($Ë $ë)	($Ï $ï)
- 		($Â $â)	($Ê $ê)	($Î $î)	($Ô $ô)	($Û $û)
  	) do:[:pair| | ch2 |
  		ch1 := pair first asciiValue.
  		ch2 := pair last asciiValue.
  		ClassificationTable at: ch1+1 put: (ch1 bitShift: 8) + ch2 + UppercaseBit.
  		ClassificationTable at: ch2+1 put: (ch1 bitShift: 8) + ch2 + LowercaseBit.
  	].
  
  	"Initialize a few others for which we only have lower case versions."
+ 	#($ß $Ø $ø $ÿ) do:[:char|
- 	#($ß $Ø $ø $ÿ) do:[:char|
  		ch1 := char asciiValue.
  		ClassificationTable at: ch1+1 put: (ch1 bitShift: 8) + ch1 + LowercaseBit.
  	].
  !

Item was changed:
  ----- Method: String>>asCharacter (in category 'converting') -----
  asCharacter
  	"Answer the receiver's first character, or '*' if none.  Idiosyncratic, provisional."
  
+ 	^ self size > 0 ifTrue: [self first] ifFalse:[$·]!
- 	^ self size > 0 ifTrue: [self first] ifFalse:[$·]!

Item was changed:
  ----- Method: Text>>printStringHtml:on: (in category 'html') -----
  printStringHtml: aString on: aStream 
  	| html |
  	html := aString.
  	""
  	html := html copyReplaceAll: '&' with: '&'.
  	html := html copyReplaceAll: '>' with: '>'.
  	html := html copyReplaceAll: '<' with: '&lt;'.
  	""
+ 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬®¬¨¦Ö' with: '&aacute;'.
+ 	html := html copyReplaceAll: '¬¨¬Ž¬¨¬©' with: '&eacute;'.
+ 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬®¬¶¦ë' with: '&iacute;'.
+ 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬®¬¶¦ü' with: '&oacute;'.
+ 	html := html copyReplaceAll: '¬¨¬Ž¬¨¦š' with: '&uacute;'.
+ 	html := html copyReplaceAll: '¬¨¬Ž¬¨¬±' with: '&ntilde;'.
- 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬®¬¨¦Ö' with: '&aacute;'.
- 	html := html copyReplaceAll: '¬¨¬Ž¬¨¬©' with: '&eacute;'.
- 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬®¬¶¦ë' with: '&iacute;'.
- 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬®¬¶¦ü' with: '&oacute;'.
- 	html := html copyReplaceAll: '¬¨¬Ž¬¨¦š' with: '&uacute;'.
- 	html := html copyReplaceAll: '¬¨¬Ž¬¨¬±' with: '&ntilde;'.
  	""
+ 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¶¦±' with: '&Aacute;'.
+ 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¨¬¢' with: '&Eacute;'.
+ 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¶¦º' with: '&Iacute;'.
+ 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¨¬Æ' with: '&Oacute;'.
+ 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¨¦©' with: '&Uacute;'.
+ 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¨¬·' with: '&Ntilde;'.
- 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¶¦±' with: '&Aacute;'.
- 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¨¬¢' with: '&Eacute;'.
- 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¶¦º' with: '&Iacute;'.
- 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¨¬Æ' with: '&Oacute;'.
- 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¨¦©' with: '&Uacute;'.
- 	html := html copyReplaceAll: '¬¨¬®¬¨¬é¬¨¬Ž¬¨¬·' with: '&Ntilde;'.
  	""
  	html := html copyReplaceAll: '
  ' with: '<br>
  '.
  	html := html copyReplaceAll: '	' with: '&nbsp;&nbsp;&nbsp;&nbsp;'.
  	""
  	aStream nextPutAll: html!



More information about the Squeak-dev mailing list