JavaClass.st
author cg
Tue, 03 Nov 1998 22:05:13 +0000
changeset 413 51672b6b5010
parent 407 568d64f6d7d6
child 415 b8abde6f5a0d
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
     1
Class subclass:#JavaClass
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
     2
	instanceVariableNames:'constantPool interfaces accessFlags classLoader fullName
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
     3
		sourceFile binaryFilePath fields initValues staticFields'
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
     4
	classVariableNames:'InitialValuePerType A_OBSOLETE A_INTERFACE A_PUBLIC A_FINAL
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
     5
		A_ABSTRACT A_INITIALIZED A_SMALLTALK'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
     6
	poolDictionaries:''
083530508d9c intitial checkin
cg
parents:
diff changeset
     7
	category:'Java-Classes'
083530508d9c intitial checkin
cg
parents:
diff changeset
     8
!
083530508d9c intitial checkin
cg
parents:
diff changeset
     9
133
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    10
!JavaClass class methodsFor:'documentation'!
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    11
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    12
documentation
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    13
"
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    14
    fields upTo-and-including accessFlags are known & used by the VM
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    15
    only add fields after those and keep their order intact.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    16
"
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    17
!
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    18
133
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    19
examples
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    20
"
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    21
    (Java at:'java.util.Stack') new inspect
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    22
    (Java at:'java.util.Vector') new inspect
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    23
"
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    24
! !
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    25
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
    26
!JavaClass class methodsFor:'initialization'!
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    27
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    28
initialize
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    29
    "/ those are defined in Java and read from the classFile
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    30
    A_PUBLIC      := 16r000001.
349
b8599d08f335 checkin from browser
cg
parents: 345
diff changeset
    31
    "/ A_PRIVATE     := 16r000002.
b8599d08f335 checkin from browser
cg
parents: 345
diff changeset
    32
    "/ A_PROTECTED   := 16r000004.
357
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
    33
    A_STATIC      := 16r000008.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    34
    A_FINAL       := 16r000010.
349
b8599d08f335 checkin from browser
cg
parents: 345
diff changeset
    35
    "/ A_SUPER         := 16r000020.
b8599d08f335 checkin from browser
cg
parents: 345
diff changeset
    36
    "/ A_SYNCHRONIZED  := 16r000020.
b8599d08f335 checkin from browser
cg
parents: 345
diff changeset
    37
    "/ A_VOLATILE      := 16r000040.
b8599d08f335 checkin from browser
cg
parents: 345
diff changeset
    38
    "/ A_TRANSIENT     := 16r000080.
357
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
    39
    A_NATIVE        := 16r000100.
349
b8599d08f335 checkin from browser
cg
parents: 345
diff changeset
    40
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    41
    A_INTERFACE   := 16r000200.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    42
    A_ABSTRACT    := 16r000400.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    43
    A_OBSOLETE    := 16r008000.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    44
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    45
    "/ those are local to the ST/X implementation
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    46
    A_INITIALIZED := 16r100000.
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
    47
    A_SMALLTALK   := 16r200000.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    48
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    49
    InitialValuePerType := IdentityDictionary new.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    50
    InitialValuePerType at:$B put:0.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    51
    InitialValuePerType at:$C put:0.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    52
    InitialValuePerType at:$D put:0.0.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    53
    InitialValuePerType at:$F put:(0.0 asShortFloat).
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    54
    InitialValuePerType at:$I put:0.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    55
    InitialValuePerType at:$J put:0.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    56
    InitialValuePerType at:$S put:0.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    57
    InitialValuePerType at:$Z put:0.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    58
    InitialValuePerType at:$L put:nil.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    59
    InitialValuePerType at:$[ put:nil.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    60
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    61
    "
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    62
     JavaClass initialize
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    63
    "
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
    64
357
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
    65
    "Modified: / 16.5.1998 / 01:18:48 / cg"
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    66
! !
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
    67
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
    68
!JavaClass class methodsFor:'instance creation'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    69
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    70
fullName:aString
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
    71
    self shouldNotImplement.
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
    72
    ^ self new flags:0; setFullName:aString
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    73
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    74
!
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    75
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    76
fullName:aString numStatic:nStatic
181
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
    77
    |meta cls fullName parts s ns|
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    78
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
    79
    "/ check for a JAVA nameSpace to exist
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
    80
    JAVA isNil ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    81
	Namespace name:'JAVA'
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
    82
    ].
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
    83
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    84
    "create the metaclass first"
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    85
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
    86
    meta := Metaclass new.
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
    87
    meta setSuperclass:(self).
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
    88
    meta instSize:(JavaClass instSize + nStatic).
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
    89
"/    meta setName:(aString , 'class') asSymbol.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
    90
"/    meta setClassVariableString:''.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    91
    meta flags:(meta flags bitOr:Behavior flagJavaClass).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
    92
"/    meta setSuperclass:JavaObject class.
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    93
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    94
    "then let the new meta create the class"
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    95
    cls := meta new.
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    96
    cls setSuperclass:JavaObject.
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    97
    cls instSize:0.
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
    98
    cls setName:('JAVA::' , aString).
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    99
    cls flags:0.
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   100
"/    cls setClassVariableString:''.
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   101
    cls setInstanceVariableString:''.
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   102
    cls category:#java.
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   103
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   104
    cls setFullName:aString.
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   105
181
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   106
    "/ break up the package and create nameSpaces
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   107
    "/ for each package component.
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   108
    "/ This allows java.foo.bar to be visible in ST/X
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   109
    "/ under the name JAVA::java::foo::bar
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   110
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   111
    ns := JAVA.
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   112
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   113
    parts := aString asCollectionOfSubstringsSeparatedBy:$/.
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   114
    parts size > 1 ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   115
	s := '' writeStream.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   116
	s nextPutAll:'JAVA'.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   117
	parts from:1 to:(parts size - 1) do:[:aPart |
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   118
	    s nextPutAll:'::'.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   119
	    s nextPutAll:aPart
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   120
	].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   121
	Metaclass confirmationQuerySignal answer:false do:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   122
	    Class updateChangeFileQuerySignal answer:false do:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   123
		ns := Namespace fullName:(s contents).
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   124
	    ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   125
	]
181
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   126
    ].
197
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   127
    ns isNamespace ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   128
	ns at:parts last asSymbol put:cls.
197
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   129
    ].
181
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   130
6ce22b4717d2 construct a nameSpace hierarchy to access java classes
cg
parents: 179
diff changeset
   131
    "/ for ST/X browsing
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   132
    Smalltalk at:('JAVA::' , aString) asSymbol put:cls.
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   133
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   134
    ^ cls
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   135
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   136
    "Created: / 15.4.1996 / 15:52:55 / cg"
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   137
    "Modified: / 3.1.1998 / 22:32:25 / cg"
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   138
!
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   139
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   140
name:aString
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   141
    self shouldNotImplement
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   142
083530508d9c intitial checkin
cg
parents:
diff changeset
   143
    "Created: 15.4.1996 / 15:52:55 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   144
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
   145
355
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   146
!JavaClass class methodsFor:'constants'!
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   147
357
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
   148
A_NATIVE
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
   149
    ^ A_NATIVE
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
   150
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
   151
    "Created: / 16.5.1998 / 01:18:43 / cg"
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
   152
!
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
   153
355
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   154
A_PUBLIC
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   155
    ^ A_PUBLIC
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   156
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   157
    "Created: / 13.5.1998 / 13:03:18 / cg"
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   158
!
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   159
357
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
   160
A_STATIC
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
   161
    ^ A_STATIC
355
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   162
357
90d866d87398 more st-class reading
cg
parents: 355
diff changeset
   163
    "Created: / 16.5.1998 / 00:02:07 / cg"
355
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   164
! !
9452f8876652 *** empty log message ***
cg
parents: 349
diff changeset
   165
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   166
!JavaClass class methodsFor:'method lookup'!
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   167
336
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   168
convertArgsToJava:argArray
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   169
    |newArgs|
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   170
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   171
    newArgs := argArray copy.
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   172
    newArgs keysAndValuesDo:[:idx :arg |
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   173
        arg isString ifTrue:[
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   174
            newArgs at:idx put:(Java as_String:arg)
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   175
        ]
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   176
    ].
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   177
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   178
    ^ newArgs
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   179
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   180
    "Created: / 9.4.1998 / 21:40:23 / cg"
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   181
!
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   182
236
46195f733e51 *** empty log message ***
cg
parents: 229
diff changeset
   183
lookupMethod:selector numArgs:nargs in:aClass static:staticMethod
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   184
    "lookup a method"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   185
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   186
    |method cls sel|
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   187
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   188
    sel := selector.
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   189
    (sel includes:$:) ifTrue:[
375
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   190
        sel := sel copyTo:(sel indexOf:$:)-1    
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   191
    ].
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   192
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   193
    sel := sel asSymbolIfInterned.
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   194
    sel notNil ifTrue:[
375
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   195
        cls := aClass.
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   196
375
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   197
        [cls notNil 
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   198
        and:[cls ~~ JavaObject
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   199
        and:[cls ~~ JavaClass]]] whileTrue:[
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   200
            cls methodDictionary keysAndValuesDo:[:jSel :aMethod |
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   201
                ((jSel == sel)
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   202
                or:[aMethod name = sel 
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   203
                or:[aMethod signatureNameWithoutReturnType = sel]])
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   204
                ifTrue:[
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   205
                    aMethod numArgs == nargs ifTrue:[
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   206
                        staticMethod ifTrue:[
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   207
                            aMethod isStatic ifTrue:[
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   208
                                ^ aMethod
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   209
                            ]
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   210
                        ] ifFalse:[
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   211
                            aMethod isStatic ifFalse:[
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   212
                                ^ aMethod
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   213
                            ]
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   214
                        ]
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   215
                    ]
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   216
                ]
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   217
            ].
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   218
375
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   219
            cls := cls superclass.
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   220
        ].
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   221
    ].
375
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   222
"/ self halt.
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   223
    ^ nil
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   224
375
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   225
    "Created: / 17.8.1997 / 18:25:47 / cg"
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   226
    "Modified: / 14.10.1998 / 14:59:27 / cg"
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   227
! !
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   228
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   229
!JavaClass class methodsFor:'signature parsing'!
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   230
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   231
initialValueFromSignature:aSignature
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   232
    "given a signature, return an initializer value"
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   233
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   234
    |s|
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   235
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   236
    s := aSignature readStream.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   237
    ^ self initialValueFromStream:s.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   238
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   239
    "
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   240
     JavaClass initialValueFromSignature:'LObject;'    
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   241
     JavaClass initialValueFromSignature:'B'        
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   242
     JavaClass initialValueFromSignature:'I'        
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   243
    "
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   244
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   245
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   246
!
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   247
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   248
initialValueFromStream:s
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   249
    "parse a fieldTypeSpec - see java doc"
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   250
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   251
    |typeChar|
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   252
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   253
    typeChar := s next.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   254
    ^ InitialValuePerType at:typeChar ifAbsent:nil.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   255
! !
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   256
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   257
!JavaClass class methodsFor:'special'!
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   258
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   259
setInstanceVariableStringFromFields:f in:aClass
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   260
    |varNames|
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   261
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   262
    varNames := ''.
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   263
    f do:[:aField |
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   264
	varNames := varNames , aField name , ' '
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   265
    ].
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   266
    aClass setInstanceVariableString:varNames.
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   267
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   268
    "Created: 15.4.1996 / 16:42:52 / cg"
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   269
! !
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   270
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   271
!JavaClass methodsFor:'accessing'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   272
74
c73026bf4528 *** empty log message ***
cg
parents: 73
diff changeset
   273
binaryFile
c73026bf4528 *** empty log message ***
cg
parents: 73
diff changeset
   274
    ^ binaryFilePath
c73026bf4528 *** empty log message ***
cg
parents: 73
diff changeset
   275
!
c73026bf4528 *** empty log message ***
cg
parents: 73
diff changeset
   276
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   277
category
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   278
    "java classes do not really hav a category;
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   279
     simulate one by separating its name into individual components,
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   280
     prepending 'java'"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   281
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   282
    |nameComponents|
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   283
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   284
    nameComponents := fullName asCollectionOfSubstringsSeparatedBy:$/.
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   285
    nameComponents size <= 1 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   286
	^ 'java' "/ fullName  
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   287
    ].
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   288
    ^ ((nameComponents asStringWith:$/ from:1 to:(nameComponents size - 1))) 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   289
	replaceAll:$/ with:$.
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   290
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   291
    "Modified: 30.7.1997 / 15:35:22 / cg"
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   292
!
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   293
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   294
classLoader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   295
    ^ classLoader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   296
!
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   297
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   298
classLoader:aJavaClassLoaderOrNil
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   299
    classLoader := aJavaClassLoaderOrNil
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   300
!
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   301
185
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   302
compiledMethodAt:name signature:sig
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   303
    "lookup the classes methodDictionary"
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   304
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   305
    methodDictionary keysAndValuesDo:[:mFullSelector :aMethod |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   306
	aMethod name == name ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   307
	    aMethod signature == sig ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   308
		^ aMethod
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   309
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   310
	]
185
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   311
    ].
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   312
    ^ nil
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   313
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   314
    "Created: 1.8.1997 / 00:01:58 / cg"
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   315
!
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   316
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   317
constantPool
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   318
    ^ constantPool
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   319
!
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   320
83
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   321
fields
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   322
    ^ fields
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   323
!
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   324
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   325
fullName
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   326
    ^ fullName
8
4df3a66460a3 can now read (undoc) 3.45 format
cg
parents: 7
diff changeset
   327
!
4df3a66460a3 can now read (undoc) 3.45 format
cg
parents: 7
diff changeset
   328
110
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
   329
interfaces
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
   330
    interfaces notNil ifTrue:[
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   331
	interfaces := interfaces collect:[:clsRef |
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   332
				    clsRef isUnresolved ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   333
					clsRef preResolve
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   334
				    ] ifFalse:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   335
					clsRef
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   336
				    ]
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   337
				 ].
110
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
   338
    ].
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
   339
    ^ interfaces
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
   340
!
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
   341
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
   342
javaClass
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
   343
    ^ self
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
   344
!
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
   345
8
4df3a66460a3 can now read (undoc) 3.45 format
cg
parents: 7
diff changeset
   346
name
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
   347
    ^ name "/ fullName
22
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   348
!
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   349
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   350
nameSpace
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   351
    ^ JAVA
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   352
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   353
    "Created: 20.1.1997 / 13:04:30 / cg"
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   354
!
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   355
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   356
nameWithoutNameSpacePrefix
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   357
    ^ fullName
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   358
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   359
    "Created: 20.1.1997 / 13:05:30 / cg"
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   360
!
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   361
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   362
nameWithoutPrefix
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   363
    ^ fullName
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   364
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   365
    "Created: 20.1.1997 / 13:06:06 / cg"
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   366
!
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   367
22
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   368
package
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   369
    "extract from the fullName"
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   370
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   371
    |components|
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   372
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   373
    components := fullName asCollectionOfSubstringsSeparatedBy:$/.
24
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   374
    components size > 1 ifTrue:[
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   375
	^ (components copyWithoutLast:1) asStringWith:$/
24
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   376
    ].
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   377
    ^ fullName
22
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   378
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   379
    "
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   380
     Java allClasses first fullName
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   381
     Java allClasses first package  
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   382
    "
24
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   383
!
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   384
76
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   385
source
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   386
    ^ Java classSourceOf:self
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   387
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   388
    "
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   389
     (Java at:'java.awt.Frame') source
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   390
     (Java at:'ArcTest') source
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   391
     (Java at:'ArcCanvas') source
76
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   392
    "
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   393
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   394
    "Modified: 30.7.1997 / 14:31:01 / cg"
76
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   395
!
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   396
24
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   397
sourceFile
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   398
    ^ sourceFile
83
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   399
!
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   400
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   401
staticFields
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   402
    ^ staticFields
132
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   403
!
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   404
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   405
typeOfField:aFieldName
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   406
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   407
    fields do:[:aField |
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   408
	aField name = aFieldName ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   409
	    ^ aField type
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   410
	]
132
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   411
    ].
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   412
    self error:'no such field'
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   413
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   414
    "
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   415
     (JAVA at:#'java/awt/image/ColorModel') typeOfField:'pixel_bits' 
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   416
    "
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   417
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
   418
    "Modified: 21.1.1997 / 22:48:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   419
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   420
213
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
   421
!JavaClass methodsFor:'adding / removing'!
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
   422
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
   423
removeFromSystem
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
   424
     Java removeClass:self
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
   425
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
   426
    "Created: 12.8.1997 / 02:46:51 / cg"
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
   427
! !
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
   428
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   429
!JavaClass methodsFor:'browser interface'!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   430
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   431
isVisualStartable
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   432
    "return true, if this is an application class,
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   433
     which can be started via #open"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   434
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   435
    "/ if I have a main() method, I am 
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   436
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   437
    (self compiledMethodAt:#'main([Ljava/lang/String;)V') notNil ifTrue:[
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   438
        ^ true
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   439
    ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   440
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   441
"/ NEEDS startApplet to work ...
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   442
"/    "/ if I inherit from Applet, I am 
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   443
"/
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   444
"/    (self isSubclassOf:(Java at:'java.applet.Applet')) ifTrue:[
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   445
"/        ^ true.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   446
"/    ].
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   447
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   448
    ^ false
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   449
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   450
    "Modified: / 3.11.1998 / 23:04:59 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   451
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   452
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   453
open
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   454
    "start a thread for my main method"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   455
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   456
    "/ if I have a main, call it ...
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   457
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   458
    (self compiledMethodAt:#'main([Ljava/lang/String;)V') notNil ifTrue:[
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   459
        ^ self startMain
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   460
    ].
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   461
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   462
    "/ otherwise, create a frame and wrap me;
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   463
    "/ as in:
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   464
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   465
"/    public static void main(String args[]) {
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   466
"/        Frame f = new Frame("myName");
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   467
"/        mySelf me = new mySelf();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   468
"/
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   469
"/        me.init();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   470
"/        me.start();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   471
"/
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   472
"/        f.add("Center", me);
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   473
"/        f.setSize(300, 300);
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   474
"/        f.show();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   475
"/    }
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   476
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   477
    ^ self startApplet
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   478
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   479
    "Created: / 15.1.1998 / 17:18:30 / cg"
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   480
    "Modified: / 3.11.1998 / 22:51:47 / cg"
407
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   481
!
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   482
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   483
syntaxHighlighterClass
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   484
    "return the parser to use for farmatting (prettyPrinting) this class - 
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   485
     this can be redefined in special classes, to get classes with
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   486
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   487
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   488
    self == JavaClass ifFalse:[
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   489
        ^ nil
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   490
    ].
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   491
    ^ super syntaxHighlighterClass
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   492
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   493
    "Created: / 22.10.1998 / 00:26:13 / cg"
568d64f6d7d6 checkin from browser
cg
parents: 393
diff changeset
   494
    "Modified: / 22.10.1998 / 00:27:02 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   495
! !
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   496
183
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   497
!JavaClass methodsFor:'compiler interface'!
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   498
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   499
compilerClass
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   500
    "return the compiler to use for this class - 
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   501
     this can be redefined in special classes, to get classes with
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   502
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   503
197
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   504
    ^ Compiler.
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   505
183
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   506
    ^ JavaCompiler
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   507
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   508
    "Created: 31.7.1997 / 23:03:37 / cg"
197
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   509
    "Modified: 4.8.1997 / 16:50:08 / cg"
183
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   510
!
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   511
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   512
evaluatorClass
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   513
    "return the compiler to use for expression evaluation for this class - 
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   514
     this can be redefined in special classes, to get classes with
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   515
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   516
197
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   517
    ^ Compiler.
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   518
183
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   519
    ^ JavaCompiler
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   520
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   521
    "Created: 31.7.1997 / 23:03:56 / cg"
197
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   522
    "Modified: 4.8.1997 / 16:49:14 / cg"
183
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   523
!
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   524
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   525
parserClass
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   526
    "return the parser to use for parsing this class - 
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   527
     this can be redefined in special classes, to get classes with
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   528
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   529
197
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   530
    ^ Compiler.
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   531
183
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   532
    ^ JavaCompiler
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   533
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   534
    "Created: 31.7.1997 / 23:04:11 / cg"
197
97fa933db02f *** empty log message ***
cg
parents: 195
diff changeset
   535
    "Modified: 4.8.1997 / 16:50:18 / cg"
183
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   536
! !
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
   537
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   538
!JavaClass methodsFor:'documentation support'!
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   539
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   540
htmlDocumentation
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   541
    ^ nil "/ replace by access to javadoc-generated documentation later
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   542
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   543
    "Modified: 22.3.1997 / 14:18:50 / cg"
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   544
! !
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   545
312
f753abec575a more app-starters
cg
parents: 281
diff changeset
   546
!JavaClass methodsFor:'executing programs'!
f753abec575a more app-starters
cg
parents: 281
diff changeset
   547
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   548
startApplet
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   549
    |f me stub|
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   550
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   551
    "/ TODO: setup embeddedAppletFrame correctly
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   552
    "/ (for getParameter to work ...)
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   553
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   554
    "/ create a frame and wrap me;
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   555
    "/ as in:
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   556
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   557
"/    public static void main(String args[]) {
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   558
"/        Frame f = new Frame("myName");
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   559
"/        mySelf me = new mySelf();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   560
"/
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   561
"/        me.init();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   562
"/        me.start();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   563
"/
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   564
"/        f.add("Center", me);
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   565
"/        f.setSize(300, 300);
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   566
"/        f.show();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   567
"/    }
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   568
    f := (Java at:'java.awt.Frame') basicNew.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   569
    f perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:self name).
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   570
self halt.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   571
    me := self basicNew.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   572
    me perform:#'<init>()V'.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   573
self halt.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   574
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   575
    stub := (Java at:'netscape.applet.EmbeddedAppletFrame') new.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   576
    me instVarNamed:'stub' put:stub.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   577
self halt.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   578
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   579
    me perform:#'init()V'.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   580
    me perform:#'start()V'.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   581
self halt.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   582
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   583
    f perform:#'add(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;' 
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   584
         with:(Java as_String:'Center')
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   585
         with:me.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   586
self halt.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   587
    f perform:#'setSize(II)V' with:300 with:300.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   588
self halt.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   589
    f perform:#'show()V'.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   590
self halt.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   591
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   592
    "Modified: / 3.11.1998 / 23:04:41 / cg"
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   593
!
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
   594
312
f753abec575a more app-starters
cg
parents: 281
diff changeset
   595
startMain
f753abec575a more app-starters
cg
parents: 281
diff changeset
   596
    "start a thread for my main() method"
f753abec575a more app-starters
cg
parents: 281
diff changeset
   597
f753abec575a more app-starters
cg
parents: 281
diff changeset
   598
    Java executeMainOf:self
f753abec575a more app-starters
cg
parents: 281
diff changeset
   599
f753abec575a more app-starters
cg
parents: 281
diff changeset
   600
    "Created: / 5.2.1998 / 00:36:06 / cg"
f753abec575a more app-starters
cg
parents: 281
diff changeset
   601
    "Modified: / 5.2.1998 / 00:37:15 / cg"
f753abec575a more app-starters
cg
parents: 281
diff changeset
   602
!
f753abec575a more app-starters
cg
parents: 281
diff changeset
   603
f753abec575a more app-starters
cg
parents: 281
diff changeset
   604
startMainWithArgumentString:aCommandLineString
f753abec575a more app-starters
cg
parents: 281
diff changeset
   605
    "start a thread for my main() method, passing a string with arguments"
f753abec575a more app-starters
cg
parents: 281
diff changeset
   606
f753abec575a more app-starters
cg
parents: 281
diff changeset
   607
    Java executeMainOf:self withArgumentString:aCommandLineString
f753abec575a more app-starters
cg
parents: 281
diff changeset
   608
f753abec575a more app-starters
cg
parents: 281
diff changeset
   609
    "Modified: / 5.2.1998 / 00:37:25 / cg"
f753abec575a more app-starters
cg
parents: 281
diff changeset
   610
    "Created: / 5.2.1998 / 00:41:15 / cg"
f753abec575a more app-starters
cg
parents: 281
diff changeset
   611
! !
f753abec575a more app-starters
cg
parents: 281
diff changeset
   612
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   613
!JavaClass methodsFor:'fileOut'!
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   614
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   615
basicFileOutDefinitionOn:aStream withNameSpace:nameSpaceBoolean
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   616
    JavaDecompiler definitionOf:self on:aStream
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   617
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   618
    "Modified: 22.3.1997 / 14:30:28 / cg"
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   619
!
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   620
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   621
fileOut
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   622
    self warn:'fileOut not yet supported'
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   623
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   624
    "Modified: 22.3.1997 / 14:30:28 / cg"
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   625
    "Created: 22.3.1997 / 14:35:43 / cg"
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   626
! !
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   627
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   628
!JavaClass methodsFor:'java initialization'!
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   629
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   630
classInit
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   631
    "call the classes JAVA clinit function"
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   632
63
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
   633
    |m|
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   634
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   635
    (accessFlags bitAnd:A_INITIALIZED) ~~ 0 ifTrue:[^ self].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   636
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   637
    accessFlags := accessFlags bitOr:A_INITIALIZED.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   638
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   639
    superclass ~~ JavaObject ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   640
        superclass classInit
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   641
    ].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   642
"/    "/ also, all referenced classes must be ...
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   643
"/    constantPool classReferencesDo:[:aClass |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   644
"/        aClass classInit
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   645
"/    ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   646
63
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
   647
    m := self compiledMethodAt:#'<clinit>()V'.
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
   648
    m notNil ifTrue:[
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
   649
"/        'calling clinit() of ' print. self fullName printNL.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   650
        [
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   651
            m valueWithReceiver:self arguments:#()
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   652
        ] valueOnUnwindDo:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   653
            accessFlags := accessFlags bitXor:A_INITIALIZED.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   654
        ]
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   655
    ] ifFalse:[
71
feb1b4907dd4 *** empty log message ***
cg
parents: 69
diff changeset
   656
"/        self fullName print. ' has no clinit()' printNL.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   657
    ].
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   658
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   659
    "
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   660
     JavaVM instructionTrace:true.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   661
     JavaVM callTrace:true.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   662
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   663
     (Java classNamed:'java.lang.String') classInit
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   664
     (Java classNamed:'java.lang.System') classInit
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   665
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   666
     (Java classNamed:'java/io/FileDescriptor') classInit
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   667
     (Java classNamed:'java.util.Properties') classInit 
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   668
    "
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   669
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   670
    "Modified: / 13.1.1998 / 14:43:11 / cg"
195
7b64a690f274 *** empty log message ***
cg
parents: 185
diff changeset
   671
!
7b64a690f274 *** empty log message ***
cg
parents: 185
diff changeset
   672
60
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
   673
initializeStaticFields
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
   674
    staticFields isNil ifTrue:[^ self].
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
   675
60
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
   676
    staticFields do:[:f |
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   677
	|val type|
86
3090f19a5be1 *** empty log message ***
cg
parents: 83
diff changeset
   678
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   679
	(val := f constantValue) isNil ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   680
	    "/ careful: int/long etc. constants must be initialized
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   681
	    "/ with correct type.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   682
	    type := f type.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   683
	    type == #long ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   684
		val := 0.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   685
	    ] ifFalse:[type == #int ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   686
		val := 0.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   687
	    ] ifFalse:[type == #float ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   688
		val := 0.0 asShortFloat
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   689
	    ] ifFalse:[type == #double ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   690
		val := 0.0 
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   691
	    ] ifFalse:[type == #byte ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   692
		val := 0.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   693
	    ] ifFalse:[type == #char ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   694
		val := 0.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   695
	    ] ifFalse:[type == #'unsigned short' ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   696
		val := 0.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   697
	    ] ifFalse:[type == #boolean ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   698
		val := 0.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   699
	    ]]]]]]]].
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   700
	].
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   701
	self instVarNamed:(f name) put:val.
60
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
   702
    ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   703
! !
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   704
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   705
!JavaClass methodsFor:'java instance creation'!
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
   706
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   707
initValueFor:instVarName
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   708
    |idx field|
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   709
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   710
    idx := fields findFirst:[:field | field name = instVarName].
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   711
    idx == 0 ifTrue:[
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   712
	superclass ~~ JavaObject ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   713
	    ^ superclass initValueFor:instVarName
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   714
	].
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   715
	self halt
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   716
    ] ifFalse:[
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   717
	field := fields at:idx.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   718
	^ field initialValue
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   719
    ].
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   720
!
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   721
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   722
new
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   723
    "create a new instance, preset its fields,
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   724
     and call its JAVA init function"
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   725
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   726
    |newJavaObject sz "{ Class: SmallInteger }"|
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   727
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   728
    "/ (self isInterface or:[self isAbstract]) ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   729
    (accessFlags bitAnd:(A_INTERFACE bitOr:A_ABSTRACT)) ~~ 0 ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   730
        JavaVM throwInstantiationExceptionFor:self.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   731
        ^ nil
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   732
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   733
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   734
    newJavaObject := super basicNew.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   735
    initValues notNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   736
        "/ newJavaObject initializeFields:initValues
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   737
        sz := self instSize.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   738
        1 to:sz do:[:i |
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   739
            newJavaObject instVarAt:i put:(initValues at:i)
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   740
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   741
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   742
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   743
    newJavaObject perform:#'<init>()V'.
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   744
    ^ newJavaObject
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   745
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   746
    "
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   747
     (Java classNamed:'java.lang.String') basicNew inspect
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   748
     (Java classNamed:'java.lang.String') new inspect
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   749
    "
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   750
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   751
    "Modified: / 14.1.1998 / 23:16:19 / cg"
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   752
!
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   753
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   754
newCleared
148
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   755
    "create a new cleared JAVA instance.
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   756
     Its instVars are cleared to the corresponding typed values;
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   757
     however, <init> is not invoked for it."
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   758
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   759
    |newJavaObject sz "{ Class: SmallInteger }" |
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
   760
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   761
    "/ (self isInterface or:[self isAbstract]) ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   762
    (accessFlags bitAnd:(A_INTERFACE bitOr:A_ABSTRACT)) ~~ 0 ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   763
        JavaVM throwInstantiationExceptionFor:self.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   764
        ^ nil
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   765
    ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   766
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   767
    newJavaObject := super basicNew.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   768
    initValues notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   769
        "/ newJavaObject initializeFields:initValues
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   770
        sz := self instSize.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   771
        1 to:sz do:[:i |
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   772
            newJavaObject instVarAt:i put:(initValues at:i)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   773
        ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   774
    ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   775
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
   776
    ^ newJavaObject
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   777
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   778
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   779
     (Java classNamed:'java.lang.String') basicNew inspect
53
e10c1dd4ea3b checkin from browser
cg
parents: 52
diff changeset
   780
     (Java classNamed:'java.lang.String') newCleared inspect
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   781
     (Java classNamed:'java.lang.String') new inspect
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   782
    "
148
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   783
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   784
    "Modified: / 14.1.1998 / 23:16:26 / cg"
148
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   785
!
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   786
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   787
newFromInterpreter:anInterpreter sender:aJavaContext
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   788
    "create a new instance, and call its JAVA init function.
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   789
     This is done in the context of an already running interpreter."
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   790
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   791
    |newJavaObject|
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   792
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   793
    newJavaObject := self newCleared.
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   794
    newJavaObject invoke:#'<init>' interpreter:anInterpreter sender:aJavaContext.
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   795
    ^ newJavaObject
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   796
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
   797
    "Created: 18.3.1997 / 17:33:07 / cg"
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   798
! !
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   799
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   800
!JavaClass methodsFor:'message sending'!
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   801
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   802
invokeJavaMethod:aJavaMethod interpreter:i sender:aContext selector:sel
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   803
    "invoke a static java method, without argument"
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   804
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   805
    |val|
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   806
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   807
    aJavaMethod numArgs ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   808
	self halt:'argument count'
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   809
    ].
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   810
    aJavaMethod isStatic ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   811
	self halt:'non-static function'
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   812
    ].
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   813
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   814
    val := i interpret:aJavaMethod sender:aContext.
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   815
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   816
    ^ JavaObject convertJavaObject:val signature:(aJavaMethod retValSignature)
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   817
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   818
    "Created: 17.8.1997 / 18:05:14 / cg"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   819
    "Modified: 17.8.1997 / 18:08:22 / cg"
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   820
!
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   821
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   822
invokeJavaMethod:aJavaMethod interpreter:i sender:aContext selector:sel with:arg1
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   823
    "invoke a static java method, with 1 argument"
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   824
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   825
    |val|
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   826
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   827
    aJavaMethod numArgs ~~ 1 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   828
	self halt:'argument count'
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   829
    ].
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   830
    aJavaMethod isStatic ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   831
	self halt:'non-static function'
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   832
    ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   833
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   834
    i push:arg1.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   835
    val := i interpret:aJavaMethod sender:aContext.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   836
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   837
    ^ JavaObject convertJavaObject:val signature:(aJavaMethod retValSignature)
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   838
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   839
    "Created: 17.8.1997 / 18:03:58 / cg"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   840
    "Modified: 17.8.1997 / 18:08:27 / cg"
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   841
!
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   842
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   843
invokeJavaMethod:aJavaMethod sender:aContext selector:sel
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   844
    "invoke a static java method, without arguments"
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   845
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   846
    ^ self
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   847
	invokeJavaMethod:aJavaMethod
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   848
	interpreter:(JavaInterpreter new)
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   849
	sender:aContext 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   850
	selector:sel
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   851
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   852
    "Modified: 17.8.1997 / 18:05:35 / cg"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   853
!
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   854
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   855
invokeJavaMethod:aJavaMethod sender:aContext selector:sel with:arg1
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   856
    "invoke a static java method, with 1 argument"
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   857
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   858
    ^ self
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   859
	invokeJavaMethod:aJavaMethod
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   860
	interpreter:(JavaInterpreter new)
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   861
	sender:aContext 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   862
	selector:sel 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   863
	with:arg1
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   864
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   865
    "Modified: 17.8.1997 / 18:04:44 / cg"
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   866
!
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
   867
200
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   868
invokeStatic:selector
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   869
    "send a static message, without args."
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   870
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   871
    |method cls sel|
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   872
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   873
    sel := selector asSymbolIfInterned.
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   874
    sel notNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   875
        cls := self.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   876
        [cls notNil and:[cls ~~ JavaObject]] whileTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   877
            cls methodDictionary keysAndValuesDo:[:sel :aMethod |
200
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   878
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   879
"/     aMethod name printNL.
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   880
        
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   881
                aMethod isStatic ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   882
                    sel == selector ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   883
                        ^ aMethod valueWithReceiver:self arguments:#()
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   884
                    ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   885
                ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   886
            ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   887
            cls := cls superclass.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   888
        ].
200
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   889
    ].
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   890
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   891
    ^ self doesNotUnderstand:(Message selector:selector)
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   892
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   893
    "Created: / 5.8.1997 / 14:35:34 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   894
    "Modified: / 15.1.1998 / 00:31:27 / cg"
200
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   895
!
518c67464105 *** empty log message ***
cg
parents: 197
diff changeset
   896
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   897
lookupMethodFor:selector
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   898
    |method cls sel|
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   899
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   900
    sel := selector asSymbolIfInterned.
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   901
    sel notNil ifTrue:[
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   902
	cls := self.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   903
	[cls notNil] whileTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   904
	    method := cls compiledMethodAt:sel.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   905
	    method notNil ifTrue:[ ^ method ].
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   906
	    cls := cls superclass.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   907
	].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   908
    ].
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   909
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   910
    ^ nil
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
   911
! !
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
   912
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   913
!JavaClass methodsFor:'printOut'!
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   914
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   915
printNameInHierarchy
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   916
    "return my name as printed in the hierarchy"
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   917
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   918
    ^ self displayString
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   919
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   920
    "Modified: 22.3.1997 / 14:16:55 / cg"
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   921
!
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   922
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   923
printOutOn:aStream
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   924
    self warn:'printOut not yet supported'
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   925
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   926
    "Created: 22.3.1997 / 14:36:12 / cg"
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   927
!
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   928
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   929
printOutProtocolOn:aStream
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   930
    self warn:'printOut not yet supported'
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   931
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   932
    "Created: 22.3.1997 / 14:36:28 / cg"
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   933
! !
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
   934
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   935
!JavaClass methodsFor:'printing & storing'!
083530508d9c intitial checkin
cg
parents:
diff changeset
   936
083530508d9c intitial checkin
cg
parents:
diff changeset
   937
displayString
360
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 357
diff changeset
   938
    ^ fullName copyReplaceAll:$/ with:$.
125
c99addd65f73 *** empty log message ***
cg
parents: 113
diff changeset
   939
41
eb7974d88088 checkin from browser
cg
parents: 40
diff changeset
   940
"/    ^ 'JAVA-' , name .
eb7974d88088 checkin from browser
cg
parents: 40
diff changeset
   941
"/    ^ name , '(Java)'  "/ 'JavaClass(' , name , ')'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   942
360
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 357
diff changeset
   943
    "Created: / 15.4.1996 / 16:02:48 / cg"
e3df9401df00 use #copyReplaceAll:with:
cg
parents: 357
diff changeset
   944
    "Modified: / 18.7.1998 / 22:56:30 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   945
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
   946
083530508d9c intitial checkin
cg
parents:
diff changeset
   947
!JavaClass methodsFor:'private accessing'!
083530508d9c intitial checkin
cg
parents:
diff changeset
   948
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   949
addMethod:m name:name signature:signature
63
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
   950
    |sel|
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
   951
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
   952
    sel := (name , signature) asSymbol.
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
   953
    self addSelector:sel withMethod:m.
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
   954
    ^ self.
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
   955
98
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
   956
"/    selectorArray isNil ifTrue:[
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
   957
"/        selectorArray := #().
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
   958
"/        methodArray := #()
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
   959
"/    ].
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
   960
"/    selectorArray := selectorArray copyWith:(name , signature) asSymbol. "/ name.
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
   961
"/"/    selectorArray := selectorArray copyWith:name asSymbol. "/ name.
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
   962
"/    methodArray := methodArray copyWith:m
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   963
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   964
    "Created: 15.4.1996 / 16:42:52 / cg"
98
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
   965
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
   966
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   967
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   968
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   969
addSelector:newSelector withMethod:newMethod
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   970
    "redefined to not flush smalltalk caches and send NO smalltalk-class
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   971
     change notification. Will eventually flush Java caches."
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   972
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   973
    |nargs oldMethod|
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   974
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   975
    oldMethod := self compiledMethodAt:newSelector.
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   976
    (self primAddSelector:newSelector withMethod:newMethod) ifFalse:[^ false].
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   977
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   978
    ^ true
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   979
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   980
    "Created: 20.1.1997 / 13:00:48 / cg"
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   981
!
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   982
204
c2f7436ceaaa checkin from browser
cg
parents: 203
diff changeset
   983
makeObsolete
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   984
    accessFlags := accessFlags bitOr:A_OBSOLETE
204
c2f7436ceaaa checkin from browser
cg
parents: 203
diff changeset
   985
c2f7436ceaaa checkin from browser
cg
parents: 203
diff changeset
   986
    "Created: 7.8.1997 / 19:04:48 / cg"
c2f7436ceaaa checkin from browser
cg
parents: 203
diff changeset
   987
!
c2f7436ceaaa checkin from browser
cg
parents: 203
diff changeset
   988
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   989
markUninitialized
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   990
    (accessFlags bitAnd:A_INITIALIZED) ~~ 0 ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   991
	accessFlags := accessFlags bitXor:A_INITIALIZED
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   992
    ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   993
!
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
   994
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   995
setAccessFlags:flags
3
e3c2a84b2a72 checkin from browser
cg
parents: 1
diff changeset
   996
    accessFlags := flags.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   997
083530508d9c intitial checkin
cg
parents:
diff changeset
   998
    "Created: 15.4.1996 / 16:42:52 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   999
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1000
73
a1268823f1a4 *** empty log message ***
cg
parents: 71
diff changeset
  1001
setBinaryFilePath:aPathName
a1268823f1a4 *** empty log message ***
cg
parents: 71
diff changeset
  1002
    binaryFilePath := aPathName
a1268823f1a4 *** empty log message ***
cg
parents: 71
diff changeset
  1003
!
a1268823f1a4 *** empty log message ***
cg
parents: 71
diff changeset
  1004
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1005
setConstantPool:anArray
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1006
    constantPool := anArray.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1007
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1008
    "Created: 15.4.1996 / 16:42:52 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1009
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1010
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1011
setFields:f
54
f37bcefb7091 avoid loading classes twice
cg
parents: 53
diff changeset
  1012
    JavaClass setInstanceVariableStringFromFields:f in:self.
f37bcefb7091 avoid loading classes twice
cg
parents: 53
diff changeset
  1013
f37bcefb7091 avoid loading classes twice
cg
parents: 53
diff changeset
  1014
    instSize := superclass instSize + f size.
f37bcefb7091 avoid loading classes twice
cg
parents: 53
diff changeset
  1015
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1016
    fields := f.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1017
    initValues := self allInstVarNames collect:[:nm |
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1018
	self initValueFor:nm
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1019
    ].
76
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
  1020
    initValues isEmpty ifTrue:[
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1021
	initValues := nil
76
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
  1022
    ].
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1023
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1024
    "Created: 15.4.1996 / 16:42:52 / cg"
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1025
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1026
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1027
!
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1028
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
  1029
setFullName:aString
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
  1030
    |nameComponents|
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
  1031
125
c99addd65f73 *** empty log message ***
cg
parents: 113
diff changeset
  1032
    fullName := aString asSymbol.
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
  1033
    nameComponents := aString asCollectionOfSubstringsSeparatedBy:$/.
125
c99addd65f73 *** empty log message ***
cg
parents: 113
diff changeset
  1034
    name := nameComponents last asSymbol
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
  1035
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
  1036
    "Created: 15.4.1996 / 16:42:52 / cg"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
  1037
!
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
  1038
110
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  1039
setInterfaces:i
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  1040
    i size > 0 ifTrue:[
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1041
	interfaces := i
168
90e39cb3fa04 *** empty log message ***
cg
parents: 160
diff changeset
  1042
    ] ifFalse:[
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1043
	interfaces := nil
110
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  1044
    ]
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  1045
168
90e39cb3fa04 *** empty log message ***
cg
parents: 160
diff changeset
  1046
    "Modified: 7.4.1997 / 15:44:53 / cg"
110
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  1047
!
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  1048
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1049
setSourceFile:aFilename
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1050
    sourceFile := aFilename.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1051
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1052
    "Created: 15.4.1996 / 16:42:52 / cg"
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1053
!
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1054
60
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  1055
setStaticFields:f
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  1056
    JavaClass setInstanceVariableStringFromFields:f in:self class.
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  1057
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  1058
    staticFields := f.
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  1059
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  1060
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  1061
!
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  1062
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1063
setSuperclass:aClass
247
67dd93db3d80 adapt to change in ClassDescription
cg
parents: 236
diff changeset
  1064
    |iVars numIvars|
67dd93db3d80 adapt to change in ClassDescription
cg
parents: 236
diff changeset
  1065
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1066
    aClass isNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1067
	super setSuperclass:JavaObject
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  1068
    ] ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1069
	(aClass isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1070
	    self halt.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1071
	].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1072
	super setSuperclass:aClass.
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1073
    ].
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  1074
247
67dd93db3d80 adapt to change in ClassDescription
cg
parents: 236
diff changeset
  1075
    iVars := self instVarNames.
67dd93db3d80 adapt to change in ClassDescription
cg
parents: 236
diff changeset
  1076
    ((numIvars := iVars size) > 0) ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1077
	(superclass notNil and:[(superclass isMemberOf:JavaUnresolvedClassConstant) not]) ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1078
	    instSize := superclass instSize + numIvars
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1079
	] ifFalse:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1080
	    instSize := numIvars
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1081
	]
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  1082
    ].
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1083
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1084
    "Created: 15.4.1996 / 16:42:52 / cg"
247
67dd93db3d80 adapt to change in ClassDescription
cg
parents: 236
diff changeset
  1085
    "Modified: 22.8.1997 / 15:06:45 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1086
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
  1087
18
6c07dc4b1118 checkin from browser
cg
parents: 8
diff changeset
  1088
!JavaClass methodsFor:'queries'!
6c07dc4b1118 checkin from browser
cg
parents: 8
diff changeset
  1089
42
b93a36fbb245 checkin from browser
cg
parents: 41
diff changeset
  1090
browserClass
b93a36fbb245 checkin from browser
cg
parents: 41
diff changeset
  1091
    "return the browser to use for this class - 
b93a36fbb245 checkin from browser
cg
parents: 41
diff changeset
  1092
     this can be redefined in special classes, to get different browsers"
b93a36fbb245 checkin from browser
cg
parents: 41
diff changeset
  1093
375
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
  1094
    ^ SystemBrowser "/ JavaBrowser
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
  1095
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
  1096
    "Modified: / 14.10.1998 / 15:28:38 / cg"
42
b93a36fbb245 checkin from browser
cg
parents: 41
diff changeset
  1097
!
b93a36fbb245 checkin from browser
cg
parents: 41
diff changeset
  1098
53
e10c1dd4ea3b checkin from browser
cg
parents: 52
diff changeset
  1099
hasInterface:aJavaInterface
281
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1100
    "return true, if I respond to all methods as
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1101
     required by the argument, an aJavaInterface"
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1102
111
23243f9273fa *** empty log message ***
cg
parents: 110
diff changeset
  1103
    interfaces size > 0 ifTrue:[
281
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1104
        self interfaces do:[:if |
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1105
            aJavaInterface == if ifTrue:[
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1106
                ^ true
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1107
            ].
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1108
        ]
111
23243f9273fa *** empty log message ***
cg
parents: 110
diff changeset
  1109
    ].
281
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1110
"/    ^ false.
111
23243f9273fa *** empty log message ***
cg
parents: 110
diff changeset
  1111
69
7918222f9544 more methodDictionary changes
cg
parents: 67
diff changeset
  1112
    aJavaInterface methodDictionary keysAndValuesDo:[:sel :mthd |
281
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1113
        (self canUnderstand:sel) ifFalse:[
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1114
            ^ false.
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1115
        ]
53
e10c1dd4ea3b checkin from browser
cg
parents: 52
diff changeset
  1116
    ].
e10c1dd4ea3b checkin from browser
cg
parents: 52
diff changeset
  1117
    ^ true
281
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1118
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  1119
    "Modified: / 28.1.1998 / 01:46:16 / cg"
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1120
!
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1121
83
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
  1122
isAbstract
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1123
    "return true, if the receiver is abstract
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1124
     (i.e. may not have instances)"
83
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
  1125
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1126
    ^ (accessFlags bitAnd:A_ABSTRACT) ~~ 0
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1127
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1128
    "Modified: / 7.5.1998 / 12:24:42 / cg"
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1129
!
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  1130
18
6c07dc4b1118 checkin from browser
cg
parents: 8
diff changeset
  1131
isFinal
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1132
    "return true, if the receiver is final
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1133
     (i.e. may not be subclassed)"
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1134
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1135
    ^ (accessFlags bitAnd:A_FINAL) ~~ 0
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1136
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1137
    "Modified: / 7.5.1998 / 12:24:21 / cg"
18
6c07dc4b1118 checkin from browser
cg
parents: 8
diff changeset
  1138
!
6c07dc4b1118 checkin from browser
cg
parents: 8
diff changeset
  1139
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1140
isInitialized
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1141
    "return true, if the receiver is initialized"
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1142
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1143
    ^ (accessFlags bitAnd:A_INITIALIZED) ~~ 0
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1144
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1145
    "Modified: / 7.5.1998 / 12:23:54 / cg"
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1146
!
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1147
18
6c07dc4b1118 checkin from browser
cg
parents: 8
diff changeset
  1148
isInterface
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1149
    "return true, if the receiver is an interface"
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1150
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1151
    ^ (accessFlags bitAnd:A_INTERFACE) ~~ 0
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1152
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1153
    "Modified: / 7.5.1998 / 12:23:39 / cg"
18
6c07dc4b1118 checkin from browser
cg
parents: 8
diff changeset
  1154
!
6c07dc4b1118 checkin from browser
cg
parents: 8
diff changeset
  1155
148
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  1156
isJavaClass
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  1157
    ^ self ~~ JavaClass
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  1158
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  1159
    "Created: 18.3.1997 / 17:48:01 / cg"
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  1160
!
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  1161
71
feb1b4907dd4 *** empty log message ***
cg
parents: 69
diff changeset
  1162
isObsolete 
feb1b4907dd4 *** empty log message ***
cg
parents: 69
diff changeset
  1163
    "return true, if the receiver is obsolete 
feb1b4907dd4 *** empty log message ***
cg
parents: 69
diff changeset
  1164
     Java classes are never."
feb1b4907dd4 *** empty log message ***
cg
parents: 69
diff changeset
  1165
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1166
    ^ (accessFlags bitAnd:A_OBSOLETE) ~~ 0.
71
feb1b4907dd4 *** empty log message ***
cg
parents: 69
diff changeset
  1167
204
c2f7436ceaaa checkin from browser
cg
parents: 203
diff changeset
  1168
    "Modified: 7.8.1997 / 19:04:28 / cg"
71
feb1b4907dd4 *** empty log message ***
cg
parents: 69
diff changeset
  1169
!
feb1b4907dd4 *** empty log message ***
cg
parents: 69
diff changeset
  1170
18
6c07dc4b1118 checkin from browser
cg
parents: 8
diff changeset
  1171
isPublic
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1172
    "return true, if the receiver is public" 
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1173
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1174
    ^ (accessFlags bitAnd:A_PUBLIC) ~~ 0
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1175
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1176
    "Modified: / 7.5.1998 / 12:22:44 / cg"
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
  1177
!
21
b9dd73f299dd checkin from browser
cg
parents: 18
diff changeset
  1178
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
  1179
isUnresolved
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1180
    "return true, if the receiver is unresolved;
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1181
     javaClasses are never; JavaUnresolvedClasses are always" 
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1182
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
  1183
    ^ false
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1184
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1185
    "Modified: / 7.5.1998 / 12:23:14 / cg"
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1186
!
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1187
393
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1188
nameSpacePath
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1189
    |parts s|
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1190
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1191
    parts := self fullName asCollectionOfSubstringsSeparatedBy:$/.
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1192
    s := '' writeStream.
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1193
    s nextPutAll:'JAVA'.
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1194
    parts from:1 to:(parts size - 1) do:[:aPart |
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1195
        s nextPutAll:'::'.
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1196
        s nextPutAll:aPart
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1197
    ].
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1198
    ^ s contents
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1199
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1200
    "
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1201
     JAVA::java::lang::Object fullName        
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1202
     JAVA::java::lang::Object nameSpacePath   
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1203
     JAVA::java::lang::Object name            
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1204
    "
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1205
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1206
    "Modified: / 19.10.1998 / 20:07:24 / cg"
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1207
!
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  1208
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1209
supportsMethodCategories
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1210
    ^ self isJavaClass not
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1211
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1212
    "Created: / 30.7.1997 / 14:58:58 / cg"
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  1213
    "Modified: / 7.5.1998 / 12:25:54 / cg"
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1214
!
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1215
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1216
typeName
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1217
    ^ 'L' , self fullName
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1218
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1219
    "
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1220
     (Java at:'java.util.Stack') typeName 
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1221
    "
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1222
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  1223
    "Modified: / 10.2.1998 / 17:13:26 / cg"
21
b9dd73f299dd checkin from browser
cg
parents: 18
diff changeset
  1224
! !
b9dd73f299dd checkin from browser
cg
parents: 18
diff changeset
  1225
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1226
!JavaClass methodsFor:'smalltalk interface'!
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1227
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1228
invoke:selector
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1229
    "send a message, without args."
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1230
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1231
    |method cls sel|
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1232
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1233
    sel := selector asSymbolIfInterned.
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1234
    sel notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1235
	cls := self.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1236
	[cls notNil and:[cls ~~ JavaObject]] whileTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1237
	    cls methodDictionary keysAndValuesDo:[:sel :aMethod |
69
7918222f9544 more methodDictionary changes
cg
parents: 67
diff changeset
  1238
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1239
"/     aMethod name printNL.
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1240
        
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1241
		(aMethod name == selector 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1242
		or:[aMethod signatureNameWithoutReturnType = selector]) ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1243
		    aMethod numArgs == 0 ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1244
			^ aMethod
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1245
			    valueWithReceiver:self
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1246
			    arguments:#()
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1247
"/                        ^ self 
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1248
"/                            invokeJavaMethod:aMethod 
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1249
"/                            sender:thisContext
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1250
"/                            selector:selector
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1251
		    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1252
		]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1253
	    ].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1254
	    cls := cls superclass.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1255
	].
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1256
    ].
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1257
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1258
    ^ self doesNotUnderstand:(Message selector:selector)
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1259
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1260
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1261
     |stack|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1262
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1263
     stack := (Java at:'java/util/Stack') basicNew.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1264
     stack invoke:#'<init>'. 
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1265
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1266
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1267
     |stack|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1268
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1269
     stack := (Java at:'java/util/Stack') basicNew.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1270
     stack invoke:#isEmpty. 
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1271
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1272
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1273
     |stack|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1274
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1275
     stack := (Java at:'java/util/Stack') basicNew.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1276
     stack invoke:#size. 
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1277
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1278
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1279
    "Created: / 30.7.1997 / 14:06:50 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1280
    "Modified: / 6.1.1998 / 18:21:34 / cg"
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1281
!
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1282
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1283
invoke:selector interpreter:i sender:aContext
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1284
    "send a message, without args"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1285
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1286
    |method cls sel|
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1287
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1288
    method := JavaClass lookupMethod:selector numArgs:0 in:self static:true.
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1289
    method notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1290
	^ self 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1291
	    invokeJavaMethod:method 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1292
	    interpreter:i 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1293
	    sender:aContext
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1294
	    selector:selector
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1295
    ].
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1296
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1297
    ^ super doesNotUnderstand:(Message selector:selector)
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1298
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1299
    "Created: 17.8.1997 / 18:10:08 / cg"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1300
    "Modified: 17.8.1997 / 18:33:59 / cg"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1301
!
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1302
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1303
invoke:selector interpreter:i sender:aContext with:arg
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1304
    "send a message, with 1 arg"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1305
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1306
    |method cls sel|
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1307
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1308
    method := JavaClass lookupMethod:selector numArgs:1 in:self static:true.
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1309
    method notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1310
	^ self 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1311
	    invokeJavaMethod:method 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1312
	    interpreter:i 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1313
	    sender:aContext
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1314
	    selector:selector
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1315
	    with:arg
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1316
    ].
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1317
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1318
    ^ super doesNotUnderstand:(Message selector:selector)
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1319
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1320
    "Created: 17.8.1997 / 18:10:32 / cg"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1321
    "Modified: 17.8.1997 / 18:33:52 / cg"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1322
!
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  1323
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1324
invoke:selector signature:signature
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1325
    "send a message, without args."
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1326
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1327
    |method cls sel sig|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1328
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1329
    sel := selector asSymbolIfInterned.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1330
    sel notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1331
	sig := signature asSymbolIfInterned.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1332
	sig notNil ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1333
	    cls := self.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1334
	    [cls notNil and:[cls ~~ JavaObject]] whileTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1335
		method := cls compiledMethodAt:sel signature:signature.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1336
		method notNil ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1337
		    ^ self 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1338
			invokeJavaMethod:method 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1339
			sender:thisContext
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1340
			selector:sel
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1341
		].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1342
		cls := cls superclass.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1343
	    ].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1344
	].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1345
    ].
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1346
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1347
    ^ self doesNotUnderstand:(Message selector:selector)
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1348
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1349
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1350
     |stack|
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1351
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1352
     stack := (Java at:'java/util/Stack') basicNew.
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1353
     stack invoke:#'<init>'. 
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1354
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1355
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1356
     |stack|
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1357
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1358
     stack := (Java at:'java/util/Stack') basicNew.
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1359
     stack invoke:#isEmpty. 
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1360
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1361
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1362
     |stack|
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1363
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1364
     stack := (Java at:'java/util/Stack') basicNew.
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1365
     stack invoke:#size. 
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1366
    "
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1367
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1368
    "Created: 30.7.1997 / 14:12:29 / cg"
185
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
  1369
    "Modified: 1.8.1997 / 00:04:45 / cg"
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1370
!
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1371
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1372
invoke:selector signature:signature with:arg
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1373
    "send a message, with 1 arg1."
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1374
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1375
    |method cls sel sig|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1376
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1377
    sel := selector asSymbolIfInterned.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1378
    sel notNil ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1379
	sig := signature asSymbolIfInterned.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1380
	sig notNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1381
	    cls := self.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1382
	    [cls notNil and:[cls ~~ JavaObject]] whileTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1383
		method := cls compiledMethodAt:sel signature:signature.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1384
		method notNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1385
		    ^ method
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1386
			valueWithReceiver:self
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1387
			arguments:(Array with:arg)
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1388
"/                    ^ self 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1389
"/                        invokeJavaMethod:method 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1390
"/                        sender:thisContext
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1391
"/                        selector:sel
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1392
"/                        with:arg
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1393
		].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1394
		cls := cls superclass.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1395
	    ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1396
	].
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1397
    ].
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1398
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1399
    ^ self doesNotUnderstand:(Message selector:selector)
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1400
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1401
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1402
     |stack|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1403
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1404
     stack := (Java at:'java/util/Stack') basicNew.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1405
     stack invoke:#'<init>'. 
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1406
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1407
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1408
     |stack|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1409
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1410
     stack := (Java at:'java/util/Stack') basicNew.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1411
     stack invoke:#isEmpty. 
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1412
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1413
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1414
     |stack|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1415
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1416
     stack := (Java at:'java/util/Stack') basicNew.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1417
     stack invoke:#size. 
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1418
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1419
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1420
    "Created: / 30.7.1997 / 14:13:30 / cg"
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1421
    "Modified: / 4.1.1998 / 16:32:45 / cg"
113
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1422
!
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1423
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1424
invoke:selector with:arg
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1425
    "send a message, with one arg"
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1426
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1427
    |method cls sel|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1428
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1429
    sel := selector asSymbolIfInterned.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1430
    sel notNil ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1431
        cls := self.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1432
        [cls notNil and:[cls ~~ JavaObject]] whileTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1433
            cls methodDictionary keysAndValuesDo:[:sel :aMethod |
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1434
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1435
"/     aMethod name printNL.
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1436
                (sel == selector
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1437
                or:[aMethod name == selector 
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1438
                or:[aMethod signatureNameWithoutReturnType = selector]]) ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1439
                    aMethod numArgs == 1 ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1440
                        ^ aMethod
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1441
                            valueWithReceiver:self
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1442
                            arguments:(Array with:arg)
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1443
"/                        ^ self 
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1444
"/                            invokeJavaMethod:aMethod 
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1445
"/                            sender:thisContext 
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1446
"/                            selector:selector    
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1447
"/                            with:arg
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1448
                    ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1449
                ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1450
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1451
            cls := cls superclass.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1452
        ].
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1453
    ].
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1454
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1455
    ^ self doesNotUnderstand:(Message selector:selector)
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1456
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
  1457
    "Modified: / 6.1.1998 / 21:04:04 / cg"
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1458
!
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1459
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1460
invoke:selector with:arg1 with:arg2
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1461
    "send a message, with two args"
113
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1462
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1463
    |method cls sel|
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1464
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1465
    sel := selector asSymbolIfInterned.
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1466
    sel notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1467
	cls := self.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1468
	[cls notNil and:[cls ~~ JavaObject]] whileTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1469
	    cls methodDictionary keysAndValuesDo:[:sel :aMethod |
113
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1470
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1471
"/     aMethod name printNL.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1472
		(aMethod name == selector 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1473
		or:[aMethod signatureNameWithoutReturnType = selector]) ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1474
		    aMethod numArgs == 2 ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1475
			^ self 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1476
			    invokeJavaMethod:aMethod 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1477
			    sender:thisContext 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1478
			    selector:selector    
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1479
			    with:arg1
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1480
			    with:arg2
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1481
		    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1482
		]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1483
	    ].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1484
	    cls := cls superclass.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1485
	].
113
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1486
    ].
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1487
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1488
    ^ self doesNotUnderstand:(Message selector:selector)
481bf55e161e *** empty log message ***
cg
parents: 112
diff changeset
  1489
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1490
    "Modified: 30.7.1997 / 13:39:15 / cg"
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1491
    "Created: 30.7.1997 / 14:00:09 / cg"
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1492
!
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1493
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1494
invoke:selector withAll:args
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1495
    "send a message, with a number of args"
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1496
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1497
    |method cls sel numArgGiven|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1498
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1499
    numArgGiven := args size.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1500
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1501
    sel := selector asSymbolIfInterned.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1502
    sel notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1503
	cls := self.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1504
	[cls notNil and:[cls ~~ JavaObject]] whileTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1505
	    cls methodDictionary keysAndValuesDo:[:sel :aMethod |
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1506
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1507
"/     aMethod name printNL.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1508
		(aMethod name == selector 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1509
		or:[aMethod signatureNameWithoutReturnType = selector]) ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1510
		    aMethod numArgs == numArgGiven ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1511
			^ self 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1512
			    invokeJavaMethod:aMethod 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1513
			    sender:thisContext 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1514
			    selector:selector    
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1515
			    withAll:args
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1516
		    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1517
		]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1518
	    ].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1519
	    cls := cls superclass.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1520
	].
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1521
    ].
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1522
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1523
    ^ self doesNotUnderstand:(Message selector:selector)
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1524
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1525
    "Modified: 30.7.1997 / 13:39:15 / cg"
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1526
    "Created: 30.7.1997 / 14:00:53 / cg"
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1527
!
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1528
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1529
invokeSignature:signature
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1530
    "send a message, without args."
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1531
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1532
    |method cls sel|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1533
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1534
    sel := signature asSymbolIfInterned.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1535
    sel notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1536
	cls := self.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1537
	[cls notNil and:[cls ~~ JavaObject]] whileTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1538
	    cls methodDictionary keysAndValuesDo:[:sel :aMethod |
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1539
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1540
"/     aMethod name printNL.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1541
        
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1542
		aMethod signatureName = signature ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1543
		    aMethod numArgs == 0 ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1544
			^ self 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1545
			    invokeJavaMethod:aMethod 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1546
			    sender:thisContext
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1547
			    selector:signature
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1548
		    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1549
		]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1550
	    ].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1551
	    cls := cls superclass.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  1552
	].
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1553
    ].
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1554
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1555
    ^ self doesNotUnderstand:(Message selector:signature)
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1556
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1557
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1558
     |stack|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1559
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1560
     stack := (Java at:'java/util/Stack') basicNew.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1561
     stack invoke:#'<init>'. 
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1562
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1563
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1564
     |stack|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1565
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1566
     stack := (Java at:'java/util/Stack') basicNew.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1567
     stack invoke:#isEmpty. 
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1568
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1569
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1570
     |stack|
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1571
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1572
     stack := (Java at:'java/util/Stack') basicNew.
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1573
     stack invoke:#size. 
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1574
    "
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1575
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1576
    "Modified: 30.7.1997 / 14:07:55 / cg"
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1577
    "Created: 30.7.1997 / 14:09:31 / cg"
133
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1578
!
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1579
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1580
methodMatching:aSmalltalkSelector
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1581
    |numArgs cls|
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1582
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1583
    numArgs := aSmalltalkSelector numArgs.
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1584
    cls := self.
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1585
    [cls notNil] whileTrue:[
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1586
	methodDictionary keysAndValuesDo:[:jSelector :aMethod |
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1587
	    aMethod numArgs == numArgs ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1588
		aMethod name = aSmalltalkSelector ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1589
		    ^ aMethod
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1590
		]
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1591
	    ]
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1592
	].
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1593
	cls := cls superclass
133
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1594
    ].
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1595
    ^ nil
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1596
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1597
    "Modified: 1.2.1997 / 21:57:36 / cg"
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
  1598
    "Created: 1.2.1997 / 21:57:53 / cg"
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1599
! !
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1600
203
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  1601
!JavaClass methodsFor:'special'!
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  1602
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  1603
updateClassRefsFrom:oldClass to:newClass
204
c2f7436ceaaa checkin from browser
cg
parents: 203
diff changeset
  1604
    self == oldClass ifTrue:[
312
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1605
        self makeObsolete.
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1606
        ^ self
204
c2f7436ceaaa checkin from browser
cg
parents: 203
diff changeset
  1607
    ].
c2f7436ceaaa checkin from browser
cg
parents: 203
diff changeset
  1608
203
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  1609
    constantPool updateClassRefsFrom:oldClass to:newClass.
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  1610
    interfaces notNil ifTrue:[
312
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1611
        interfaces := interfaces collect:[:anInterface |
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1612
                                            anInterface == oldClass ifTrue:[
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1613
                                                newClass isNil ifTrue:[
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1614
                                                    nil "/ replace by an unresolvedInterface
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1615
                                                ] ifFalse:[
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1616
                                                    newClass
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1617
                                                ]
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1618
                                            ] ifFalse:[
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1619
                                                anInterface
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1620
                                            ]
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1621
                                         ]
203
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  1622
    ]
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  1623
312
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1624
    "Modified: / 4.2.1998 / 22:08:19 / cg"
203
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  1625
! !
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  1626
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
  1627
!JavaClass class methodsFor:'documentation'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1628
083530508d9c intitial checkin
cg
parents:
diff changeset
  1629
version
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1630
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClass.st,v 1.82 1998/11/03 22:05:13 cg Exp $'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1631
! !
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1632
JavaClass initialize!