module HpcFlags where
import System.Console.GetOpt
-import Data.Maybe ( fromMaybe )
import qualified HpcSet as Set
import Data.Char
import Trace.Hpc.Tix
, mergeModule :: MergeFun -- module-wise merge
}
+default_flags :: Flags
default_flags = Flags
{ outputFile = "-"
, includeMods = Set.empty
-- We do this after reading flags, because the defaults
-- depends on if specific flags we used.
+default_final_flags :: Flags -> Flags
default_final_flags flags = flags
{ srcDirs = if null (srcDirs flags)
then ["."]
infoArg :: String -> FlagOptSeq
infoArg info = (:) $ Option [] [] (NoArg $ id) info
+excludeOpt, includeOpt, hpcDirOpt, srcDirOpt, destDirOpt, outputOpt,
+ perModuleOpt, decListOpt, xmlOutputOpt, funTotalsOpt,
+ altHighlightOpt, combineFunOpt, combineFunOptInfo, mapFunOpt,
+ mapFunOptInfo, unionModuleOpt :: FlagOptSeq
excludeOpt = anArg "exclude" "exclude MODULE and/or PACKAGE" "[PACKAGE:][MODULE]"
$ \ a f -> f { excludeMods = a `Set.insert` excludeMods f }
-------------------------------------------------------------------------------
readMixWithFlags :: Flags -> Either String TixModule -> IO Mix
-readMixWithFlags flags mod = readMix [ dir ++ "/" ++ hpcDir flags
- | dir <- srcDirs flags
- ] mod
+readMixWithFlags flags modu = readMix [ dir ++ "/" ++ hpcDir flags
+ | dir <- srcDirs flags
+ ] modu
-------------------------------------------------------------------------------
+command_usage :: Plugin -> IO ()
command_usage plugin =
putStrLn $
"Usage: hpc " ++ (name plugin) ++ " " ++
thePostFun :: PostFun -> Integer -> Integer
thePostFun ID x = x
thePostFun INV 0 = 1
-thePostFun INV n = 0
-thePostFun ZERO x = 0
+thePostFun INV _ = 0
+thePostFun ZERO _ = 0
+postFuns :: [(String, PostFun)]
postFuns = [ (show pos,pos)
- | pos <- [INV .. ZERO]
+ | pos <- [ID .. ZERO]
]
theMergeFun INTERSECTION = Set.intersection
theMergeFun UNION = Set.union
+mergeFuns :: [(String, MergeFun)]
mergeFuns = [ (show pos,pos)
| pos <- [INTERSECTION,UNION]
]