[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: '<'.
""
+ 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!
More information about the Squeak-dev
mailing list
|