+ole queries
authorfm
Fri, 30 Mar 2007 15:21:24 +0200
changeset 10482 11b634beb199
parent 10481 b3526180579f
child 10483 79c64bcd4d29
+ole queries
Method.st
--- a/Method.st	Fri Mar 30 15:09:27 2007 +0200
+++ b/Method.st	Fri Mar 30 15:21:24 2007 +0200
@@ -1865,6 +1865,13 @@
     "
 !
 
+externalLibraryFunction
+    "if this is an externalLibraryFunction call, return the externalLibraryFunction.
+     Returns nil otherwise."
+
+    ^ self literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil
+!
+
 hasPrimitiveCode
     "return true, if the method contains primitive code; false if not.
      Uses Parser to parse methods source and get the information."
@@ -1918,6 +1925,38 @@
     "Created: 19.6.1997 / 16:13:12 / cg"
 !
 
+indexOfOLECall
+    "return true, if the method contains ole call; false if not.
+     Uses Parser to parse methods source and get the information."
+
+    |funcOrNil|
+
+    funcOrNil := self externalLibraryFunction.
+    (funcOrNil isNil or:[funcOrNil isCallTypeOLE not]) ifTrue:[^ nil].
+    ^ funcOrNil vtableIndex
+
+    "
+     (Method compiledMethodAt:#hasPrimitiveCode) isOLECall  
+     (Method compiledMethodAt:#hasPrimitiveCode) indexOfOLECall 
+
+     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isOLECall    
+     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) indexOfOLECall    
+     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isExternalLibraryFunctionCall    
+     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) externalLibraryFunctionCall    
+
+     (IUnknownPointer compiledMethodAt:#invokeAddRef) isExternalLibraryFunctionCall    
+     (IUnknownPointer compiledMethodAt:#invokeAddRef) externalLibraryFunction    
+     (IUnknownPointer compiledMethodAt:#invokeAddRef) isOLECall    
+     (IUnknownPointer compiledMethodAt:#invokeAddRef) indexOfOLECall    
+    "
+!
+
+isExternalLibraryFunctionCall
+    "Return true, if this is an externalLibraryFunction call."
+
+    ^ self externalLibraryFunction notNil
+!
+
 isInvalid
     "return true, if this method is not executable due to
      a (re)-compilation error. Since invalidation is by patching the
@@ -1958,6 +1997,15 @@
     ^ true
 !
 
+isOLECall
+    "return true, if the method is an ole call; false if not."
+
+    |funcOrNil|
+
+    funcOrNil := self externalLibraryFunction.
+    ^ funcOrNil notNil and:[funcOrNil isCallTypeOLE]
+!
+
 isObsolete
     "returns true, if this method is obsolete and should not be used any longer"
 
@@ -2759,7 +2807,7 @@
 !Method class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.305 2007-02-07 10:42:16 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.306 2007-03-30 13:21:24 fm Exp $'
 ! !
 
 Method initialize!