X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fhpc%2FHpcMarkup.hs;h=3be17c8da69e3cf50e3ca25c07779a72bcc902a4;hb=f9c199a1a2865bdb9e8fb318a48058d7e4bfaf64;hp=53eaf323e8e07340c90823d5cbe4affbc88acd93;hpb=11d36d9f0256a3a3ef2934a776924f7c90afb6de;p=ghc-hetmet.git diff --git a/utils/hpc/HpcMarkup.hs b/utils/hpc/HpcMarkup.hs index 53eaf32..3be17c8 100644 --- a/utils/hpc/HpcMarkup.hs +++ b/utils/hpc/HpcMarkup.hs @@ -10,20 +10,25 @@ import Trace.Hpc.Tix import Trace.Hpc.Util import HpcFlags +import HpcUtils import System.Environment +import System.Directory import Data.List import Data.Maybe(fromJust) import Data.Array -import qualified Data.Set as Set +import qualified HpcSet as Set ------------------------------------------------------------------------------ -markup_options = - [ excludeOpt,includeOpt,hpcDirOpt,hsDirOpt,funTotalsOpt - , altHighlightOpt - , destDirOpt - ] +markup_options + = excludeOpt + . includeOpt + . srcDirOpt + . hpcDirOpt + . funTotalsOpt + . altHighlightOpt + . destDirOpt markup_plugin = Plugin { name = "markup" , usage = "[OPTION] .. [ [ ..]]" @@ -43,20 +48,23 @@ markup_main flags (prog:modNames) = do `Set.union` includeMods flags } let Flags - { hpcDirs = hpcDirs - , hsDirs = theHsPath - , funTotals = theFunTotals + { funTotals = theFunTotals , altHighlight = invertOutput , destDir = dest_dir } = hpcflags1 mtix <- readTix (getTixFileName prog) Tix tixs <- case mtix of - Nothing -> error $ "unable to find tix file for: " ++ prog + Nothing -> hpcError markup_plugin $ "unable to find tix file for: " ++ prog Just a -> return a +#if __GLASGOW_HASKELL__ >= 604 + -- create the dest_dir if needed + createDirectoryIfMissing True dest_dir +#endif + mods <- - sequence [ genHtmlFromMod dest_dir hpcDirs tix theFunTotals theHsPath invertOutput + sequence [ genHtmlFromMod dest_dir hpcflags1 tix theFunTotals invertOutput | tix <- tixs , allowModule hpcflags1 (tixModuleName tix) ] @@ -68,6 +76,9 @@ markup_main flags (prog:modNames) = do let writeSummary name cmp = do let mods' = sortBy cmp mods + + + putStrLn $ "Writing: " ++ (name ++ ".html") writeFile (dest_dir ++ "/" ++ name ++ ".html") $ @@ -75,6 +86,7 @@ markup_main flags (prog:modNames) = do "