summaryrefslogtreecommitdiff
path: root/testsuite/timeout
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2008-01-20 23:20:37 +0000
committerIan Lynagh <igloo@earth.li>2008-01-20 23:20:37 +0000
commit932a6086496867c7de29d306e875001383f4716d (patch)
treed06486468413f0b89a356dea70728238a07bb89d /testsuite/timeout
parent51e76b4432580d2fffd051868826239cec51a3c9 (diff)
downloadhaskell-932a6086496867c7de29d306e875001383f4716d.tar.gz
Add WinCBindings.hsc, not WinCBindings.hs!
Diffstat (limited to 'testsuite/timeout')
-rw-r--r--testsuite/timeout/WinCBindings.hs193
-rw-r--r--testsuite/timeout/WinCBindings.hsc144
2 files changed, 144 insertions, 193 deletions
diff --git a/testsuite/timeout/WinCBindings.hs b/testsuite/timeout/WinCBindings.hs
deleted file mode 100644
index 1876726735..0000000000
--- a/testsuite/timeout/WinCBindings.hs
+++ /dev/null
@@ -1,193 +0,0 @@
-{-# INCLUDE <windows.h> #-}
-{-# LINE 1 "WinCBindings.hsc" #-}
-{-# OPTIONS -cpp -fffi #-}
-{-# LINE 2 "WinCBindings.hsc" #-}
-
-module WinCBindings where
-
-
-{-# LINE 6 "WinCBindings.hsc" #-}
-
-import Foreign
-import System.Win32.File
-import System.Win32.Types
-
-
-{-# LINE 12 "WinCBindings.hsc" #-}
-
-type LPPROCESS_INFORMATION = Ptr PROCESS_INFORMATION
-data PROCESS_INFORMATION = PROCESS_INFORMATION
- { piProcess :: HANDLE
- , piThread :: HANDLE
- , piProcessId :: DWORD
- , piThreadId :: DWORD
- } deriving Show
-
-instance Storable PROCESS_INFORMATION where
- sizeOf = const (16)
-{-# LINE 23 "WinCBindings.hsc" #-}
- alignment = sizeOf
- poke buf pi = do
- ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) buf (piProcess pi)
-{-# LINE 26 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) buf (piThread pi)
-{-# LINE 27 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) buf (piProcessId pi)
-{-# LINE 28 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) buf (piThreadId pi)
-{-# LINE 29 "WinCBindings.hsc" #-}
-
- peek buf = do
- vhProcess <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) buf
-{-# LINE 32 "WinCBindings.hsc" #-}
- vhThread <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) buf
-{-# LINE 33 "WinCBindings.hsc" #-}
- vdwProcessId <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) buf
-{-# LINE 34 "WinCBindings.hsc" #-}
- vdwThreadId <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) buf
-{-# LINE 35 "WinCBindings.hsc" #-}
- return $ PROCESS_INFORMATION {
- piProcess = vhProcess,
- piThread = vhThread,
- piProcessId = vdwProcessId,
- piThreadId = vdwThreadId}
-
-type LPSTARTUPINFO = Ptr STARTUPINFO
-data STARTUPINFO = STARTUPINFO
- { siCb :: DWORD
- , siDesktop :: LPTSTR
- , siTitle :: LPTSTR
- , siX :: DWORD
- , siY :: DWORD
- , siXSize :: DWORD
- , siYSize :: DWORD
- , siXCountChars :: DWORD
- , siYCountChars :: DWORD
- , siFillAttribute :: DWORD
- , siFlags :: DWORD
- , siShowWindow :: WORD
- , siStdInput :: HANDLE
- , siStdOutput :: HANDLE
- , siStdError :: HANDLE
- } deriving Show
-
-instance Storable STARTUPINFO where
- sizeOf = const (68)
-{-# LINE 62 "WinCBindings.hsc" #-}
- alignment = sizeOf
- poke buf si = do
- ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) buf (siCb si)
-{-# LINE 65 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) buf (siDesktop si)
-{-# LINE 66 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) buf (siTitle si)
-{-# LINE 67 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) buf (siX si)
-{-# LINE 68 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) buf (siY si)
-{-# LINE 69 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) buf (siXSize si)
-{-# LINE 70 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) buf (siYSize si)
-{-# LINE 71 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) buf (siXCountChars si)
-{-# LINE 72 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 36)) buf (siYCountChars si)
-{-# LINE 73 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 40)) buf (siFillAttribute si)
-{-# LINE 74 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 44)) buf (siFlags si)
-{-# LINE 75 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 48)) buf (siShowWindow si)
-{-# LINE 76 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 56)) buf (siStdInput si)
-{-# LINE 77 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 60)) buf (siStdOutput si)
-{-# LINE 78 "WinCBindings.hsc" #-}
- ((\hsc_ptr -> pokeByteOff hsc_ptr 64)) buf (siStdError si)
-{-# LINE 79 "WinCBindings.hsc" #-}
-
- peek buf = do
- vcb <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) buf
-{-# LINE 82 "WinCBindings.hsc" #-}
- vlpDesktop <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) buf
-{-# LINE 83 "WinCBindings.hsc" #-}
- vlpTitle <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) buf
-{-# LINE 84 "WinCBindings.hsc" #-}
- vdwX <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) buf
-{-# LINE 85 "WinCBindings.hsc" #-}
- vdwY <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) buf
-{-# LINE 86 "WinCBindings.hsc" #-}
- vdwXSize <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) buf
-{-# LINE 87 "WinCBindings.hsc" #-}
- vdwYSize <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) buf
-{-# LINE 88 "WinCBindings.hsc" #-}
- vdwXCountChars <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) buf
-{-# LINE 89 "WinCBindings.hsc" #-}
- vdwYCountChars <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) buf
-{-# LINE 90 "WinCBindings.hsc" #-}
- vdwFillAttribute <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) buf
-{-# LINE 91 "WinCBindings.hsc" #-}
- vdwFlags <- ((\hsc_ptr -> peekByteOff hsc_ptr 44)) buf
-{-# LINE 92 "WinCBindings.hsc" #-}
- vwShowWindow <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) buf
-{-# LINE 93 "WinCBindings.hsc" #-}
- vhStdInput <- ((\hsc_ptr -> peekByteOff hsc_ptr 56)) buf
-{-# LINE 94 "WinCBindings.hsc" #-}
- vhStdOutput <- ((\hsc_ptr -> peekByteOff hsc_ptr 60)) buf
-{-# LINE 95 "WinCBindings.hsc" #-}
- vhStdError <- ((\hsc_ptr -> peekByteOff hsc_ptr 64)) buf
-{-# LINE 96 "WinCBindings.hsc" #-}
- return $ STARTUPINFO {
- siCb = vcb,
- siDesktop = vlpDesktop,
- siTitle = vlpTitle,
- siX = vdwX,
- siY = vdwY,
- siXSize = vdwXSize,
- siYSize = vdwYSize,
- siXCountChars = vdwXCountChars,
- siYCountChars = vdwYCountChars,
- siFillAttribute = vdwFillAttribute,
- siFlags = vdwFlags,
- siShowWindow = vwShowWindow,
- siStdInput = vhStdInput,
- siStdOutput = vhStdOutput,
- siStdError = vhStdError}
-
-foreign import stdcall unsafe "windows.h WaitForSingleObject"
- waitForSingleObject :: HANDLE -> DWORD -> IO DWORD
-
-cWAIT_ABANDONED :: DWORD
-cWAIT_ABANDONED = 128
-{-# LINE 118 "WinCBindings.hsc" #-}
-
-cWAIT_OBJECT_0 :: DWORD
-cWAIT_OBJECT_0 = 0
-{-# LINE 121 "WinCBindings.hsc" #-}
-
-cWAIT_TIMEOUT :: DWORD
-cWAIT_TIMEOUT = 258
-{-# LINE 124 "WinCBindings.hsc" #-}
-
-foreign import stdcall unsafe "windows.h GetExitCodeProcess"
- getExitCodeProcess :: HANDLE -> LPDWORD -> IO BOOL
-
-foreign import stdcall unsafe "windows.h TerminateJobObject"
- terminateJobObject :: HANDLE -> UINT -> IO BOOL
-
-foreign import stdcall unsafe "windows.h AssignProcessToJobObject"
- assignProcessToJobObject :: HANDLE -> HANDLE -> IO BOOL
-
-foreign import stdcall unsafe "windows.h CreateJobObjectW"
- createJobObjectW :: LPSECURITY_ATTRIBUTES -> LPCTSTR -> IO HANDLE
-
-foreign import stdcall unsafe "windows.h CreateProcessW"
- createProcessW :: LPCTSTR -> LPTSTR
- -> LPSECURITY_ATTRIBUTES -> LPSECURITY_ATTRIBUTES
- -> BOOL -> DWORD -> LPVOID -> LPCTSTR -> LPSTARTUPINFO
- -> LPPROCESS_INFORMATION -> IO BOOL
-
-
-{-# LINE 144 "WinCBindings.hsc" #-}
-
diff --git a/testsuite/timeout/WinCBindings.hsc b/testsuite/timeout/WinCBindings.hsc
new file mode 100644
index 0000000000..022b84f9e4
--- /dev/null
+++ b/testsuite/timeout/WinCBindings.hsc
@@ -0,0 +1,144 @@
+{-# OPTIONS -cpp -fffi #-}
+
+module WinCBindings where
+
+#if defined(mingw32_HOST_OS)
+
+import Foreign
+import System.Win32.File
+import System.Win32.Types
+
+#include <windows.h>
+
+type LPPROCESS_INFORMATION = Ptr PROCESS_INFORMATION
+data PROCESS_INFORMATION = PROCESS_INFORMATION
+ { piProcess :: HANDLE
+ , piThread :: HANDLE
+ , piProcessId :: DWORD
+ , piThreadId :: DWORD
+ } deriving Show
+
+instance Storable PROCESS_INFORMATION where
+ sizeOf = const #size PROCESS_INFORMATION
+ alignment = sizeOf
+ poke buf pi = do
+ (#poke PROCESS_INFORMATION, hProcess) buf (piProcess pi)
+ (#poke PROCESS_INFORMATION, hThread) buf (piThread pi)
+ (#poke PROCESS_INFORMATION, dwProcessId) buf (piProcessId pi)
+ (#poke PROCESS_INFORMATION, dwThreadId) buf (piThreadId pi)
+
+ peek buf = do
+ vhProcess <- (#peek PROCESS_INFORMATION, hProcess) buf
+ vhThread <- (#peek PROCESS_INFORMATION, hThread) buf
+ vdwProcessId <- (#peek PROCESS_INFORMATION, dwProcessId) buf
+ vdwThreadId <- (#peek PROCESS_INFORMATION, dwThreadId) buf
+ return $ PROCESS_INFORMATION {
+ piProcess = vhProcess,
+ piThread = vhThread,
+ piProcessId = vdwProcessId,
+ piThreadId = vdwThreadId}
+
+type LPSTARTUPINFO = Ptr STARTUPINFO
+data STARTUPINFO = STARTUPINFO
+ { siCb :: DWORD
+ , siDesktop :: LPTSTR
+ , siTitle :: LPTSTR
+ , siX :: DWORD
+ , siY :: DWORD
+ , siXSize :: DWORD
+ , siYSize :: DWORD
+ , siXCountChars :: DWORD
+ , siYCountChars :: DWORD
+ , siFillAttribute :: DWORD
+ , siFlags :: DWORD
+ , siShowWindow :: WORD
+ , siStdInput :: HANDLE
+ , siStdOutput :: HANDLE
+ , siStdError :: HANDLE
+ } deriving Show
+
+instance Storable STARTUPINFO where
+ sizeOf = const #size STARTUPINFO
+ alignment = sizeOf
+ poke buf si = do
+ (#poke STARTUPINFO, cb) buf (siCb si)
+ (#poke STARTUPINFO, lpDesktop) buf (siDesktop si)
+ (#poke STARTUPINFO, lpTitle) buf (siTitle si)
+ (#poke STARTUPINFO, dwX) buf (siX si)
+ (#poke STARTUPINFO, dwY) buf (siY si)
+ (#poke STARTUPINFO, dwXSize) buf (siXSize si)
+ (#poke STARTUPINFO, dwYSize) buf (siYSize si)
+ (#poke STARTUPINFO, dwXCountChars) buf (siXCountChars si)
+ (#poke STARTUPINFO, dwYCountChars) buf (siYCountChars si)
+ (#poke STARTUPINFO, dwFillAttribute) buf (siFillAttribute si)
+ (#poke STARTUPINFO, dwFlags) buf (siFlags si)
+ (#poke STARTUPINFO, wShowWindow) buf (siShowWindow si)
+ (#poke STARTUPINFO, hStdInput) buf (siStdInput si)
+ (#poke STARTUPINFO, hStdOutput) buf (siStdOutput si)
+ (#poke STARTUPINFO, hStdError) buf (siStdError si)
+
+ peek buf = do
+ vcb <- (#peek STARTUPINFO, cb) buf
+ vlpDesktop <- (#peek STARTUPINFO, lpDesktop) buf
+ vlpTitle <- (#peek STARTUPINFO, lpTitle) buf
+ vdwX <- (#peek STARTUPINFO, dwX) buf
+ vdwY <- (#peek STARTUPINFO, dwY) buf
+ vdwXSize <- (#peek STARTUPINFO, dwXSize) buf
+ vdwYSize <- (#peek STARTUPINFO, dwYSize) buf
+ vdwXCountChars <- (#peek STARTUPINFO, dwXCountChars) buf
+ vdwYCountChars <- (#peek STARTUPINFO, dwYCountChars) buf
+ vdwFillAttribute <- (#peek STARTUPINFO, dwFillAttribute) buf
+ vdwFlags <- (#peek STARTUPINFO, dwFlags) buf
+ vwShowWindow <- (#peek STARTUPINFO, wShowWindow) buf
+ vhStdInput <- (#peek STARTUPINFO, hStdInput) buf
+ vhStdOutput <- (#peek STARTUPINFO, hStdOutput) buf
+ vhStdError <- (#peek STARTUPINFO, hStdError) buf
+ return $ STARTUPINFO {
+ siCb = vcb,
+ siDesktop = vlpDesktop,
+ siTitle = vlpTitle,
+ siX = vdwX,
+ siY = vdwY,
+ siXSize = vdwXSize,
+ siYSize = vdwYSize,
+ siXCountChars = vdwXCountChars,
+ siYCountChars = vdwYCountChars,
+ siFillAttribute = vdwFillAttribute,
+ siFlags = vdwFlags,
+ siShowWindow = vwShowWindow,
+ siStdInput = vhStdInput,
+ siStdOutput = vhStdOutput,
+ siStdError = vhStdError}
+
+foreign import stdcall unsafe "windows.h WaitForSingleObject"
+ waitForSingleObject :: HANDLE -> DWORD -> IO DWORD
+
+cWAIT_ABANDONED :: DWORD
+cWAIT_ABANDONED = #const WAIT_ABANDONED
+
+cWAIT_OBJECT_0 :: DWORD
+cWAIT_OBJECT_0 = #const WAIT_OBJECT_0
+
+cWAIT_TIMEOUT :: DWORD
+cWAIT_TIMEOUT = #const WAIT_TIMEOUT
+
+foreign import stdcall unsafe "windows.h GetExitCodeProcess"
+ getExitCodeProcess :: HANDLE -> LPDWORD -> IO BOOL
+
+foreign import stdcall unsafe "windows.h TerminateJobObject"
+ terminateJobObject :: HANDLE -> UINT -> IO BOOL
+
+foreign import stdcall unsafe "windows.h AssignProcessToJobObject"
+ assignProcessToJobObject :: HANDLE -> HANDLE -> IO BOOL
+
+foreign import stdcall unsafe "windows.h CreateJobObjectW"
+ createJobObjectW :: LPSECURITY_ATTRIBUTES -> LPCTSTR -> IO HANDLE
+
+foreign import stdcall unsafe "windows.h CreateProcessW"
+ createProcessW :: LPCTSTR -> LPTSTR
+ -> LPSECURITY_ATTRIBUTES -> LPSECURITY_ATTRIBUTES
+ -> BOOL -> DWORD -> LPVOID -> LPCTSTR -> LPSTARTUPINFO
+ -> LPPROCESS_INFORMATION -> IO BOOL
+
+#endif
+