Skip to content
Snippets Groups Projects
Commit 12c369b3 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel :man_dancing:
Browse files

`M-x untabify` & `M-x delete-trailing-whitespaces`

parent 8e228faf
No related branches found
No related tags found
No related merge requests found
......@@ -6,11 +6,11 @@
-- Andy Gill and Colin Runciman, June 2006
------------------------------------------------------------
-- | Datatypes and file-access routines for the tick data file
-- | Datatypes and file-access routines for the tick data file
-- used by HPC. (.tix)
module Trace.Hpc.Tix(Tix(..), TixModule(..),
tixModuleName, tixModuleHash, tixModuleTixs,
readTix, writeTix, getTixFileName) where
module Trace.Hpc.Tix(Tix(..), TixModule(..),
tixModuleName, tixModuleHash, tixModuleTixs,
readTix, writeTix, getTixFileName) where
import Data.List (isSuffixOf)
import Trace.Hpc.Util (Hash, catchIO)
......@@ -18,14 +18,14 @@ import Trace.Hpc.Util (Hash, catchIO)
-- 'Tix ' is the storage format for our dynamic imformation about what
-- boxes are ticked.
data Tix = Tix [TixModule]
deriving (Read, Show, Eq)
deriving (Read, Show, Eq)
data TixModule = TixModule
String -- module name
Hash -- hash number
Int -- length of tix list (allows pre-allocation at parse time).
[Integer] -- actual ticks
deriving (Read, Show, Eq)
data TixModule = TixModule
String -- module name
Hash -- hash number
Int -- length of tix list (allows pre-allocation at parse time).
[Integer] -- actual ticks
deriving (Read, Show, Eq)
tixModuleName :: TixModule -> String
tixModuleName (TixModule nm _ _ _) = nm
......@@ -45,10 +45,10 @@ readTix tix_filename =
(\ _ -> return $ Nothing)
-- write a Tix File.
writeTix :: String
-> Tix
-> IO ()
writeTix name tix =
writeTix :: String
-> Tix
-> IO ()
writeTix name tix =
writeFile name (show tix)
{-
......@@ -59,8 +59,7 @@ tixName name = name ++ ".tix"
-- getTixFullName takes a binary or .tix-file name,
-- and normalizes it into a .tix-file name.
getTixFileName :: String -> String
getTixFileName str | ".tix" `isSuffixOf` str
= str
| otherwise
= str ++ ".tix"
getTixFileName str | ".tix" `isSuffixOf` str
= str
| otherwise
= str ++ ".tix"
......@@ -22,9 +22,9 @@ import qualified Control.Exception as Exception
import Data.List(foldl')
import Data.Char (ord)
import Data.Bits (xor)
import Data.Word
import Data.Word
-- | 'HpcPos' is an Hpc local rendition of a Span.
-- | 'HpcPos' is an Hpc local rendition of a Span.
data HpcPos = P !Int !Int !Int !Int deriving (Eq, Ord)
-- | 'fromHpcPos' explodes the HpcPos into line:column-line:colunm
......@@ -37,11 +37,11 @@ toHpcPos (l1,c1,l2,c2) = P l1 c1 l2 c2
-- | asks the question, is the first argument inside the second argument.
insideHpcPos :: HpcPos -> HpcPos -> Bool
insideHpcPos small big =
sl1 >= bl1 &&
(sl1 /= bl1 || sc1 >= bc1) &&
sl2 <= bl2 &&
(sl2 /= bl2 || sc2 <= bc2)
insideHpcPos small big =
sl1 >= bl1 &&
(sl1 /= bl1 || sc1 >= bc1) &&
sl2 <= bl2 &&
(sl2 /= bl2 || sc2 <= bc2)
where (sl1,sc1,sl2,sc2) = fromHpcPos small
(bl1,bc1,bl2,bc2) = fromHpcPos big
......@@ -53,11 +53,11 @@ instance Read HpcPos where
where
(before,after) = span (/= ',') pos
(lhs0,rhs0) = case span (/= '-') before of
(lhs,'-':rhs) -> (lhs,rhs)
(lhs,"") -> (lhs,lhs)
_ -> error "bad parse"
(l1,':':c1) = span (/= ':') lhs0
(l2,':':c2) = span (/= ':') rhs0
(lhs,'-':rhs) -> (lhs,rhs)
(lhs,"") -> (lhs,lhs)
_ -> error "bad parse"
(l1,':':c1) = span (/= ':') lhs0
(l2,':':c2) = span (/= ':') rhs0
------------------------------------------------------------------------------
......@@ -69,9 +69,9 @@ class HpcHash a where
newtype Hash = Hash Word32 deriving (Eq)
instance Read Hash where
readsPrec p n = [ (Hash v,rest)
| (v,rest) <- readsPrec p n
]
readsPrec p n = [ (Hash v,rest)
| (v,rest) <- readsPrec p n
]
instance Show Hash where
showsPrec p (Hash n) = showsPrec p n
......@@ -112,4 +112,3 @@ hxor (Hash x) (Hash y) = Hash $ x `xor` y
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
catchIO = Exception.catch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment