--- a/RegressionTests__ExternalInterfaceTests.st Mon May 07 14:36:28 2012 +0200
+++ b/RegressionTests__ExternalInterfaceTests.st Mon May 07 15:10:18 2012 +0200
@@ -31,178 +31,6 @@
"Created: / 23-04-2006 / 08:13:27 / cg"
! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-fooType
- <C: struct foo {
- long l1;
- float f1;
- }>
-
- "
- self new fooType
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-SIZE
- <C: typedef struct {
- long cx;
- long cy;
- } SIZE>
-
- "
- self new SIZE
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-LPVOID
- <C: typedef void * LPVOID>
-
- "
- self new LPVOID
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-LPTSTR
- <C: typedef void * LPTSTR>
-
- "
- self new LPTSTR
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-LPSTR
- <C: typedef char * LPSTR>
-
- "
- self new LPSTR
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-LPSIZE
- <C: typedef SIZE * LPSIZE>
-
- "
- self new LPSIZE
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-LPCTSTR
- <C: typedef void * LPCTSTR>
-
- "
- self new LPCTSTR
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-LPCTSR
- <C: typedef void * LPCTSR>
-
- "
- self new LPCTSR
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-BOOL
- <C: typedef long BOOL>
-
- "
- self new BOOL
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-BYTE
- <C: typedef unsigned char BYTE>
-
- "
- self new BYTE
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-DWORD
- <C: typedef unsigned long DWORD>
-
- "
- self new DWORD
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-HANDLE
- <C: typedef void * HANDLE>
-
- "
- self new HANDLE
- "
-! !
-!ExternalInterfaceTests methodsFor:'types'!
-
-LPBYTE
- <C: typedef BYTE *LPBYTE>
-
- "
- self new LPBYTE
- "
-! !
-!ExternalInterfaceTests methodsFor:'structs'!
-
-PROCESS_INFORMATION
- "Describes a created process and its main thread."
-
- <C: struct PROCESS_INFORMATION {
- HANDLE hProcess;
- HANDLE hThread;
- DWORD dwProcessId;
- DWORD dwThreadId;
- }>
-! !
-!ExternalInterfaceTests methodsFor:'structs'!
-
-SECURITY_ATTRIBUTES
- "Describes security of associated process."
-
- <C: struct SECURITY_ATTRIBUTES {
- DWORD nLength;
- LPVOID lpSecurityDescriptor;
- BOOL bInheritHandle;
- }>
-! !
-!ExternalInterfaceTests methodsFor:'structs'!
-
-STARTUPINFO
- "Describes how we want the process to be started."
-
- <C: struct STARTUPINFO {
- DWORD cb;
- LPSTR lpReserved;
- LPSTR lpDesktop;
- LPSTR lpTitle;
- DWORD dwX;
- DWORD dwY;
- DWORD dwXSize;
- DWORD dwYSize;
- DWORD dwXCountChars;
- DWORD dwYCountChars;
- DWORD dwFillAttribute;
- DWORD dwFlags;
- WORD wShowWindow;
- WORD cbReserved2;
- LPBYTE lpReserved2;
- HANDLE hStdInput;
- HANDLE hStdOutput;
- HANDLE hStdError;
- }>
-! !
!ExternalInterfaceTests methodsFor:'procedures'!
CreateProcess: imageName commandLine: commandLine pSecurity: pSecurity tSecurity: tSecurity inheritHandles: inheritHandles creationFlags: creationFlags environment: environment currentDirectoryName: currentDirectoryName startupInfo: startupInfo processInfo: processInfo
@@ -254,19 +82,71 @@
^self externalAccessFailedWith: _errorCode
! !
+!ExternalInterfaceTests methodsFor:'structs'!
+
+PROCESS_INFORMATION
+ "Describes a created process and its main thread."
+
+ <C: struct PROCESS_INFORMATION {
+ HANDLE hProcess;
+ HANDLE hThread;
+ DWORD dwProcessId;
+ DWORD dwThreadId;
+ }>
+!
+
+SECURITY_ATTRIBUTES
+ "Describes security of associated process."
+
+ <C: struct SECURITY_ATTRIBUTES {
+ DWORD nLength;
+ LPVOID lpSecurityDescriptor;
+ BOOL bInheritHandle;
+ }>
+!
+
+STARTUPINFO
+ "Describes how we want the process to be started."
+
+ <C: struct STARTUPINFO {
+ DWORD cb;
+ LPSTR lpReserved;
+ LPSTR lpDesktop;
+ LPSTR lpTitle;
+ DWORD dwX;
+ DWORD dwY;
+ DWORD dwXSize;
+ DWORD dwYSize;
+ DWORD dwXCountChars;
+ DWORD dwYCountChars;
+ DWORD dwFillAttribute;
+ DWORD dwFlags;
+ WORD wShowWindow;
+ WORD cbReserved2;
+ LPBYTE lpReserved2;
+ HANDLE hStdInput;
+ HANDLE hStdOutput;
+ HANDLE hStdError;
+ }>
+! !
!ExternalInterfaceTests methodsFor:'tests'!
test_call_01
|fn|
+ OperatingSystem isMSWINDOWSlike ifFalse:[
+ "This test makes sense only on windows"
+ ^ self.
+ ].
+
fn := ExternalLibraryFunction
name:'Beep'
module:'kernel32.dll'
- callType:(ExternalLibraryFunction callTypeAPI)
returnType:(CType bool)
argumentTypes:(Array with:(CType unsignedLong) with:(CType unsignedLong)).
+ fn beCallTypeAPI.
fn invokeWith:440 with:1.
"
@@ -277,6 +157,105 @@
!ExternalInterfaceTests methodsFor:'types'!
+BOOL
+ <C: typedef long BOOL>
+
+ "
+ self new BOOL
+ "
+!
+
+BYTE
+ <C: typedef unsigned char BYTE>
+
+ "
+ self new BYTE
+ "
+!
+
+DWORD
+ <C: typedef unsigned long DWORD>
+
+ "
+ self new DWORD
+ "
+!
+
+HANDLE
+ <C: typedef void * HANDLE>
+
+ "
+ self new HANDLE
+ "
+!
+
+LPBYTE
+ <C: typedef BYTE *LPBYTE>
+
+ "
+ self new LPBYTE
+ "
+!
+
+LPCTSR
+ <C: typedef void * LPCTSR>
+
+ "
+ self new LPCTSR
+ "
+!
+
+LPCTSTR
+ <C: typedef void * LPCTSTR>
+
+ "
+ self new LPCTSTR
+ "
+!
+
+LPSIZE
+ <C: typedef SIZE * LPSIZE>
+
+ "
+ self new LPSIZE
+ "
+!
+
+LPSTR
+ <C: typedef char * LPSTR>
+
+ "
+ self new LPSTR
+ "
+!
+
+LPTSTR
+ <C: typedef void * LPTSTR>
+
+ "
+ self new LPTSTR
+ "
+!
+
+LPVOID
+ <C: typedef void * LPVOID>
+
+ "
+ self new LPVOID
+ "
+!
+
+SIZE
+ <C: typedef struct {
+ long cx;
+ long cy;
+ } SIZE>
+
+ "
+ self new SIZE
+ "
+!
+
WORD
<C: typedef unsigned short WORD>
@@ -285,6 +264,17 @@
"
!
+fooType
+ <C: struct foo {
+ long l1;
+ float f1;
+ }>
+
+ "
+ self new fooType
+ "
+!
+
var1
<C: #define var1 1234>