Safe Haskell | None |
---|---|
Language | Haskell98 |
- genCallable :: Name -> Text -> Callable -> Bool -> ExcCodeGen ()
- hOutType :: Callable -> [Arg] -> Bool -> ExcCodeGen TypeRep
- arrayLengths :: Callable -> [Arg]
- arrayLengthsMap :: Callable -> [(Arg, Arg)]
- callableSignature :: Callable -> Bool -> ExcCodeGen ([Text], [(Text, Text)])
- fixupCallerAllocates :: Callable -> Callable
- wrapMaybe :: Arg -> CodeGen Bool
- inArgInterfaces :: [Arg] -> ExcCodeGen ([Text], [Text])
Documentation
genCallable :: Name -> Text -> Callable -> Bool -> ExcCodeGen () Source
arrayLengths :: Callable -> [Arg] Source
arrayLengthsMap :: Callable -> [(Arg, Arg)] Source
callableSignature :: Callable -> Bool -> ExcCodeGen ([Text], [(Text, Text)]) Source
The Haskell signature for the given callable. It returns a tuple ([constraints], [(type, argname)]).
fixupCallerAllocates :: Callable -> Callable Source
caller-allocates arguments are arguments that the caller
allocates, and the called function modifies. They are marked as
out
argumens in the introspection data, we treat them as inout
arguments instead. The semantics are somewhat tricky: for memory
management purposes they should be treated as "in" arguments, but
from the point of view of the exposed API they should be treated as
"inout". Unfortunately we cannot always just assume that they are
purely "out", so in many cases the generated API is somewhat
suboptimal (since the initial values are not important): for
example for g_io_channel_read_chars the size of the buffer to read
is determined by the caller-allocates argument. As a compromise, we
assume that we can allocate anything that is not a TCArray.
wrapMaybe :: Arg -> CodeGen Bool Source
Given an argument to a function, return whether it should be wrapped in a maybe type (useful for nullable types). We do some sanity checking to make sure that the argument is actually nullable (a relatively common annotation mistake is to mix up (optional) with (nullable)).
inArgInterfaces :: [Arg] -> ExcCodeGen ([Text], [Text]) Source