| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Foreign.Hoppy.Generator.Compiler
Description
Data types for compilers and functions for invoking them.
Synopsis
- class Show a => Compiler a where
- compileProgram :: a -> FilePath -> FilePath -> IO Bool
- prependIncludePath :: [FilePath] -> a -> a
- data SomeCompiler = forall a.Compiler a => SomeCompiler a
- data SimpleCompiler = SimpleCompiler {
- scProgram :: FilePath
- scArguments :: [String]
- prependArguments :: [String] -> SimpleCompiler -> SimpleCompiler
- appendArguments :: [String] -> SimpleCompiler -> SimpleCompiler
- overrideCompilerFromEnvironment :: SimpleCompiler -> IO SimpleCompiler
- data CustomCompiler = CustomCompiler {
- ccLabel :: String
- ccCompile :: CustomCompiler -> FilePath -> FilePath -> IO Bool
- ccHeaderSearchPath :: [FilePath]
- defaultCompiler :: SimpleCompiler
- gppCompiler :: SimpleCompiler
Typeclass
class Show a => Compiler a where Source #
A compiler that exists on the system for compiling C++ code.
Methods
compileProgram :: a -> FilePath -> FilePath -> IO Bool Source #
compileProgram compiler infile outfile invokes the given compiler in
the input file, to produce the output file. If the compiler fails or can't
be called for whatever reason, then an error message is printed to standard
error, and false is returned.
prependIncludePath :: [FilePath] -> a -> a Source #
Modifies the compiler to prepend the given paths to the header search path.
Instances
| Compiler CustomCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler Methods compileProgram :: CustomCompiler -> FilePath -> FilePath -> IO Bool Source # prependIncludePath :: [FilePath] -> CustomCompiler -> CustomCompiler Source # | |
| Compiler SimpleCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler Methods compileProgram :: SimpleCompiler -> FilePath -> FilePath -> IO Bool Source # prependIncludePath :: [FilePath] -> SimpleCompiler -> SimpleCompiler Source # | |
| Compiler SomeCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler Methods compileProgram :: SomeCompiler -> FilePath -> FilePath -> IO Bool Source # prependIncludePath :: [FilePath] -> SomeCompiler -> SomeCompiler Source # | |
data SomeCompiler Source #
An existential data type for Compilers.
Constructors
| forall a.Compiler a => SomeCompiler a |
Instances
| Show SomeCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler Methods showsPrec :: Int -> SomeCompiler -> ShowS # show :: SomeCompiler -> String # showList :: [SomeCompiler] -> ShowS # | |
| Compiler SomeCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler Methods compileProgram :: SomeCompiler -> FilePath -> FilePath -> IO Bool Source # prependIncludePath :: [FilePath] -> SomeCompiler -> SomeCompiler Source # | |
Data types
data SimpleCompiler Source #
A compiler that can compile a source file into a binary with a single program invocation.
Within the strings in this data type, including the program path, all
occurences of {in} and {out} are expanded to the input and desired output
files, respectively.
Constructors
| SimpleCompiler | |
Fields
| |
Instances
| Show SimpleCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler Methods showsPrec :: Int -> SimpleCompiler -> ShowS # show :: SimpleCompiler -> String # showList :: [SimpleCompiler] -> ShowS # | |
| Compiler SimpleCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler Methods compileProgram :: SimpleCompiler -> FilePath -> FilePath -> IO Bool Source # prependIncludePath :: [FilePath] -> SimpleCompiler -> SimpleCompiler Source # | |
prependArguments :: [String] -> SimpleCompiler -> SimpleCompiler Source #
Adds arguments to the start of a compiler's argument list.
appendArguments :: [String] -> SimpleCompiler -> SimpleCompiler Source #
Adds arguments to the end of a compiler's argument list.
overrideCompilerFromEnvironment :: SimpleCompiler -> IO SimpleCompiler Source #
Modifies a SimpleCompiler based on environment variables.
If CXX is set and non-empty, it will override the compiler's scProgram.
If CXXFLAGS is set and non-empty, it will be split into words and each word
will be prepended as an argument to scArguments. Quoting is not supported.
data CustomCompiler Source #
A Compiler that allows plugging arbitary logic into the compilation
process.
Constructors
| CustomCompiler | |
Fields
| |
Instances
| Show CustomCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler Methods showsPrec :: Int -> CustomCompiler -> ShowS # show :: CustomCompiler -> String # showList :: [CustomCompiler] -> ShowS # | |
| Compiler CustomCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler Methods compileProgram :: CustomCompiler -> FilePath -> FilePath -> IO Bool Source # prependIncludePath :: [FilePath] -> CustomCompiler -> CustomCompiler Source # | |
Standard compilers
defaultCompiler :: SimpleCompiler Source #
The default compiler, used by an Interface
that doesn't specify its own. This will be gppCompiler, however if the
environment variables CXX or CXXFLAGS are set and nonempty, they will be
used. CXX will override the path to the compiler used, and CXXFLAGS will
be split on spaces and appended to the compiler's argument list.
Specifically, this is defined as:
unsafePerformIO$overrideCompilerFromEnvironmentgppCompiler
gppCompiler :: SimpleCompiler Source #
The GNU C++ compiler, invoked as g++ -o {out} {in}.