-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generate FFI import declarations from C include files -- -- Haskell FFI Binding Modules Generator (HSFFIG) is a tool that parses C -- library include files (.h) and generates Haskell Foreign Functions -- Interface import declarations for all functions, #define'd constants -- (where possible), enumerations, and structures/unions (to access their -- members). It is assumed that the GNU C Compiler and Preprocessor are -- used. Auto-generated Haskell modules may be imported into an -- application to get access to the foreign library's functions and -- variables. -- -- The package provides a small library that programs using -- auto-generated imports have to link to (specify HSFFIG as one of -- build-depends), and two executable programs: -- --
-- struct a {
-- int x;
-- };
-- struct b {
-- float x;
-- };
--
--
-- both structures contain a member with the same name, but different
-- types.
--
-- HSFFIG will generate the following instances for the structures above:
--
-- -- instance HSFFIG.FieldAccess.FieldAccess S_a ((CInt)) V_x where -- z --> V_x = (#peek __quote__(struct a), x) z -- (z, V_x) <-- v = (#poke __quote__(struct a), x) z v -- ... -- instance HSFFIG.FieldAccess.FieldAccess S_b ((CFloat)) V_x where -- z --> V_x = (#peek __quote__(struct b), x) z -- (z, V_x) <-- v = (#poke __quote__(struct b), x) z v ---- -- That is, when the member identified by selector V_x is -- fetched from struct a (S_a), an integer value is -- returned. But when the member with the same name is retrieved from -- struct b, a float value is returned. class FieldAccess a b c | a c -> b (==>) :: (FieldAccess a b c) => Ptr a -> c -> b (-->) :: (FieldAccess a b c) => Ptr a -> c -> IO b (<--) :: (FieldAccess a b c) => (Ptr a, c) -> b -> IO ()