1"====================================================================== 2| 3| Java run-time support. java.lang.Character native methods. 4| 5| 6 ======================================================================" 7 8 9"====================================================================== 10| 11| Copyright 2003 Free Software Foundation, Inc. 12| Written by Paolo Bonzini. 13| 14| This file is part of GNU Smalltalk. 15| 16| The GNU Smalltalk class library is free software; you can redistribute it 17| and/or modify it under the terms of the GNU General Public License 18| as published by the Free Software Foundation; either version 2, or (at 19| your option) any later version. 20| 21| The GNU Smalltalk class library is distributed in the hope that it will be 22| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 23| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 24| Public License for more details. 25| 26| You should have received a copy of the GNU Lesser General Public License 27| along with the GNU Smalltalk class library; see the file COPYING. If not, 28| write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, 29| Boston, MA 02110-1301, USA. 30| 31 ======================================================================" 32 33 34!JavaVM methodsFor: 'java.lang.Character'! 35 36java_lang_Character_readChar_char: arg1 37 <javaNativeMethod: #'readChar(C)C' 38 for: #{Java.java.lang.Character} static: true> 39 self notYetImplemented 40! 41 42java_lang_Character_toLowerCase_char: arg1 43 <javaNativeMethod: #'toLowerCase(C)C' 44 for: #{Java.java.lang.Character} static: true> 45 arg1 < 65 ifTrue: [ ^arg1 ]. 46 arg1 > 90 ifTrue: [ ^arg1 ]. 47 ^arg1 + 32 48! 49 50java_lang_Character_toUpperCase_char: arg1 51 <javaNativeMethod: #'toUpperCase(C)C' 52 for: #{Java.java.lang.Character} static: true> 53 arg1 < 97 ifTrue: [ ^arg1 ]. 54 arg1 > 122 ifTrue: [ ^arg1 ]. 55 ^arg1 - 32 56! 57 58java_lang_Character_toTitleCase_char: arg1 59 <javaNativeMethod: #'toTitleCase(C)C' 60 for: #{Java.java.lang.Character} static: true> 61 arg1 < 97 ifTrue: [ ^arg1 ]. 62 arg1 > 122 ifTrue: [ ^arg1 ]. 63 ^arg1 - 32 64! 65 66java_lang_Character_digit_char: arg1 int: arg2 67 | value | 68 <javaNativeMethod: #'digit(CI)I' 69 for: #{Java.java.lang.Character} static: true> 70 "Get the numeric value..." 71 arg1 < 48 ifTrue: [ value := -1 ] ifFalse: [ 72 arg1 <= 57 ifTrue: [ value := arg1 - 48 ] ifFalse: [ 73 arg1 < 65 ifTrue: [ value := -1 ] ifFalse: [ 74 arg1 <= 90 ifTrue: [ value := arg1 - 55 ] ifFalse: [ 75 arg1 < 97 ifTrue: [ value := -1 ] ifFalse: [ 76 arg1 <= 122 ifTrue: [ value := arg1 - 87 ]]]]]]. 77 78 "... then compare it against the radix." 79 value >= arg2 ifTrue: [ value := -1 ]. 80 ^value 81! 82 83java_lang_Character_getNumericValue_char: arg1 84 <javaNativeMethod: #'getNumericValue(C)I' 85 for: #{Java.java.lang.Character} static: true> 86 arg1 < 48 ifTrue: [ ^-1 ]. 87 arg1 <= 57 ifTrue: [ ^arg1 - 48 ]. 88 arg1 < 65 ifTrue: [ ^-1 ]. 89 arg1 <= 90 ifTrue: [ ^arg1 - 55 ]. 90 arg1 < 97 ifTrue: [ ^-1 ]. 91 arg1 <= 122 ifTrue: [ ^arg1 - 87 ]. 92 ^-1 93! 94 95java_lang_Character_getType_char: arg1 96 <javaNativeMethod: #'getType(C)I' 97 for: #{Java.java.lang.Character} static: true> 98 self notYetImplemented 99! 100 101java_lang_Character_getDirectionality_char: arg1 102 <javaNativeMethod: #'getDirectionality(C)B' 103 for: #{Java.java.lang.Character} static: true> 104 self notYetImplemented 105! ! 106 107