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: '<'. "" + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬šŠÃ' with: 'á'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬š¬©' with: 'é'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬¶Šë' with: 'í'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬¶ŠÌ' with: 'ó'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬¶¬ö' with: 'ú'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬š¬±' with: 'ñ'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬šŠÖ' with: 'á'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬š¬©' with: 'é'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬¶Šë' with: 'í'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬¶Šü' with: 'ó'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬¶¬ö' with: 'ú'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬®¬š¬±' with: 'ñ'. "" + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬Â¬¶Š±' with: 'Á'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬Â¬š¬¢' with: 'É'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬Â¬¶Šº' with: 'Í'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬Â¬š¬Ã' with: 'Ó'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬Â¬šŠ©' with: 'Ú'. + html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬Â¬š¬·' with: 'Ñ'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬¬¶Š±' with: 'Á'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬¬š¬¢' with: 'É'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬¬¶Šº' with: 'Í'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬¬š¬Æ' with: 'Ó'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬¬šŠ©' with: 'Ú'. - html := html copyReplaceAll: '¬š¬®¬š¬é¬š¬¬š¬·' with: 'Ñ'. "" html := html copyReplaceAll: ' ' with: '<br> '. html := html copyReplaceAll: ' ' with: ' '. "" aStream nextPutAll: html!
packages@lists.squeakfoundation.org