[squeak-dev] Re: [Pharo-project] 16rff is looking for a fix :)
Stéphane Ducasse
stephane.ducasse at inria.fr
Thu Feb 11 21:31:56 UTC 2010
Thanks
Stef
On Feb 11, 2010, at 10:21 PM, Eliot Miranda wrote:
> this in the thread spawned by Torsen's posting of Kent's most excellent rant:
> ttp://www.threeriversinstitute.org/blog/?p=466
>
> OK, fix is to two implementations of digitValue:. BTW, I haven't fixed Character class>>digitValue: which at least in my Teleplace image looks horribly broken, answering characters not integers. Check your distro, it may also be broken
>
> These fixes attached:
>
> 'From Croquet1.0beta of 11 April 2006 [latest update: #1] on 11 February 2010 at 1:17:50 pm'!
> !EncodedCharSet class methodsFor: 'class methods' stamp: 'eem 2/11/2010 13:13'!
> digitValue: char
> "Answer 0-9 if the receiver is $0-$9, 10-35 if it is $A-$Z, and < 0
> otherwise. This is used to parse literal numbers of radix 2-36."
>
> | value |
> value := char charCode.
> value <= $9 asciiValue ifTrue:
> [^value - $0 asciiValue].
> value >= $A asciiValue ifTrue:
> [value <= $Z asciiValue ifTrue: [^value - $A asciiValue + 10].
> (value >= $a asciiValue and: [value <= $z asciiValue]) ifTrue:
> [^value - $a asciiValue + 10]].
> ^ -1
> ! !
> !Unicode class methodsFor: 'class methods' stamp: 'eem 2/11/2010 13:17'!
> digitValue: char
>
> | value |
> value := char charCode.
> value <= $9 asciiValue ifTrue:
> [^value - $0 asciiValue].
> value >= $A asciiValue ifTrue:
> [value <= $Z asciiValue ifTrue: [^value - $A asciiValue + 10].
> (value >= $a asciiValue and: [value <= $z asciiValue]) ifTrue:
> [^value - $a asciiValue + 10]].
>
> value > (DecimalProperty size - 1) ifTrue: [^ -1].
> ^ (DecimalProperty at: value+1)
> ! !
>
> 2010/2/11 Stéphane Ducasse <stephane.ducasse at inria.fr>
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> <digitValue.st>_______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
More information about the Squeak-dev
mailing list
|