Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hooks for controlling various parts of generators.
Synopsis
- data Hooks = Hooks {}
- defaultHooks :: Hooks
- type EnumEvaluator = EnumEvaluatorArgs -> IO (Maybe EnumEvaluatorResult)
- data EnumEvaluatorArgs = EnumEvaluatorArgs {}
- data EnumEvaluatorEntry = EnumEvaluatorEntry {}
- data EnumEvaluatorResult = EnumEvaluatorResult {}
- evaluateEnumsWithCompiler :: Compiler a => a -> EnumEvaluator
- evaluateEnumsWithDefaultCompiler :: EnumEvaluator
- makeCppSourceToEvaluateEnums :: EnumEvaluatorArgs -> ByteString
- interpretOutputToEvaluateEnums :: EnumEvaluatorArgs -> String -> Either String EnumEvaluatorResult
- data NumericTypeInfo
- pickNumericType :: Int -> Integer -> Integer -> Maybe NumericTypeInfo
- internalEvaluateEnumsForInterface :: Interface -> Maybe FilePath -> Bool -> IO (Map ExtName EvaluatedEnumData)
Documentation
These hooks can be used to customize the behaviour of a Hoppy generator.
Hooks | |
|
defaultHooks :: Hooks Source #
The default set of hooks associated with an interface. This sets
hookEvaluateEnums
to evaluateEnumsWithDefaultCompiler
.
Enum evaluation
type EnumEvaluator = EnumEvaluatorArgs -> IO (Maybe EnumEvaluatorResult) Source #
A function that answers with representation information about an enum (e.g.
entries' numeric values) for a given request. On success, it returns the
requested data. On failure, it prints a message to standard error and
returns Nothing
.
data EnumEvaluatorArgs Source #
Inputs to the process of automatically evaluting enums.
EnumEvaluatorArgs | |
|
data EnumEvaluatorEntry Source #
An entry in an enumeration. This also tracks whether the entry came from a scoped enum, for assertion reasons.
EnumEvaluatorEntry | |
|
Instances
Eq EnumEvaluatorEntry Source # | |
Defined in Foreign.Hoppy.Generator.Hook (==) :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> Bool # (/=) :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> Bool # | |
Ord EnumEvaluatorEntry Source # | |
Defined in Foreign.Hoppy.Generator.Hook compare :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> Ordering # (<) :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> Bool # (<=) :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> Bool # (>) :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> Bool # (>=) :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> Bool # max :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> EnumEvaluatorEntry # min :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> EnumEvaluatorEntry # |
data EnumEvaluatorResult Source #
Raw outputs parsed from the output of an enum evaluator.
EnumEvaluatorResult | |
|
Instances
Show EnumEvaluatorResult Source # | |
Defined in Foreign.Hoppy.Generator.Hook showsPrec :: Int -> EnumEvaluatorResult -> ShowS # show :: EnumEvaluatorResult -> String # showList :: [EnumEvaluatorResult] -> ShowS # |
evaluateEnumsWithCompiler :: Compiler a => a -> EnumEvaluator Source #
Evaluate enums using a specified compiler.
evaluateEnumsWithDefaultCompiler :: EnumEvaluator Source #
Calculates enum values using an interface's compiler.
makeCppSourceToEvaluateEnums :: EnumEvaluatorArgs -> ByteString Source #
Constructs the C++ source program to evaluate enums.
interpretOutputToEvaluateEnums :: EnumEvaluatorArgs -> String -> Either String EnumEvaluatorResult Source #
Interprets the output of a program generated by
makeCppSourceToEvaluateEnums
, returning parsed values if successful, and an
error string otherwise.
Internal
data NumericTypeInfo Source #
Bound information about numeric types.
Instances
Read NumericTypeInfo Source # | |
Defined in Foreign.Hoppy.Generator.Spec.Computed | |
Show NumericTypeInfo Source # | |
Defined in Foreign.Hoppy.Generator.Spec.Computed showsPrec :: Int -> NumericTypeInfo -> ShowS # show :: NumericTypeInfo -> String # showList :: [NumericTypeInfo] -> ShowS # |
pickNumericType :: Int -> Integer -> Integer -> Maybe NumericTypeInfo Source #
Selects the preferred numeric type for holding numeric values in the given range.
internalEvaluateEnumsForInterface :: Interface -> Maybe FilePath -> Bool -> IO (Map ExtName EvaluatedEnumData) Source #
Collects all of the enum values that need calculating in an interface, runs the hook to evaluate them, and stores the result in the interface. This won't recalculate enum data if it's already been calculated.