flow2dot 0.5.1 → 0.6
raw patch · 5 files changed
+38/−9 lines, 5 filesdep −dotgen
Dependencies removed: dotgen
Files
- README +14/−1
- Text/FlowDiagram.hs +3/−5
- flow2dot-fix-dot-lost-edges +16/−0
- flow2dot.cabal +3/−3
- flow2dot.hs +2/−0
README view
@@ -15,7 +15,7 @@ and use it for scaling, colors, pagination etc. Latest version could be obtained via:- darcs pull http://adept.linux.kiev.ua/repos/flow2dot/+ darcs pull http://adept.linux.kiev.ua:8080/repos/flow2dot/ License : BSD-style (see the file LICENSE) Send patches to dastapov@gmail.com (using "darcs send")@@ -24,3 +24,16 @@ suggestions on how to modularize this. Thanks to Dema from haskell@conference.jabber.ru for win32 testing. Gwern0 helped to adapt this to GHC 6.8.2++Known issues+============++* Dot < 2.12 will most likely segfault on files generated by flow2dot++* If your version of dot complains about "Error: lost n1 n2 edge", try using+flow2dot-fix-dot-lost-edges in place of dot:++ runhaskell flow2dot your.flow | flow2dot-fix-dot-lost-edges -T png -o your.png++Trick is to remove 'constraint="false"' from all edges that dot reports as lost.+
Text/FlowDiagram.hs view
@@ -115,7 +115,7 @@ connectToPrev from f connectToPrev to t connectToPrev "___tier" tier- edge f t [("label",l) {-,("constraint","false")-} ] -- This is not needed with recent graphviz+ edge f t [("label",l) ,("constraint","false") ] incTier mkLabel :: String -> Diagram String@@ -128,7 +128,8 @@ reflow :: String -> String -- FIXME: for now, you have to hardcode desired width/height ratio-reflow str = concat $ intersperse [chr 10] $ map unwords $ splitInto words_in_row w+-- FIXME: (tail $ init $ show) trick is needed to work around dotgen-0.2 limitations+reflow str = tail $ init $ show $ concat $ intersperse [chr 10] $ map unwords $ splitInto words_in_row w where w = words str z = length w rows = z*height `div` (height+width)@@ -241,7 +242,6 @@ instance Arbitrary Name where arbitrary = liftM Name (listOf' $ elements "abcxyz_банк")- coarbitrary = undefined instance Arbitrary Message where -- words.unwords trick is needed to prevent Messages which contain only spaces@@ -249,7 +249,6 @@ -- One special case which i decided to hard-code , (1, return "foo -> bar") ]- coarbitrary = undefined instance Arbitrary Flow where arbitrary = frequency [ (10, liftM3 Msg mkName mkName mkMsg)@@ -258,7 +257,6 @@ where mkName = do Name n <- arbitrary; return n mkMsg = do Message m <- arbitrary; return m- coarbitrary = undefined -- Taken from a unreleased version of quickcheck -- Just added ' to the names
+ flow2dot-fix-dot-lost-edges view
@@ -0,0 +1,16 @@+#!/bin/bash+# Fix generated diagram for dot 2.20.x to remove complains about "Lost edges"+input=$(mktemp)+log=$(mktemp)+cat > $input+dot "$@" < $input 2> $log+[ -s $log ] && (+ sedpgm=$(mktemp)+ while read foo foo f t foo ; do+ echo "/$f -> $t/s/,constraint=\"false\"//;" >> $sedpgm+ done < $log+ sed -f $sedpgm < $input | dot "$@"+ rm $log + rm $sedpgm+)+rm $input
flow2dot.cabal view
@@ -1,5 +1,5 @@ Name: flow2dot-Version: 0.5.1+Version: 0.6 License: BSD3 License-File: LICENSE Author: Dmitry Astapov <dastapov@gmail.com>@@ -15,11 +15,11 @@ Tested-With: GHC >=6.8.2 Build-Type: Simple-Extra-Source-Files: README+Extra-Source-Files: README flow2dot-fix-dot-lost-edges Library Exposed-Modules: Text.FlowDiagram- Build-Depends: base, mtl >= 1.0, containers, haskell98, QuickCheck, parsec, utf8-string, dotgen >= 0.2+ Build-Depends: base, mtl >= 1.0, containers, haskell98, QuickCheck, parsec, utf8-string Executable flow2dot Main-Is: flow2dot.hs
flow2dot.hs view
@@ -12,6 +12,8 @@ module Main where import Text.FlowDiagram+import System.IO.UTF8 (putStrLn)+import Prelude hiding (putStrLn) import System (getArgs) main :: IO ()