From: sof Date: Mon, 25 Jan 1999 14:02:03 +0000 (+0000) Subject: [project @ 1999-01-25 14:02:03 by sof] X-Git-Tag: Approximately_9120_patches~6690 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=90cd8bd55573c48a6e28369f48fcc1d94c0eb63b;p=ghc-hetmet.git [project @ 1999-01-25 14:02:03 by sof] Added indexStablePtrArray (moved over from MutableArray) --- diff --git a/ghc/lib/exts/ByteArray.lhs b/ghc/lib/exts/ByteArray.lhs index 6fba8e1..504b2eb 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}