Skip to content
Snippets Groups Projects
Commit 1d0fb43f authored by sof's avatar sof
Browse files

[project @ 1998-11-08 17:12:53 by sof]

Added {read,write}StablePtrOffAddr
parent 57d07fb8
No related merge requests found
......@@ -38,7 +38,7 @@ import Int ( indexInt8OffAddr, indexInt16OffAddr
import PrelIOBase ( IO(..), IOResult(..) )
#ifndef __PARALLEL_HASKELL__
import PrelForeign ( ForeignObj(..) )
import PrelForeign ( ForeignObj(..), StablePtr(..) )
#endif
\end{code}
......@@ -98,6 +98,9 @@ readCharOffAddr a i = _casm_ `` %r=(StgChar)(((StgChar*)%0)[(StgInt)%1]); '' a i
readIntOffAddr :: Addr -> Int -> IO Int
readIntOffAddr a i = _casm_ `` %r=(StgInt)(((StgInt*)%0)[(StgInt)%1]); '' a i
readStablePtrOffAddr :: Addr -> Int -> IO (StablePtr a)
readStablePtrOffAddr a i = _casm_ `` %r=(StgStablePtr)(((StgStablePtr*)%0)[(StgInt)%1]); '' a i
readWordOffAddr :: Addr -> Int -> IO Word
readWordOffAddr a i = _casm_ `` %r=(StgWord)(((StgWord*)%0)[(StgInt)%1]); '' a i
......@@ -121,6 +124,10 @@ writeIntOffAddr :: Addr -> Int -> Int -> IO ()
writeIntOffAddr (A# a#) (I# i#) (I# e#) = IO $ \ s# ->
case (writeIntOffAddr# a# i# e# s#) of s2# -> IOok s2# ()
writeStablePtrOffAddr :: Addr -> Int -> StablePtr a -> IO ()
writeStablePtrOffAddr (A# a#) (I# i#) (StablePtr e#) = IO $ \ s# ->
case (writeStablePtrOffAddr# a# i# e# s#) of s2# -> IOok s2# ()
writeWordOffAddr :: Addr -> Int -> Word -> IO ()
writeWordOffAddr (A# a#) (I# i#) (W# e#) = IO $ \ s# ->
case (writeWordOffAddr# a# i# e# s#) of s2# -> IOok s2# ()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment