| Maintainer | Bas van Dijk <v.dijk.bas@gmail.com> |
|---|
Foreign.Marshal.Array.Region
Contents
Description
- mallocArray :: (Storable α, RegionControlIO pr) => Int -> RegionT s pr (RegionalPtr α (RegionT s pr))
- mallocArray0 :: (Storable α, RegionControlIO pr) => Int -> RegionT s pr (RegionalPtr α (RegionT s pr))
- allocaArray :: (Storable α, RegionControlIO pr) => Int -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β
- allocaArray0 :: (Storable α, RegionControlIO pr) => Int -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β
- peekArray :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => Int -> pointer α pr -> cr [α]
- peekArray0 :: (AllocatedPointer pointer, Storable α, Eq α, AncestorRegion pr cr, MonadIO cr) => α -> pointer α pr -> cr [α]
- pokeArray :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => pointer α pr -> [α] -> cr ()
- pokeArray0 :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => α -> pointer α pr -> [α] -> cr ()
- newArray :: (Storable α, RegionControlIO pr) => [α] -> RegionT s pr (RegionalPtr α (RegionT s pr))
- newArray0 :: (Storable α, RegionControlIO pr) => α -> [α] -> RegionT s pr (RegionalPtr α (RegionT s pr))
- withArray :: (Storable α, RegionControlIO pr) => [α] -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β
- withArray0 :: (Storable α, RegionControlIO pr) => α -> [α] -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β
- withArrayLen :: (Storable α, RegionControlIO pr) => [α] -> (forall sl. Int -> LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β
- withArrayLen0 :: (Storable α, RegionControlIO pr) => α -> [α] -> (forall sl. Int -> LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β
- copyArray :: (AllocatedPointer pointer1, AllocatedPointer pointer2, Storable α, AncestorRegion pr1 cr, AncestorRegion pr2 cr, MonadIO cr) => pointer1 α pr1 -> pointer2 α pr2 -> Int -> cr ()
- moveArray :: (AllocatedPointer pointer1, AllocatedPointer pointer2, Storable α, AncestorRegion pr1 cr, AncestorRegion pr2 cr, MonadIO cr) => pointer1 α pr1 -> pointer2 α pr2 -> Int -> cr ()
- lengthArray0 :: (AllocatedPointer pointer, Storable α, Eq α, AncestorRegion pr cr, MonadIO cr) => α -> pointer α pr -> cr Int
- advancePtr :: (AllocatedPointer pointer, Storable α) => pointer α pr -> Int -> pointer α pr
Allocation
mallocArray :: (Storable α, RegionControlIO pr) => Int -> RegionT s pr (RegionalPtr α (RegionT s pr))Source
Allocate storage for the given number of elements of a storable type.
Like malloc, but for multiple elements.
mallocArray0 :: (Storable α, RegionControlIO pr) => Int -> RegionT s pr (RegionalPtr α (RegionT s pr))Source
Like mallocArray, but add an extra position to hold a special termination
element.
allocaArray :: (Storable α, RegionControlIO pr) => Int -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr βSource
Temporarily allocate space for the given number of elements (like alloca,
but for multiple elements).
allocaArray0 :: (Storable α, RegionControlIO pr) => Int -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr βSource
Like allocaArray, but add an extra position to hold a special termination
element.
Marshalling
peekArray :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => Int -> pointer α pr -> cr [α]Source
Convert an array of given length into a Haskell list.
(This version traverses the array backwards using an accumulating parameter,
which uses constant stack space. The previous version using mapM needed
linear stack space.)
Wraps: Foreign.Marshal.Array..
peekArray
peekArray0 :: (AllocatedPointer pointer, Storable α, Eq α, AncestorRegion pr cr, MonadIO cr) => α -> pointer α pr -> cr [α]Source
Convert an array terminated by the given end marker into a Haskell list.
Wraps: Foreign.Marshal.Array..
peekArray0
pokeArray :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => pointer α pr -> [α] -> cr ()Source
Write the list elements consecutive into memory.
Wraps: Foreign.Marshal.Array..
pokeArray
pokeArray0 :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => α -> pointer α pr -> [α] -> cr ()Source
Write the list elements consecutive into memory and terminate them with the given marker element.
Wraps: Foreign.Marshal.Array..
pokeArray0
Combined allocation and marshalling
newArray :: (Storable α, RegionControlIO pr) => [α] -> RegionT s pr (RegionalPtr α (RegionT s pr))Source
Write a list of storable elements into a newly allocated, consecutive sequence of storable values.
Like new, but for multiple elements.
newArray0 :: (Storable α, RegionControlIO pr) => α -> [α] -> RegionT s pr (RegionalPtr α (RegionT s pr))Source
Write a list of storable elements into a newly allocated, consecutive sequence of storable values, where the end is fixed by the given end marker.
withArray :: (Storable α, RegionControlIO pr) => [α] -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr βSource
Temporarily store a list of storable values in memory.
Like with, but for multiple elements.
withArray0 :: (Storable α, RegionControlIO pr) => α -> [α] -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr βSource
Like withArray, but a terminator indicates where the array ends.
withArrayLen :: (Storable α, RegionControlIO pr) => [α] -> (forall sl. Int -> LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr βSource
Like withArray, but the action gets the number of values as an additional
parameter.
withArrayLen0 :: (Storable α, RegionControlIO pr) => α -> [α] -> (forall sl. Int -> LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr βSource
Like withArrayLen, but a terminator indicates where the array ends.
Copying
Arguments
| :: (AllocatedPointer pointer1, AllocatedPointer pointer2, Storable α, AncestorRegion pr1 cr, AncestorRegion pr2 cr, MonadIO cr) | |
| => pointer1 α pr1 | Destination |
| -> pointer2 α pr2 | Source |
| -> Int | Number of elements to copy. |
| -> cr () |
Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may not overlap.
Wraps: Foreign.Marshal.Array..
copyArray
Arguments
| :: (AllocatedPointer pointer1, AllocatedPointer pointer2, Storable α, AncestorRegion pr1 cr, AncestorRegion pr2 cr, MonadIO cr) | |
| => pointer1 α pr1 | Destination |
| -> pointer2 α pr2 | Source |
| -> Int | Number of elements to move. |
| -> cr () |
Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may overlap.
Wraps: Foreign.Marshal.Array..
moveArray
Finding the length
lengthArray0 :: (AllocatedPointer pointer, Storable α, Eq α, AncestorRegion pr cr, MonadIO cr) => α -> pointer α pr -> cr IntSource
Return the number of elements in an array, excluding the terminator.
Wraps: Foreign.Marshal.Array..
lengthArray0
Indexing
advancePtr :: (AllocatedPointer pointer, Storable α) => pointer α pr -> Int -> pointer α prSource
Advance a pointer into an array by the given number of elements.
Wraps: Foreign.Marshal.Array..
advancePtr