JavaNativeMethod.st
author cg
Tue, 09 Nov 1999 09:25:25 +0000
changeset 616 53bf2ec50346
parent 611 490fbaed2257
child 642 3f9842e199be
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
611
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
     1
'From Smalltalk/X, Version:3.5.4 on 25-sep-1999 at 11:12:45 pm'                 !
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
     2
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
     3
JavaMethodWithHandler variableSubclass:#JavaNativeMethod
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
     4
	instanceVariableNames:'nativeImplementation'
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
     5
	classVariableNames:''
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
     6
	poolDictionaries:''
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
     7
	category:'Java-Classes'
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
     8
!
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
     9
616
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    10
!JavaNativeMethod class methodsFor:'initialization'!
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    11
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    12
initialize
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    13
    self flags:(self flags bitOr:Behavior flagJavaMethod).
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    14
! !
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    15
611
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    16
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    17
!JavaNativeMethod methodsFor:'accessing'!
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    18
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    19
nativeImplementation
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    20
    "return the value of the instance variable 'nativeImplementation' (automatically generated)"
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    21
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    22
    ^ nativeImplementation
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    23
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    24
    "Created: / 25.9.1999 / 23:08:00 / cg"
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    25
!
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    26
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    27
nativeImplementation:something
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    28
    "set the value of the instance variable 'nativeImplementation' (automatically generated)"
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    29
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    30
    nativeImplementation := something.
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    31
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    32
    "Created: / 25.9.1999 / 23:08:00 / cg"
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    33
! !
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    34
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    35
!JavaNativeMethod methodsFor:'vm support'!
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    36
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    37
nativeMethodInvokation
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    38
    |nm sel|
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    39
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    40
    nativeImplementation isNil ifTrue:[
616
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    41
	nm := selector copyWithoutLast:signature size.
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    42
	sel := ('_' , javaClass lastName , '_' , nm , ':') asSymbol.
611
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    43
616
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    44
	nativeImplementation := (JavaVM class compiledMethodAt:sel).
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    45
	nativeImplementation isNil ifTrue:[
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    46
	    ^ JavaVM 
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    47
		perform:sel
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    48
		with:thisContext sender.
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    49
	].
611
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    50
    ].
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    51
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    52
    ^ nativeImplementation
616
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    53
	valueWithReceiver:JavaVM
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    54
	arguments:(Array with:thisContext sender)
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    55
	selector:selector
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    56
	search:JavaVM class
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    57
	sender:nil
611
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    58
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    59
    "Modified: / 25.9.1999 / 23:10:29 / cg"
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    60
! !
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    61
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    62
!JavaNativeMethod class methodsFor:'documentation'!
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    63
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    64
version
616
53bf2ec50346 *** empty log message ***
cg
parents: 611
diff changeset
    65
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaNativeMethod.st,v 1.2 1999/11/09 09:24:33 cg Exp $'
611
490fbaed2257 faster nativeMethod invocation
cg
parents:
diff changeset
    66
! !