Commit 5f2b610a authored by Simon Marlow's avatar Simon Marlow

Update for new IO library (TEMPORARY: hGetArray/hPutArray not implemented)

parent 0494b894
......@@ -43,8 +43,14 @@ import GHC.Float ( Float(..), Double(..) )
import GHC.Stable ( StablePtr(..) )
import GHC.Int ( Int8(..), Int16(..), Int32(..), Int64(..) )
import GHC.Word ( Word8(..), Word16(..), Word32(..), Word64(..) )
#if __GLASGOW_HASKELL__ >= 611
import GHC.IO ( IO(..), stToIO )
import GHC.IOArray ( IOArray(..),
newIOArray, unsafeReadIOArray, unsafeWriteIOArray )
#else
import GHC.IOBase ( IO(..), IOArray(..), stToIO,
newIOArray, unsafeReadIOArray, unsafeWriteIOArray )
#endif
#else
import Data.Int
import Data.Word
......
{-# OPTIONS_GHC -#include "HsBase.h" #-}
{-# OPTIONS_GHC -w #-} --tmp
-----------------------------------------------------------------------------
-- |
-- Module : Data.Array.IO
......@@ -39,9 +40,11 @@ import Foreign
import Foreign.C
import GHC.Arr
import GHC.IORef
import GHC.IO.Handle
import GHC.IO.Buffer
import GHC.IO.Exception
import GHC.IOBase
import GHC.Handle
#else
import Data.Char
import Data.Word ( Word8 )
......@@ -63,6 +66,10 @@ hGetArray
-- read, which might be smaller than the number requested
-- if the end of file was reached.
hGetArray = undefined
#if 0
hGetArray handle (IOUArray (STUArray _l _u n ptr)) count
| count == 0
= return 0
......@@ -105,6 +112,8 @@ readChunk fd is_stream ptr init_off bytes0 = loop init_off bytes0
then return (off - init_off)
else loop (off + r) (bytes - r)
#endif
-- ---------------------------------------------------------------------------
-- hPutArray
......@@ -115,6 +124,10 @@ hPutArray
-> Int -- ^ Number of 'Word8's to write
-> IO ()
hPutArray = undefined
#if 0
hPutArray handle (IOUArray (STUArray _l _u n raw)) count
| count == 0
= return ()
......@@ -144,14 +157,11 @@ hPutArray handle (IOUArray (STUArray _l _u n raw)) count
flushWriteBuffer fd stream this_buf
return ()
#endif
-- ---------------------------------------------------------------------------
-- Internal Utils
foreign import ccall unsafe "__hscore_memcpy_dst_off"
memcpy_baoff_ba :: RawBuffer -> CInt -> RawBuffer -> CSize -> IO (Ptr ())
foreign import ccall unsafe "__hscore_memcpy_src_off"
memcpy_ba_baoff :: RawBuffer -> RawBuffer -> CInt -> CSize -> IO (Ptr ())
illegalBufferSize :: Handle -> String -> Int -> IO a
illegalBufferSize handle fn sz =
ioException (ioeSetErrorString
......
......@@ -38,7 +38,11 @@ import Data.Array.Base
import Data.Ix
#ifdef __GLASGOW_HASKELL__
#if __GLASGOW_HASKELL__ >= 611
import GHC.IOArray (IOArray(..))
#else
import GHC.IOBase (IOArray(..))
#endif
#endif /* __GLASGOW_HASKELL__ */
#include "Typeable.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment