splot 0.3.13 → 0.3.14
raw patch · 3 files changed
+16/−19 lines, 3 filesdep ~bytestring-lexing
Dependency ranges changed: bytestring-lexing
Files
- Tools/SPlotMain.hs +7/−7
- Tools/StatePlot.hs +7/−10
- splot.cabal +2/−2
Tools/SPlotMain.hs view
@@ -21,7 +21,7 @@ import qualified Data.ByteString.Char8 as S import qualified Data.ByteString.Lazy.Char8 as B-import Data.ByteString.Lex.Lazy.Double+import Data.ByteString.Lex.Fractional import Control.Monad (when) @@ -144,24 +144,24 @@ let Just (ourBaseTime,_) = strptime "%Y-%m-%d %H:%M:%OS" "1900-01-01 00:00:00" let ourStrptime = if timeFormat == "elapsed" then \s -> do- (d, s') <- readDouble s+ (d, s') <- readDecimal s return (addSeconds d ourBaseTime, s')- else strptime (B.pack timeFormat)+ else strptime (S.pack timeFormat) let ptime = ourStrptime let parseTime s = fromMaybe (error $ "Invalid time: " ++ show s) . ptime $ s- let fromTime = fst `fmap` (ptime $ B.pack $ getArg "fromTime" "" args)- let toTime = fst `fmap` (ptime $ B.pack $ getArg "toTime" "" args)+ let fromTime = fst `fmap` (ptime $ S.pack $ getArg "fromTime" "" args)+ let toTime = fst `fmap` (ptime $ S.pack $ getArg "toTime" "" args) let forcedNumTracks = case getArg "numTracks" "" args of { "" -> Nothing ; n -> Just $ read n } let outPNG = getArg "o" "" args let inputFile = getArg "if" (error "Input file not specified") args- let pruneLF b | not (B.null b) && (B.last b == '\r') = B.init b+ let pruneLF b | not (S.null b) && (S.last b == '\r') = S.init b | otherwise = b let expireTimeMs = read $ getArg "expire" "Infinity" args let phantomColor = case getArg "phantom" "" args of { "" -> Nothing; c -> Just (S.pack c) } let legendWidth = case getArg "legendWidth" "0" args of { "0" -> Nothing; n -> Just (read n) } let readInput = if inputFile == "-" then B.getContents else B.readFile inputFile- let readEvents = (map (parse parseTime . pruneLF) . B.lines) `fmap` readInput+ let readEvents = (map (parse parseTime . pruneLF) . map B.toStrict . B.lines) `fmap` readInput let colorMaps = [(S.pack scheme, map S.pack (words wheel)) | ("-colorscheme":scheme:wheel:_) <- tails args ]
Tools/StatePlot.hs view
@@ -12,9 +12,8 @@ import Data.Time -import qualified Data.ByteString.Lazy.Char8 as B import qualified Data.ByteString.Char8 as S-import Data.ByteString.Lex.Double+import Data.ByteString.Lex.Fractional import qualified Graphics.Rendering.Cairo as C import Data.Colour import Data.Colour.SRGB@@ -38,25 +37,23 @@ | ExpiredBar {-# UNPACK #-} !Double !Double !S.ByteString | OutPulse {-# UNPACK #-} !Double !Glyph !S.ByteString deriving (Show) -parse :: (B.ByteString -> (LocalTime, B.ByteString)) -> B.ByteString -> Event-parse parseTime s = Event { localTime = ts, utcTime = localTimeToUTC utc ts, track = repack $ B.tail track', edge = edge }+parse :: (S.ByteString -> (LocalTime, S.ByteString)) -> S.ByteString -> Event+parse parseTime s = Event { localTime = ts, utcTime = localTimeToUTC utc ts, track = S.tail track', edge = edge } where (ts, s') = parseTime s- (track', arg0) = B.break (==' ') (B.tail s')- arg = if B.null arg0 then S.empty else trim $ repack (B.tail arg0)- edge = case (B.head track') of+ (track', arg0) = S.break (==' ') (S.tail s')+ arg = if S.null arg0 then S.empty else trim (S.tail arg0)+ edge = case (S.head track') of '>' -> Begin (if S.null arg then grayStr else arg) '<' -> End (if S.null arg then S.empty else arg) '=' -> Both duration color where (durationS, color0) = S.break (==' ') arg color = S.tail color0- Just (duration, _) = readDouble durationS+ Just (duration, _) = readDecimal durationS '!' -> Pulse (GlyphText text) color where (color, text0) = S.break (==' ') arg text = S.tail text0 trim = fst . S.spanEnd isSpace--repack = S.concat . B.toChunks grayStr = S.pack "gray"
splot.cabal view
@@ -1,5 +1,5 @@ Name: splot-Version: 0.3.13+Version: 0.3.14 License: BSD3 License-file: LICENSE Copyright: Eugene Kirpichov, 2010@@ -27,7 +27,7 @@ else Build-Depends: base < 3 - Build-Depends: cairo, bytestring, bytestring-lexing < 0.5.0, strptime >= 0.1.7, time, + Build-Depends: cairo, bytestring, bytestring-lexing == 0.5.*, strptime >= 0.1.7, time, containers, colour, mtl, HUnit, template-haskell, vcs-revision >= 0.0.2 Other-Modules: Tools.ColorMap Tools.SPlotTest Tools.SPlotTest Tools.StatePlot Main-Is: Tools/SPlotMain.hs