diff options
author | sof <unknown> | 1999-01-25 14:02:03 +0000 |
---|---|---|
committer | sof <unknown> | 1999-01-25 14:02:03 +0000 |
commit | 90cd8bd55573c48a6e28369f48fcc1d94c0eb63b (patch) | |
tree | 5507a7abfac9b47f82a47b5ec24e913f2fb5a702 | |
parent | 0cca1cdcfdb433edcc013a643d72cf2580a78e33 (diff) | |
download | haskell-90cd8bd55573c48a6e28369f48fcc1d94c0eb63b.tar.gz |
[project @ 1999-01-25 14:02:03 by sof]
Added indexStablePtrArray (moved over from MutableArray)
-rw-r--r-- | ghc/lib/exts/ByteArray.lhs | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/ghc/lib/exts/ByteArray.lhs b/ghc/lib/exts/ByteArray.lhs index 6fba8e150b..504b2eb2a4 100644 --- a/ghc/lib/exts/ByteArray.lhs +++ b/ghc/lib/exts/ByteArray.lhs @@ -13,16 +13,26 @@ module ByteArray Ix, --Indexing of ordinary @Arrays@ is standard Haskell and isn't defined here. - indexCharArray, -- :: Ix ix => ByteArray ix -> ix -> Char - indexIntArray, -- :: Ix ix => ByteArray ix -> ix -> Int - indexWordArray, -- :: Ix ix => ByteArray ix -> ix -> Word - indexAddrArray, -- :: Ix ix => ByteArray ix -> ix -> Addr - indexFloatArray, -- :: Ix ix => ByteArray ix -> ix -> Float - indexDoubleArray, -- :: Ix ix => ByteArray ix -> ix -> Double - + indexCharArray, -- :: Ix ix => ByteArray ix -> ix -> Char + indexIntArray, -- :: Ix ix => ByteArray ix -> ix -> Int + indexWordArray, -- :: Ix ix => ByteArray ix -> ix -> Word + indexAddrArray, -- :: Ix ix => ByteArray ix -> ix -> Addr + indexFloatArray, -- :: Ix ix => ByteArray ix -> ix -> Float + indexDoubleArray, -- :: Ix ix => ByteArray ix -> ix -> Double + indexStablePtrArray -- :: Ix ix => ByteArray ix -> ix -> (StablePtr a) + ) where import PrelArr +import PrelBase +import PrelForeign import Ix \end{code} +\begin{code} +indexStablePtrArray :: Ix ix => ByteArray ix -> ix -> (StablePtr a) +indexStablePtrArray (ByteArray ixs barr#) n + = case (index ixs n) of { I# n# -> + case indexStablePtrArray# barr# n# of { r# -> + (StablePtr r#)}} +\end{code} |