Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Foreign.Hoppy.Generator.Hook
Contents
Description
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.
Constructors
Hooks | |
Fields
|
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.
Constructors
EnumEvaluatorArgs | |
Fields
|
data EnumEvaluatorEntry Source #
An entry in an enumeration. This also tracks whether the entry came from a scoped enum, for assertion reasons.
Constructors
EnumEvaluatorEntry | |
Fields
|
Instances
Eq EnumEvaluatorEntry Source # | |
Defined in Foreign.Hoppy.Generator.Hook Methods (==) :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> Bool # (/=) :: EnumEvaluatorEntry -> EnumEvaluatorEntry -> Bool # | |
Ord EnumEvaluatorEntry Source # | |
Defined in Foreign.Hoppy.Generator.Hook Methods 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.
Constructors
EnumEvaluatorResult | |
Fields
|
Instances
Show EnumEvaluatorResult Source # | |
Defined in Foreign.Hoppy.Generator.Hook Methods 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 Methods readsPrec :: Int -> ReadS NumericTypeInfo # readList :: ReadS [NumericTypeInfo] # | |
Show NumericTypeInfo Source # | |
Defined in Foreign.Hoppy.Generator.Spec.Computed Methods 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 Source #
Arguments
:: Interface | |
-> Maybe FilePath | A optional directory to add to the compiler's header search path. This is meant to be the directory holding C++ files included in the C++ package. |
-> Bool | |
-> IO (Map ExtName EvaluatedEnumData) |
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.