From: simonmar Date: Mon, 4 Dec 2000 11:26:14 +0000 (+0000) Subject: [project @ 2000-12-04 11:26:14 by simonmar] X-Git-Tag: Approximately_9120_patches~3212 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=84006ac87da20cae3d36617d1c13177d2db50e61;p=ghc-hetmet.git [project @ 2000-12-04 11:26:14 by simonmar] don't conflict with new Ptr type. --- diff --git a/ghc/tests/ccall/should_run/fed001.hs b/ghc/tests/ccall/should_run/fed001.hs index be0852c..eab8987 100644 --- a/ghc/tests/ccall/should_run/fed001.hs +++ b/ghc/tests/ccall/should_run/fed001.hs @@ -1,31 +1,31 @@ import Foreign import Monad -newtype Ptr a = Ptr Addr -unPtr (Ptr x) = x +newtype XPtr a = XPtr Addr +unXPtr (XPtr x) = x type CInt = Int32 type CSize = Word32 foreign export dynamic - mkComparator :: (Ptr Int -> Ptr Int -> IO CInt) - -> IO (Ptr (Ptr Int -> Ptr Int -> IO CInt)) + mkComparator :: (XPtr Int -> XPtr Int -> IO CInt) + -> IO (XPtr (XPtr Int -> XPtr Int -> IO CInt)) foreign import - qsort :: Addr -> CSize -> CSize -> Ptr (Ptr Int -> Ptr Int -> IO CInt) + qsort :: Ptr Int -> CSize -> CSize -> XPtr (XPtr Int -> XPtr Int -> IO CInt) -> IO () -compareInts :: Ptr Int -> Ptr Int -> IO CInt +compareInts :: XPtr Int -> XPtr Int -> IO CInt compareInts a1 a2 = do - i1 <- peek (unPtr a1) - i2 <- peek (unPtr a2) + i1 <- peek (Ptr (unXPtr a1)) + i2 <- peek (Ptr (unXPtr a2)) return (fromIntegral (i1 - i2 :: Int)) main :: IO () main = do let values = [ 12, 56, 90, 34, 78 ] :: [Int] n = length values - buf <- mallocElems (head values) n + buf <- mallocArray n zipWithM_ (pokeElemOff buf) [ 0 .. ] values c <- mkComparator compareInts qsort buf (fromIntegral n) (fromIntegral (sizeOf (head values))) c