J_      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^#Bas van Dijk <v.dijk.bas@gmail.com> 3Class of pointers which point to allocated memory.  is the only 1 pointer which is not an instance of this class. The super class _ is not exported by this module  which ensures you can't accidentally make  an instance of this class. _ 5Retrieve the native pointer from a regional pointer. 6This function is unsafe because it allows you to both free the pointer M before the region terminates and use the pointer outside the region when it  is already freed. Apply a pure6 function to the inner pointer of a regional pointer. 9A regional pointer to memory which was locally allocated  by one of the alloca-like functions.  Note that a LocalPtr can not be `licated to a parent region. abA regional pointer to memory. ,This should provide a safer replacement for  Foreign.Ptr.c d:Construct a regional pointer from a native pointer and an IO computation that finalizes the pointer (like free ptr%) which is performed when the region  terminates. 0This function is unsafe because this library can't guarantee that the =finalizer will actually finalize the pointer (suppose having  return () as Fthe finalizer). You have to verify the correct finalisation yourself.  The constant nullPtr3 is a pointer which is not associated with a valid memory location.  Note that nullPtr5 is a pure value. This means it does not perform the ,side-effect of registering a finalizer like " free nullPtr" in the e monad. .Finally note that the region parameter of the  is set to f& which is the ancestor of any region.  This allows  to be used in any region.  d  dd#Bas van Dijk <v.dijk.bas@gmail.com>   #Bas van Dijk <v.dijk.bas@gmail.com>The castPtr4 function casts a pointer from one type to another. Wraps:  Foreign.Ptr.g 8Given an arbitrary address and an alignment constraint, alignPtr yields N the next higher address that fulfills the alignment constraint. An alignment  constraint x* is fulfilled by any address divisible by x. This operation  is idempotent. Wraps:  Foreign.Ptr.h 9Advances the given address by the given offset in bytes. Wraps:  Foreign.Ptr.i AComputes the offset required to get from the second to the first  argument. We have  ' p2 == p1 `plusPtr` (p2 `minusPtr` p1) Wraps:  Foreign.Ptr.j klmne`opfqr   #Bas van Dijk <v.dijk.bas@gmail.com>   f executes the computation f#, passing as argument a pointer to Ja temporarily allocated block of memory sufficient to hold values of type . The memory is freed when f3 terminates (either normally or via an exception). -This should provide a safer replacement for: Foreign.Marshal.Alloc.s. !! n f executes the computation f, passing as argument a 6pointer to a temporarily allocated block of memory of n bytes. OThe block of memory is sufficiently aligned for any of the basic foreign types 5that fits into a memory block of the allocated size. The memory is freed when f3 terminates (either normally or via an exception). -This should provide a safer replacement for: Foreign.Marshal.Alloc.t. "-This should provide a safer replacement for:  Foreign.Marshal.Alloc.u. #EAllocate a block of memory that is sufficient to hold values of type .  Note that:  malloc = $ $ v (undefined :: ) -This should provide a safer replacement for: Foreign.Marshal.Alloc.w. $9Allocate a block of memory of the given number of bytes. OThe block of memory is sufficiently aligned for any of the basic foreign types 5that fits into a memory block of the allocated size. -This should provide a safer replacement for: Foreign.Marshal.Alloc.x.  !"#$ !"#$ !"#$#Bas van Dijk <v.dijk.bas@gmail.com> %& Convert a peek! combinator into a one returning y  if applied to a . Alternative for z. 'A '  corresponds to a {  G but additionally introduces some type equalities to the type-checker. ()** val f executes the computation f!, passing as argument a regional ? pointer to a temporarily allocated block of memory into which val has been  marshalled (the combination of alloca and poke). The memory is freed when f' terminates (either normally or via an  exception). &This provides a safer replacement for Foreign.Marshal.Utils.|. +KAllocate a block of memory and marshal a value into it (the combination of  malloc and poke8). The size of the area allocated is determined by the  v method from the instance of } for the appropriate type. &This provides a safer replacement for Foreign.Marshal.Utils.~. ,=Allocate storage and marshal a storable value wrapped into a '. The  is used to represent ). Alternative for . - Converts a withXXX1 combinator into one marshalling a value wrapped  into a ', using  to represent  NoPointer. Alternative for  .HCopies the given number of bytes from the second area (source) into the + first (destination); the copied areas may not overlap Wraps: Foreign.Marshal.Utils..  Destination Source Number of bytes to copy /HCopies the given number of bytes from the second area (source) into the ' first (destination); the copied areas may overlap Wraps: Foreign.Marshal.Utils..  Destination Source Number of bytes to move %&'()*+,-./*+')(,-%&./ %&&')(()*+,-./#Bas van Dijk <v.dijk.bas@gmail.com>0FAllocate storage for the given number of elements of a storable type. Like #, but for multiple elements. 1Like 0:, but add an extra position to hold a special termination  element. 2BTemporarily allocate space for the given number of elements (like  ,  but for multiple elements). 3Like 2:, but add an extra position to hold a special termination  element. 46Convert an array of given length into a Haskell list. M(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.. 5IConvert an array terminated by the given end marker into a Haskell list. Wraps: Foreign.Marshal.Array.. 61Write the list elements consecutive into memory. Wraps: Foreign.Marshal.Array.. 7LWrite the list elements consecutive into memory and terminate them with the  given marker element. Wraps: Foreign.Marshal.Array.. 8FWrite a list of storable elements into a newly allocated, consecutive  sequence of storable values. Like +, but for multiple elements. 9FWrite a list of storable elements into a newly allocated, consecutive N sequence of storable values, where the end is fixed by the given end marker. :7Temporarily store a list of storable values in memory. Like *, but for multiple elements. ;Like :3, but a terminator indicates where the array ends. <Like :<, but the action gets the number of values as an additional  parameter. =Like <3, but a terminator indicates where the array ends. >JCopy the given number of elements from the second array (source) into the 1 first array (destination); the copied areas may not overlap. Wraps: Foreign.Marshal.Array..  Destination Source  Number of elements to copy. ?JCopy the given number of elements from the second array (source) into the - first array (destination); the copied areas may overlap. Wraps: Foreign.Marshal.Array..  Destination Source  Number of elements to move. @EReturn the number of elements in an array, excluding the terminator. Wraps: Foreign.Marshal.Array.. AAAdvance a pointer into an array by the given number of elements. Wraps: Foreign.Marshal.Array.. 0123456789:;<=>?@A0123456789:;<=>?@A0123456789:;<=>?@A#Bas van Dijk <v.dijk.bas@gmail.com>BKRead a value from a memory area regarded as an array of values of the same K kind. The first argument specifies the start address of the array and the K second the index into the array (the first element of the array has index  0!). The following equality holds,  2 peekElemOff addr idx = IOExts.fixIO $ \result -> / peek (addr `plusPtr` (idx * sizeOf result)) ENote that this is only a specification, not necessarily the concrete ! implementation of the function. Wraps: Foreign.Storable.. CJWrite a value to a memory area regarded as an array of values of the same & kind. The following equality holds:   pokeElemOff addr idx x = , poke (addr `plusPtr` (idx * sizeOf x)) x Wraps: Foreign.Storable.. DHRead a value from a memory location given by a base address and offset.  The following equality holds:  2 peekByteOff addr off = peek (addr `plusPtr` off) Wraps: Foreign.Storable.. ELWrite a value to a memory location given by a base address and offset. The  following equality holds:  6 pokeByteOff addr off x = poke (addr `plusPtr` off) x Wraps: Foreign.Storable.. F-Read a value from the given memory location. ENote that the peek and poke functions might require properly aligned I addresses to function correctly. This is architecture dependent; thus, M portable code should ensure that when peeking or poking values of some type  a, the alignment constraint for a, as given by the function  alignment  is fulfilled. Wraps: Foreign.Storable.. GLWrite the given value to the given memory location. Alignment restrictions  might apply; see F. Wraps: Foreign.Storable.. BCDEFGBCDEFGBCDEFG#Bas van Dijk <v.dijk.bas@gmail.com>HKHandy type synonym for a regional pointer to an array of C wide characters N which is paired with the length of the array instead of terminated by a NUL. < (Thus allowing NUL characters in the middle of the string) ,This should provide a safer replacement for Foreign.C.String.. IKHandy type synonym for a regional pointer to an array of C wide characters  terminated by a NUL. ,This should provide a safer replacement for Foreign.C.String.. JLHandy type synonym for a regional pointer to an array of C characters which H is paired with the length of the array instead of terminated by a NUL. < (Thus allowing NUL characters in the middle of the string) ,This should provide a safer replacement for Foreign.C.String.. KFHandy type synonym for a regional pointer to an array of C characters  terminated by a NUL. ,This should provide a safer replacement for Foreign.C.String.. L9Marshal a NUL terminated C string into a Haskell string. Wraps: Foreign.C.String. M?Marshal a C string with explicit length into a Haskell string. Wraps: Foreign.C.String.. N9Marshal a Haskell string into a NUL terminated C string. The Haskell string may not contain any NUL characters Wraps: Foreign.C.String.. ODMarshal a Haskell string into a C string (ie, character array) with  explicit length information. Wraps: Foreign.C.String.. PHMarshal a Haskell string into a NUL terminated C string using temporary  storage.  the Haskell string may not contain any NUL characters L the memory is freed when the subcomputation terminates (either normally or  via an exception). Wraps: Foreign.C.String.. QLMarshal a Haskell string into a C string (ie, character array) in temporary , storage, with explicit length information. L the memory is freed when the subcomputation terminates (either normally or  via an exception). Wraps: Foreign.C.String.. R Generalizes Foreign.C.String. to any . S9Marshal a NUL terminated C string into a Haskell string. Wraps: Foreign.C.String.. T?Marshal a C string with explicit length into a Haskell string. Wraps: Foreign.C.String.. U9Marshal a Haskell string into a NUL terminated C string. The Haskell string may not contain any NUL characters Wraps: Foreign.C.String.. VDMarshal a Haskell string into a C string (ie, character array) with  explicit length information. Wraps: Foreign.C.String.. WHMarshal a Haskell string into a NUL terminated C string using temporary  storage.  the Haskell string may not contain any NUL characters L the memory is freed when the subcomputation terminates (either normally or  via an exception). Wraps: Foreign.C.String.. XLMarshal a Haskell string into a C string (ie, character array) in temporary , storage, with explicit length information. L the memory is freed when the subcomputation terminates (either normally or  via an exception). Wraps: Foreign.C.String.. Y>Marshal a NUL terminated C wide string into a Haskell string. Wraps: Foreign.C.String.. ZDMarshal a C wide string with explicit length into a Haskell string. Wraps: Foreign.C.String.. [>Marshal a Haskell string into a NUL terminated C wide string. The Haskell string may not contain any NUL characters. Wraps: Foreign.C.String.. \IMarshal a Haskell string into a C wide string (ie, wide character array) # with explicit length information. Wraps: Foreign.C.String.. ]CMarshal a Haskell string into a NUL terminated C wide string using  temporary storage.  the Haskell string may not contain any NUL characters @ the memory is freed when the subcomputation terminates (either " normally or via an exception). Wraps: Foreign.C.String.. ^CMarshal a Haskell string into a NUL terminated C wide string using  temporary storage.  the Haskell string may not contain any NUL characters. @ the memory is freed when the subcomputation terminates (either " normally or via an exception). Wraps: Foreign.C.String.. HIJKLMNOPQRSTUVWXYZ[\]^KJLMNOPQRSTUVWXIHYZ[\]^HIJKLMNOPQRSTUVWXYZ[\]^       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmn oplmqlmr o( o) o* o+lmslmtlmulmvlmwlmxlmylmz {, {- {. |} {/ {0 ~ 2 ~ 6 | 7 8 9 : ; @ A B C J K L M |N |O |P |Q |R |S     X Y Z [ \ ] ^ _ ` a b c d e f g h i jregional-pointers-0.6Foreign.C.String.RegionForeign.Marshal.Utils.RegionForeign.Ptr.RegionForeign.Ptr.Region.UnsafeForeign.Marshal.Alloc.RegionForeign.Marshal.Array.RegionForeign.Storable.RegionForeign.Ptr.Region.InternalbaseForeign.C.StringcastCharToCSCharcastCSCharToCharcastCharToCUCharcastCUCharToCharcastCharToCCharcastCCharToCharForeign.Marshal.UtilswithManytoBoolfromBoolAllocatedPointerPointer unsafePtr mapPointerLocalPtrNullPtr RegionalPtrunsafeRegionalPtr wrapMallocnullPtr wrapAlloca wrapAlloca2wrapPeekStringLenwrapNewStringLenwrapWithStringLen unsafeWrap unsafeWrap2 unsafeWrap3unsafeWrap2flpcastPtralignPtrplusPtrminusPtralloca allocaBytesallocaBytesAlignedmalloc mallocBytes MaybePeek maybePeek MaybePointer JustPointer NullPointerwithnewmaybeNew maybeWith copyBytes moveBytes mallocArray mallocArray0 allocaArray allocaArray0 peekArray peekArray0 pokeArray pokeArray0newArray newArray0 withArray withArray0 withArrayLen withArrayLen0 copyArray moveArray lengthArray0 advancePtr peekElemOff pokeElemOff peekByteOff pokeByteOffpeekpokeRegionalCWStringLenRegionalCWStringRegionalCStringLenRegionalCString peekCStringpeekCStringLen newCString newCStringLen withCStringwithCStringLencharIsRepresentable peekCAStringpeekCAStringLen newCAStringnewCAStringLen withCAStringwithCAStringLen peekCWStringpeekCWStringLen newCWStringnewCWStringLen withCWStringwithCWStringLenPrivateAllocatedPointer regions-0.9#Control.Monad.Trans.Region.InternaldupGHC.PtrPtrRegionT RootRegion liftCatch mapRegionT liftCallCC runRegionTDupAncestorRegion LocalRegionLocalForeign.Marshal.AllocForeign.StorablesizeOf Data.MaybeNothingMaybeStorableForeign.Marshal.Array CWStringLenCWString CStringLenCStringtransformers-0.2.2.0Control.Monad.IO.ClassMonadIO