which are supported for them.
\begin{code}
+{-# OPTIONS -fno-implicit-prelude -#include "cbits/stgio.h" #-}
#include "error.h"
-{-# OPTIONS -fno-implicit-prelude -#include "cbits/stgio.h" #-}
module IOHandle where
import ST
+import UnsafeST
import STBase
import ArrBase ( ByteArray(..) )
import PrelRead ( Read )
+import PrelList (span)
import Ix
import IOBase
import PrelTup
import PrelBase
import GHC
-import Foreign ( makeForeignObj, writeForeignObj )
-import PrelList (span)
+
+import Foreign ( Addr,
+#ifndef __PARALLEL_HASKELL__
+ ForeignObj, makeForeignObj, writeForeignObj
+#endif
+ )
+
#if defined(__CONCURRENT_HASKELL__)
import ConcBase
#endif
%*********************************************************
\begin{code}
-#ifndef PAR
+#ifndef __PARALLEL_HASKELL__
filePtr :: Handle__ -> ForeignObj
#else
filePtr :: Handle__ -> Addr
(case rc of
0 -> new_handle ClosedHandle
1 ->
-#ifndef PAR
- makeForeignObj (``stdin''::Addr) (``&freeStdChannel''::Addr) >>= \ fp ->
+#ifndef __PARALLEL_HASKELL__
+ makeForeignObj (``stdin''::Addr) (``&freeStdFile''::Addr) >>= \ fp ->
new_handle (ReadHandle fp Nothing False)
#else
new_handle (ReadHandle ``stdin'' Nothing False)
(case rc of
0 -> new_handle ClosedHandle
1 ->
-#ifndef PAR
- makeForeignObj (``stdout''::Addr) (``&freeStdChannel''::Addr) >>= \ fp ->
+#ifndef __PARALLEL_HASKELL__
+ makeForeignObj (``stdout''::Addr) (``&freeStdFile''::Addr) >>= \ fp ->
new_handle (WriteHandle fp Nothing False)
#else
new_handle (WriteHandle ``stdout'' Nothing False)
(case rc of
0 -> new_handle ClosedHandle
1 ->
-#ifndef PAR
- makeForeignObj (``stderr''::Addr) (``&freeStdChannel''::Addr) >>= \ fp ->
+#ifndef __PARALLEL_HASKELL__
+ makeForeignObj (``stderr''::Addr) (``&freeStdFile''::Addr) >>= \ fp ->
new_handle (WriteHandle fp (Just NoBuffering) False)
#else
new_handle (WriteHandle ``stderr'' (Just NoBuffering) False)
openFile f m =
stToIO (_ccall_ openFile f m') >>= \ ptr ->
if ptr /= ``NULL'' then
-#ifndef PAR
+#ifndef __PARALLEL_HASKELL__
makeForeignObj ptr ((``&freeFile'')::Addr) `thenIO_Prim` \ fp ->
newHandle (htype fp Nothing False)
#else
to avoid closing the file object when the ForeignObj
is finalised. -}
if rc == 0 then
-#ifndef PAR
+#ifndef __PARALLEL_HASKELL__
-- Mark the foreign object data value as gone to the finaliser (freeFile())
writeForeignObj fp ``NULL'' `thenIO_Prim` \ () ->
#endif
let fp = filePtr other in
_ccall_ closeFile fp `thenIO_Prim` \ rc ->
if rc == 0 then
-#ifndef PAR
+#ifndef __PARALLEL_HASKELL__
-- Mark the foreign object data
writeForeignObj fp ``NULL'' `thenIO_Prim` \ () ->
#endif
BlockBuffering Nothing -> -2
BlockBuffering (Just n) -> n
-#ifndef PAR
+#ifndef __PARALLEL_HASKELL__
hcon :: Handle__ -> (ForeignObj -> (Maybe BufferMode) -> Bool -> Handle__)
#else
hcon :: Handle__ -> (Addr -> (Maybe BufferMode) -> Bool -> Handle__)
\begin{code}
data HandlePosn = HandlePosn Handle Int
-instance Eq HandlePosn{-partain-}
-
data SeekMode = AbsoluteSeek | RelativeSeek | SeekFromEnd
deriving (Eq, Ord, Ix, Enum, Read, Show)
\end{code}