Module documentation for 0.28.6

`c2hs` is a interfacing tool that eases Haskell access to C libraries.The tool gets information about the C data type definitions andfunction signatures by analysing the C header files of the library.It uses this information to compute the missing details in thetemplate of a Haskell module &mdash; called the binding file &mdash;that implements a Haskell binding to the C library. Hooks embedded inthe binding file signal where, which, and how C objects are accessedfrom Haskell. The Haskell code in the binding file determines Haskelltypes signatures and marshaling details.

Further information is on the[wiki](https://github.com/haskell/c2hs/wiki/Home). Also see the[user guide](https://github.com/haskell/c2hs/wiki/User-Guide) (alsoavailable in the `doc` directory of the repository).

## Installing

See the file `INSTALL`.

## Copyleft

This system is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation; either version 2 of the License, or (at youroption) any later version.

This system is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.

You should have received a copy of the GNU General Public Licensealong with this system; if not, write to the Free Software Foundation,Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

> **NOTE HOWEVER**, all code included into generated bindings is under> a BSD-style license that does not place any restrictions on the> license of the inteface produced with `c2hs` (ie, closed proprietary> licenses are possible, too). In other words, I do not care what you> use `c2hs` for or to whom you are giving `c2hs` or any interfaces> generated with `c2hs`, only if you modify or improve `c2hs` itself,> you have to contribute your changes back to the community.> Nevertheless, I will of course be particularly delighted if you> choose to make your work freely available.

## Credits

See the file `AUTHORS`.

Changes

CHANGES ABOVE THIS POINT ARE FOR VERSIONS AFTER THE MOVE OF THE REPOSITORYTO GITHUB AND ARE DESCRIBED IN THE MAIN ChangeLog FILE.

2005-12-12 Manuel M T Chakravarty <chak@cse.unsw.edu.au>

* c2hs/gen/GenBind.hs: When translating the target type of a pointer hook into a Haskell type, don't take the pointer hook alias map into account.

* c2hs.cabal: version 0.14.5

* c2hs/gen/GenBind.hs: Suppress code generation if requested

* c2hs/chs/CHS.hs: Added `nocode' to pointer hooks

* c2hs/chs/CHSLexer.hs: Added `nocode'

2005-12-05 Jelmer Vernooij <jelmer@samba.org>

* c2hs/c/CTrav.hs: only match in `checkForOneCUName' if there are no indirections

* toplevel/Main.hs (process): if there is no explicit output file specified, the header file is put in the same directory as the binding file; otherwise, it goes in the directory where the output file is put

* gen/GenHeader.hs (ghFrag): sentries for conditionals must not be turned into internal identifiers, as this spoils later equality tests with identifiers read from the pre-processed header file; bug reported by Axel Simon <A.Simon@ukc.ac.uk>

* chs/CHSLexer.hs (haskell): the lexeme for one-line comments shouldn't include the terminating newline, as this removes the newline for following lexemes (eg, CPP directives) and is not really necessary due to the Principle of the Longest Match

* gen/GenHeader.hs: debugging

2003-02-05 Manuel M T Chakravarty <chak@cse.unsw.edu.au>

* gen/GenHeader.hs: New module extracting CPP directives and inline-C from a .chs file

* c2hs.spec.in: we now require the Haskell compiler to be the one for which the package was build

* Makefile: adapted to revised build system

* toplevel/Version.hs (versnum): 0.10.10

2002-03-06 Manuel M T Chakravarty <chak@cse.unsw.edu.au>

* chs/CHSLexer.hs (haskell): Escape characters in Haskell strings haven't been handled correctly in all cases as reported by Volker Wysk <post@volker-wysk.de>; we also have to handle character constants specially, because '"' is a legal Haskell character constant

2002-03-03 Manuel M T Chakravarty <chak@cse.unsw.edu.au>

* configure.in: Package handling fix by Jens Petersen

* toplevel/Version.hs (versnum): 0.10.9

2002-02-25 Manuel M T Chakravarty <chak@cse.unsw.edu.au>

* gen/GenBind.hs: debugging

2002-02-24 Manuel M T Chakravarty <chak@cse.unsw.edu.au>

* chs/CHS.hs (parseOptAs): `^' as synonym for previous identifier, but with underscores rewritten to caps

* chs/CHSLexer.hs: added `CHSTokHat'

2002-02-23 Manuel M T Chakravarty <chak@cse.unsw.edu.au>

* lib/C2HSMarsh.hs: added some more convenience functions

2002-02-21 Manuel M T Chakravarty <chak@cse.unsw.edu.au>

* gen/GenBind.hs: Completed processing of function hooks

2002-02-18 Manuel M T Chakravarty <chak@cse.unsw.edu.au>

* chs/CHSLexer.hs: Added `CHSTokMinus'

* chs/CHS.hs: Revised the syntax of fun hooks

* chs/CHSLexer.hs: Added `CHSTokAmp' (representing `&')

* gen/GenBind.hs (foreignImport): factorised the code for call hook generation to make those portions that are also useful for fun hooks reusable (expandHook): implemented fun hooks

* gen/GBMonad.hs: extracted monad-related code from `GenBind.hs'

* gen/GenBind.hs: split off the monad definition and operations into `GBMonad.hs'

* gen/GenBind.hs (mergeMaps): now, the read map overrides any entires for shared keys in the map that is already in the monad; this is so that, if multiple import hooks add entries for shared keys, the textually latest prevails; any local entries are entered after all import hooks anyway

* gen/GenBind.hs (extractCompType): as pointed out by Axel Simon, we can't return `ForeignPtr's from imported foreign functions (setGet): the `accessType' story is largely redundant with the new formulation of `extractCompType', but we still need to check the marshaled type (setGet): `DefinedET' now takes a declaration rather than an identifier as its first argument; this is necessary for anonymous declerators (extractCompType): functions are now extracted correctly

* c/CTrav.hs (isPtrDecl): works on identifiers now and chases declarations (dropPtrDeclr): added

* chs/CHS.hs: Added code implementing the `alias' hook and the `deriving' option for the `enum' hook. This code was contributed by Axel Simon <simona_@web.de> (also related code in CHSLexer.hs); but added parenthesis to `deriving'

* gen/GenBind.hs: The following patch was contributed by Axel Simon <simona_@web.de>: `extractCompType' generates addresses of type `Ptr <type>' instead of `Addr' (if `--old-ffi=no', which is the default)

* gen/GenBind.hs (transTabToTransFun): properly handles prefixes in the translation function (enumDef): prefixes are now generally removed from enumerators without the constraint that the prefix has to be removed from all enumerators or none

0.2.0~~~~~29Aug99 full path completed19Aug99 started `lib' part17Aug99 started `gen' part17Aug99 finished the CHS parser and printing routines in `CHS.hs'16Aug99 finished first version of CHS lexer; added `CHS.hs'15Aug99 started `chs' part

0.1.1~~~~~12Aug99 Various fixes to the C lexer and parser; added toplevel/Main.hs and c/C.hs

0.1.0~~~~~03Apr99 Finished first complete version of C lexer and parser27Feb99 starting project