derive-storable-0.3.0.0: Derive Storable instances with GHC.Generics.
Copyright(c) Mateusz Kłoczko 2016
LicenseMIT
Maintainermateusz.p.kloczko@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Foreign.Storable.Generic.Tools

Description

 
Synopsis

Documentation

type Size = Int Source #

data Filling Source #

The datatype representing the memory layout of a given struct.

Constructors

Size Int 
Padding Int 

Instances

Instances details
Eq Filling Source # 
Instance details

Defined in Foreign.Storable.Generic.Tools

Methods

(==) :: Filling -> Filling -> Bool #

(/=) :: Filling -> Filling -> Bool #

Show Filling Source # 
Instance details

Defined in Foreign.Storable.Generic.Tools

calcOffsets Source #

Arguments

:: [(Size, Alignment)]

List of sizes and aligments of the type's/struct's fields. [(Int,Int)]

-> [Offset]

List representing the offests of the type's/struct's fields. [Int]

Calculates the memory offset of type's/struct's fields.

calcSize Source #

Arguments

:: [(Size, Alignment)]

List of sizes and aligments of the type's/struct's fields. [(Int,Int)].

-> Size

The returned size. Int

Calculates the size of the type/struct.

calcAlignment Source #

Arguments

:: [Alignment]

List of struct's fields' alignments.

-> Alignment

The resulting alignment.

Calculate the alignment of a struct.

getFilling Source #

Arguments

:: [(Size, Alignment)]

List of sizes and aligments of the type's/struct's fields. [(Int,Int)]

-> [Filling]

List representing the memory layout. [Filling]

Get the memory layout of a given type/struct. Used mostly as debug information.