CONTENT="Modular DocBook HTML Stylesheet Version 1.64
Any or all of the parameter-marshalling, body, and result-marshalling statements may be omitted. If they are omitted, Green Card will fill in plausible statements instead, guided by the function's type signature. The rules by which Green Card does this filling in are as follows:
Some C header files define a large number of constants of a particular type. The %const statement provides a convenient abbreviation to allow these constants to be imported into Haskell. For example:
This statement is equivalent to the following %fun statements:
After the automatic fill-in has taken place we would obtain:
Each constant is made available as a Haskell value of the specified type, converted into Haskell by the DIS function for that type. (It is up to the programmer to write a %dis definition for the function -- see Section 9.2.)
There's a variant way of declaring constant within the `%const' directive: you may specify the Haskell name that the C constant name maps to:
The %const declarations allows you to map external names/constants onto Haskell Ints. A more typesafe mapping of constants is provided by the %enum declaration, which maps a set of constants to a Haskell type. 
For example, here's PosixError expressed using %enum:
This creates the following data type plus marshalling functions:
Additionally, it also implicitly creates a DIS:
In the event you want the Haskell compiler to automatically generate instances for the enumeration type it generates, %enum supports this too:
will generate a data type with the derived instances Eq and Show:
In C, some libraries give all their exported names the same prefix, thereby minimizing the impact on the shared namespace. In Haskell we use qualified imports to achieve the same result. To simplify the conversion of C style namespace management to Haskell the %prefix statement specifies which prefixes to remove from the Haskell function names.
This would define the two functions init and sphere which would be implemented by calling OpenGLInit and glSphere respectively.
It is sometimes useful to be able to write arbitrary lines of C code outside any procedure specification, for instance to include a helper C function or define a C structure. The ``%C'' statement is provided for this purpose:
The C code is added directly to the generated C file.