summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorandy@galois.com <unknown>2007-06-29 18:53:07 +0000
committerandy@galois.com <unknown>2007-06-29 18:53:07 +0000
commit858a055da9f768dd20268cdddb3a3b7c904e83ef (patch)
treeee2d11fde1abad3e3e459faa3a087cfef9fdd163 /utils
parent283705dacaf9012f7bd189e5b03b79c21a36ee5f (diff)
downloadhaskell-858a055da9f768dd20268cdddb3a3b7c904e83ef.tar.gz
Fixing hpc tools for 6.2 and 6.4
Diffstat (limited to 'utils')
-rw-r--r--utils/hpc/Hpc.hs2
-rw-r--r--utils/hpc/HpcCombine.hs5
-rw-r--r--utils/hpc/HpcFlags.hs2
-rw-r--r--utils/hpc/HpcMap.hs27
-rw-r--r--utils/hpc/HpcMarkup.hs6
-rw-r--r--utils/hpc/HpcReport.hs2
-rw-r--r--utils/hpc/HpcSet.hs39
-rw-r--r--utils/hpc/Makefile2
8 files changed, 77 insertions, 8 deletions
diff --git a/utils/hpc/Hpc.hs b/utils/hpc/Hpc.hs
index 786323f062..d567a0fad9 100644
--- a/utils/hpc/Hpc.hs
+++ b/utils/hpc/Hpc.hs
@@ -116,4 +116,4 @@ version_plugin = Plugin { name = "version"
version_main _ _ = putStrLn $ "hpc tools, version 0.5-dev"
------------------------------------------------------------------------------- \ No newline at end of file
+------------------------------------------------------------------------------
diff --git a/utils/hpc/HpcCombine.hs b/utils/hpc/HpcCombine.hs
index 193b03c5ce..d16ace940a 100644
--- a/utils/hpc/HpcCombine.hs
+++ b/utils/hpc/HpcCombine.hs
@@ -11,9 +11,8 @@ import Trace.Hpc.Util
import HpcFlags
import Control.Monad
-import qualified Data.Map as Map
-import qualified Data.Set as Set
-
+import qualified HpcSet as Set
+import qualified HpcMap as Map
import System.Environment
------------------------------------------------------------------------------
diff --git a/utils/hpc/HpcFlags.hs b/utils/hpc/HpcFlags.hs
index cb561a6a00..607b1a80cb 100644
--- a/utils/hpc/HpcFlags.hs
+++ b/utils/hpc/HpcFlags.hs
@@ -4,7 +4,7 @@ module HpcFlags where
import System.Console.GetOpt
import Data.Maybe ( fromMaybe )
-import qualified Data.Set as Set
+import qualified HpcSet as Set
import Data.Char
import Trace.Hpc.Tix
diff --git a/utils/hpc/HpcMap.hs b/utils/hpc/HpcMap.hs
new file mode 100644
index 0000000000..adcc4899bb
--- /dev/null
+++ b/utils/hpc/HpcMap.hs
@@ -0,0 +1,27 @@
+module HpcMap ( module HpcMap ) where
+
+#if __GLASGOW_HASKELL__ < 604
+import qualified Data.FiniteMap as Map
+#else
+import qualified Data.Map as Map
+#endif
+
+
+lookup :: Ord key => key -> Map key elt -> Maybe elt
+fromList :: Ord key => [(key,elt)] -> Map key elt
+
+
+#if __GLASGOW_HASKELL__ < 604
+type Map key elt = Map.FiniteMap key elt
+
+lookup = flip Map.lookupFM
+fromList = Map.listToFM
+
+#else
+
+type Map key elt = Map.Map key elt
+
+lookup = Map.lookup
+fromList = Map.fromList
+
+#endif
diff --git a/utils/hpc/HpcMarkup.hs b/utils/hpc/HpcMarkup.hs
index a46fd799eb..001ec29554 100644
--- a/utils/hpc/HpcMarkup.hs
+++ b/utils/hpc/HpcMarkup.hs
@@ -16,14 +16,16 @@ 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
+#if __GLASGOW_HASKELL__ >= 604
, destDirOpt
+#endif
]
markup_plugin = Plugin { name = "markup"
@@ -56,8 +58,10 @@ markup_main flags (prog:modNames) = do
Nothing -> error $ "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
diff --git a/utils/hpc/HpcReport.hs b/utils/hpc/HpcReport.hs
index 2c502f4241..8f063f8300 100644
--- a/utils/hpc/HpcReport.hs
+++ b/utils/hpc/HpcReport.hs
@@ -13,7 +13,7 @@ import HpcFlags
import Trace.Hpc.Mix
import Trace.Hpc.Tix
import Control.Monad hiding (guard)
-import qualified Data.Set as Set
+import qualified HpcSet as Set
notExpecting :: String -> a
notExpecting s = error ("not expecting "++s)
diff --git a/utils/hpc/HpcSet.hs b/utils/hpc/HpcSet.hs
new file mode 100644
index 0000000000..d5dfe38fc7
--- /dev/null
+++ b/utils/hpc/HpcSet.hs
@@ -0,0 +1,39 @@
+module HpcSet ( module HpcSet ) where
+
+import qualified Data.Set as Set
+
+type Set a = Set.Set a
+
+empty :: Set a
+insert :: (Ord a) => a -> Set a -> Set a
+member :: (Ord a) => a -> Set a -> Bool
+null :: Set a -> Bool
+intersection :: Ord a => Set a -> Set a -> Set a
+fromList :: Ord a => [a] -> Set a
+toList :: Set a -> [a]
+union :: Ord a => Set a -> Set a -> Set a
+
+#if __GLASGOW_HASKELL__ < 604
+
+empty = Set.emptySet
+insert = flip Set.addToSet
+member = Set.elementOf
+null = Set.isEmptySet
+intersection = Set.intersect
+fromList = Set.mkSet
+toList = Set.setToList
+union = Set.union
+
+#else
+
+empty = Set.empty
+insert = Set.insert
+member = Set.member
+null = Set.null
+intersection = Set.intersection
+fromList = Set.fromList
+toList = Set.toList
+union = Set.union
+
+#endif
+
diff --git a/utils/hpc/Makefile b/utils/hpc/Makefile
index 12ad17e234..affa2401c8 100644
--- a/utils/hpc/Makefile
+++ b/utils/hpc/Makefile
@@ -6,7 +6,7 @@ INSTALL_PROGS += $(HS_PROG)
HPC_LIB = $(TOP)/libraries/hpc
include $(GHC_COMPAT_DIR)/compat.mk
-SRC_HC_OPTS += $(PACKAGE_HPC)
+SRC_HC_OPTS += $(PACKAGE_HPC) -cpp
binary-dist:
$(INSTALL_DIR) $(BIN_DIST_DIR)/utils/hpc