| language-c-0.3.1.1: Analysis and generation of C code | Source code | Contents | Index

Language.C.System.Preprocess

Portability | portable
Stability | experimental
Maintainer | benedikt.huber@gmail.com

Description
Invoking external preprocessors.
Synopsis

class Preprocessor cpp where

parseCPPArgs :: cpp -> [String] -> Either String (CppArgs, [String])
runCPP :: cpp -> CppArgs -> IO ExitCode

data CppOption

= IncludeDir FilePath
| Define String String
| Undefine String
| IncludeFile FilePath

data CppArgs = CppArgs {

cppOptions :: [CppOption]
extraOptions :: [String]
cppTmpDir :: Maybe FilePath
inputFile :: FilePath
outputFile :: Maybe FilePath

}

rawCppArgs :: [String] -> FilePath -> CppArgs
addCppOption :: CppArgs -> CppOption -> CppArgs
addExtraOption :: CppArgs -> String -> CppArgs
runPreprocessor :: Preprocessor cpp => cpp -> CppArgs -> IO (Either ExitCode InputStream)
isPreprocessed :: FilePath -> Bool

Documentation

class Preprocessor cpp where | Source

`Preprocessor` encapsulates the abstract interface for invoking C preprocessors
Methods

parseCPPArgs :: cpp -> [String] -> Either String (CppArgs, [String]) | Source

parse the given command line arguments, and return a pair of parsed and ignored arguments

runCPP :: cpp -> CppArgs -> IO ExitCode | Source

run the preprocessor

Instances

Preprocessor GCC

data CppOption | Source

Generic Options for the preprocessor
Constructors

IncludeDir FilePath |
Define String String |
Undefine String |
IncludeFile FilePath |

data CppArgs | Source

Generic arguments for the preprocessor
Constructors

CppArgs |

cppOptions :: [CppOption] |
extraOptions :: [String] |
cppTmpDir :: Maybe FilePath |
inputFile :: FilePath |
outputFile :: Maybe FilePath |

rawCppArgs :: [String] -> FilePath -> CppArgs | Source

use the given preprocessor arguments without analyzing them

addCppOption :: CppArgs -> CppOption -> CppArgs | Source

add a typed option to the given preprocessor arguments

addExtraOption :: CppArgs -> String -> CppArgs | Source

add a string option to the given preprocessor arguments

runPreprocessor :: Preprocessor cpp => cpp -> CppArgs -> IO (Either ExitCode InputStream) | Source

run the preprocessor and return an `InputStream` if preprocesssing succeeded

isPreprocessed :: FilePath -> Bool | Source

guess whether a file is preprocessed (file end with .i)
Produced by Haddock version 2.4.2