% -----------------------------------------------------------------------------
-% $Id: PrelMarshalArray.lhs,v 1.8 2001/08/15 09:54:38 qrczak Exp $
+% $Id: PrelMarshalArray.lhs,v 1.9 2002/02/04 09:05:46 chak Exp $
%
% (c) The FFI task force, 2000
%
withArray, -- :: Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray0, -- :: Storable a => a -> [a] -> (Ptr a -> IO b) -> IO b
- -- destruction
- --
- destructArray, -- :: Storable a => Int -> Ptr a -> IO ()
- destructArray0, -- :: (Storable a, Eq a) => a -> Ptr a -> IO ()
-
-- copying (argument order: destination, source)
--
copyArray, -- :: Storable a => Ptr a -> Ptr a -> Int -> IO ()
-- indexing
--
- advancePtr -- :: Storable a => Ptr a -> Int -> Ptr a
+ advancePtr, -- :: Storable a => Ptr a -> Int -> Ptr a
+
+ -- DEPRECATED: Don't use!
+ destructArray, -- :: Storable a => Int -> Ptr a -> IO ()
+ destructArray0, -- :: (Storable a, Eq a) => a -> Ptr a -> IO ()
) where
import Monad
-- destruct each element of an array (in reverse order)
--
destructArray :: Storable a => Int -> Ptr a -> IO ()
+{-# DEPRECATED destructArray "This function is not standards complaint" #-}
destructArray size ptr =
sequence_ [destruct (ptr `advancePtr` i)
| i <- [size-1, size-2 .. 0]]
-- like `destructArray', but a terminator indicates where the array ends
--
destructArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO ()
+{-# DEPRECATED destructArray0 "This function is not standards complaint" #-}
destructArray0 marker ptr = do
size <- lengthArray0 marker ptr
sequence_ [destruct (ptr `advancePtr` i)