Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
authorStefan Vogel <sv@exept.de>
Fri, 05 Mar 2004 22:51:48 +0100
changeset 8102 e0537422e2d3
parent 8101 f7023a4735bf
child 8103 794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
CharacterArray.st
Class.st
--- a/CharacterArray.st	Fri Mar 05 22:47:33 2004 +0100
+++ b/CharacterArray.st	Fri Mar 05 22:51:48 2004 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1994 by Claus Gittinger
 	      All Rights Reserved
@@ -756,11 +754,11 @@
             "/ (romans).
             "/ Translation into roman-row is done at display time.
             "/
-            b1 := c asciiValue.
+            b1 := c codePoint.
             b1 >= 16rA1 ifTrue:[
                 srcIdx := srcIdx + 1.
                 srcIdx <= sz ifTrue:[
-                    b2 := (aString at:srcIdx) asciiValue.
+                    b2 := (aString at:srcIdx) codePoint.
                     val := (b1 bitShift:8) bitOr:b2.
                     c := Character value:val.
                 ]
@@ -851,7 +849,7 @@
 
         [srcIdx <= sz] whileTrue:[
             c := aString at:srcIdx.
-            b1 := c asciiValue.
+            b1 := c codePoint.
             b1 < 161 ifTrue:[
                 "/ characters below 16rA1 are left untranslated
                 "/ (control character or roman).
@@ -860,7 +858,7 @@
                 srcIdx := srcIdx + 1.
                 srcIdx <= sz ifTrue:[    
                     b1 := b1 - 128.
-                    b2 := (c2 := aString at:srcIdx) asciiValue.
+                    b2 := (c2 := aString at:srcIdx) codePoint.
                     b2 := b2 - 128.
                     val := (b1 bitShift:8) bitOr:b2.
                     val <= 0 ifTrue:[
@@ -1018,14 +1016,14 @@
             "/
             char1 := aString at:srcIdx.
             srcIdx := srcIdx + 1.
-            b1 := char1 asciiValue.
+            b1 := char1 codePoint.
 
             ((srcIdx <= sz) 
             and:[(b1 >= 129 and:[b1 <= 159])                 "/ SJIS1 81 .. 9F
                  or:[b1 >= 224 and:[b1 <= 239]]]) ifTrue:[   "/       E0 .. EF
                 char2 := aString at:srcIdx.
                 srcIdx := srcIdx + 1.
-                b2 := char2 asciiValue.
+                b2 := char2 codePoint.
                 (b2 >= 64 and:[b2 <= 252]) ifTrue:[          "/ SJIS2 40 .. FC
                     |adjust rowOffs cellOffs|
 
@@ -1133,7 +1131,7 @@
 
     1 to:sz do:[:index |
         c := aBIG5String at:index.
-        b := c asciiValue.
+        b := c codePoint.
 
         b > 255 ifTrue:[
             "/ big5 character
@@ -1174,7 +1172,7 @@
     out := WriteStream on:(String new:(sz * 2)).
 
     1 to:sz do:[:srcIndex |
-        b1 := (c := aJISString at:srcIndex) asciiValue.
+        b1 := (c := aJISString at:srcIndex) codePoint.
         b1 < 161 ifTrue:[
             "/ a control or roman character    
             out nextPut:c.
@@ -1227,7 +1225,7 @@
 
     1 to:sz do:[:index |
         c := aGBString at:index.
-        b := c asciiValue.
+        b := c codePoint.
         b > 255 ifTrue:[
             "/ big5 character
 
@@ -1276,7 +1274,7 @@
     out := WriteStream on:(String new:(sz * 2)).
 
     1 to:sz do:[:srcIndex |
-        val := (c := aJISString at:srcIndex) asciiValue.
+        val := (c := aJISString at:srcIndex) codePoint.
         val <= 128 ifTrue:[
             "/ a control or ascii character    
             out nextPut:c.
@@ -1375,7 +1373,7 @@
 
     1 to:sz do:[:index |
         c := aTwoByteString at:index.
-        b := c asciiValue.
+        b := c codePoint.
 
         (b > 32 and:[b <= 255]) ifTrue:[
             (i := b - 32 + 1) <= romans size ifTrue:[
@@ -3405,7 +3403,7 @@
      It is only possible, if there are no characters with codePoints above 255 in the receiver."
 
     self bitsPerCharacter == 8 ifTrue:[^ self].
-    (self contains:[:char | char asciiValue > 255]) ifFalse:[^ self asSingleByteString].
+    (self contains:[:char | char codePoint > 255]) ifFalse:[^ self asSingleByteString].
     ^ self
 
     "
@@ -3427,7 +3425,7 @@
         |char|
 
         char := self at:idx.
-        char asciiValue <= 16rFF ifTrue:[
+        char codePoint <= 16rFF ifTrue:[
             newString at:idx put:char
         ] ifFalse:[
             newString at:idx put:replacementCharacter
@@ -4265,7 +4263,7 @@
 
     1 to:mySize do:[:index |
         char := aString at:index.
-        oldCode := char asciiValue.
+        oldCode := char codePoint.
         oldCode >= maxCode ifFalse:[
             newCode := encodingTable at:(oldCode + 1).
             newCode ~~ oldCode ifTrue:[
@@ -4311,7 +4309,7 @@
     [in atEnd] whileFalse:[
         c := Character utf8DecodeFrom:in.
         is16Bit ifFalse:[
-            c asciiValue > 16rFF ifTrue:[
+            c codePoint > 16rFF ifTrue:[
                 out := WriteStream with:(UnicodeString fromString:out contents).
                 is16Bit := true.
             ].
@@ -4355,7 +4353,7 @@
     in := self readStream.
     [in atEnd] whileFalse:[
         c := Character utf8DecodeFrom:in.
-        c asciiValue > 16rFF ifTrue:[
+        c codePoint > 16rFF ifTrue:[
             c := replacementCharacter
         ].
         out nextPut:c.
@@ -6402,7 +6400,7 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.296 2004-03-05 17:33:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.297 2004-03-05 21:51:13 stefan Exp $'
 ! !
 
 CharacterArray initialize!
--- a/Class.st	Fri Mar 05 22:47:33 2004 +0100
+++ b/Class.st	Fri Mar 05 22:51:48 2004 +0100
@@ -1662,18 +1662,18 @@
     varnames := self allInstVarNames.
     n := varnames size.
     n == 0 ifTrue:[
-	sz := 0
+        sz := 0
     ] ifFalse:[
-	sz := varnames inject:0 into:[:sum :nm | sum + nm size].
-	sz := sz + n - 1.
+        sz := varnames inject:0 into:[:sum :nm | sum + nm size].
+        sz := sz + n - 1.
     ].
     stream nextNumber:2 put:sz.
     varnames keysAndValuesDo:[:i :nm |
-	stream nextPutBytes:(nm size) from:nm startingAt:1.
+        stream nextPutBytes:(nm size) from:nm startingAt:1.
 "/        nm do:[:c |
-"/            stream nextPut:c asciiValue
+"/            stream nextPut:c codePoint
 "/        ].
-	i ~~ n ifTrue:[stream nextPut:(Character space asciiValue)]
+        i ~~ n ifTrue:[stream nextPut:(Character space codePoint)]
     ].
 
     "
@@ -3916,12 +3916,12 @@
 
     nameKey := 0.
     self allInstVarNames do:[:name |
-	nameKey := nameKey bitShift:1.
-	(nameKey bitAnd:16r10000) ~~ 0 ifTrue:[
-	    nameKey := nameKey bitXor:1.
-	    nameKey := nameKey bitAnd:16rFFFF.
-	].
-	nameKey := (nameKey + (name at:1) asciiValue) bitAnd:16rFFFF.
+        nameKey := nameKey bitShift:1.
+        (nameKey bitAnd:16r10000) ~~ 0 ifTrue:[
+            nameKey := nameKey bitXor:1.
+            nameKey := nameKey bitAnd:16rFFFF.
+        ].
+        nameKey := (nameKey + (name at:1) codePoint) bitAnd:16rFFFF.
     ].
     value := value + (nameKey bitShift:14).
     signature := value.
@@ -4863,5 +4863,5 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.458 2004-03-05 17:51:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.459 2004-03-05 21:51:48 stefan Exp $'
 ! !