| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
KB.Text.Shape.FFI.Allocator
Synopsis
- type Allocator = Ptr () -> Ptr Op -> IO ()
- mkAllocator :: Allocator -> IO (FunPtr Allocator)
- freeAllocator :: FunPtr Allocator -> IO ()
- withAllocator :: Allocator -> (FunPtr Allocator -> IO a) -> IO a
- newtype OpKind = OpKind CInt
- pattern OP_KIND_NONE :: OpKind
- pattern OP_KIND_ALLOCATE :: OpKind
- pattern OP_KIND_FREE :: OpKind
- data Op = Op {}
- opUnionBase :: Int
Documentation
typedef void kbts_allocator_function(void *Data, kbts_allocator_op *Op);
[Data] the custom data pointer you passed in along with your allocator.
[Op] the memory request. It is of this type:
:kbts_allocator_op
:allocator_op
typedef struct kbts_allocator_op
{
kbts_allocator_op_kind Kind;
union
{
kbts_allocator_op_allocate Allocate;
kbts_allocator_op_free Free;
};
} kbts_allocator_op;
And the possible op kinds are: KBTS_ALLOCATOR_OP_KIND_ALLOCATE KBTS_ALLOCATOR_OP_KIND_FREE
ALLOCATE expects you to fill in Op->Allocate.Pointer. The allocation does not need to be aligned. FREE expects you to free Op->Free.Pointer.
type Allocator = Ptr () -> Ptr Op -> IO () Source #
void kbts_allocator_function(void *Data, kbts_allocator_op *Op);
Instances
| Storable OpKind Source # | |
| Show OpKind Source # | |
| Eq OpKind Source # | |
| Ord OpKind Source # | |
pattern OP_KIND_NONE :: OpKind Source #
pattern OP_KIND_ALLOCATE :: OpKind Source #
pattern OP_KIND_FREE :: OpKind Source #
Constructors
| Op | |
opUnionBase :: Int Source #